jInitiator console message infinite loop

Question: we have this thick client application running on Oracle forms, using Oracle Application Server version 10.1.2.0.2 and the client side uses Oracle JInitiator: Version 22.214.171.124
on some of the machines, we find the jinitiator console dumping thousands of lines similar to these:
<code>@@@@@@@@ ValorLabel: Logon

@@@@@@@@ ToolTipAdded: 1: Position 1

@@@@@@@@ ToolTipAdded: 2: Position 2

@@@@@@@@ ToolTipAdded: 3: Position 3

######## ValorButton4: Connect pos: 4

@@@@@@@@ ValorLabel: Logon

@@@@@@@@ ToolTipAdded: 1: Position 1

@@@@@@@@ ToolTipAdded: 2: Position 2

@@@@@@@@ ToolTipAdded: 3: Position 3
</code>
and so on, I searched all over the web, with the application vendor, with Oracle meta link and with microsoft knowledge base but with no luck.
the problem of such repeated message, is that it correlates with high heap memory consumption and slow performance of the application that ends eventually by a crash or a hang.
I hope someone can help us identifying the origin of such dump message
system specifications:

Client PC is a Windows XP Service Pack 3
Browsers used IE 6 and IE 7
jInitator version 126.96.36.199
Server App Server is AIX 5.3 running Oracle Forms over Oracle App Server (ias) version 10.1.2.0.2 connected to a Database Server on a different box

we are planning to migrate to Sun Java Plug-in soon, but until we go through change management and testing, we need to find a reason behind this problem
update
this problem does not happen to my laptop, which is having the same jinitiator version.
the only difference I can see is the availability of different JREs and JDKs since I have eclipse installed on this machine..
However, the JRE used by jinitator in both cases (my latop and the affected PCs) is the exact same one.
<code>Oracle JInitiator: Version 188.8.131.52
Using JRE version 126.96.36.199-internal Java HotSpot(TM) Client VM
</code>
I did a dump system properties on the console and the result was almost the same between both terminals (good one and bad one) except for the user name. and some extra paths
thanks a million for your help
Answer: found it!!!
the reason turned out to be some conflict between the JInitiator installed and another application that was installed later on the same machines.
Lotus Expeditor which we pushed centrally seems to conflict with JInitiator causing this endless loop of comments dumped into the Java Console.
this sort of makes since now, since JInitator uses Java Virtual Machines to run, meanwhile, Lotus Expeditor is based on eclipse technology, which in turn is based on Java.
we managed to re-produce the same problem on a clean machine that had no problems before.
the solution to make JInitiator work correctly (regardless what would the impact on Expeditor would be) is to do as follows:

Un-install JInitiator
Delete the JInitiator directory (usually C:\Program Files\Oracle\JInitiator 1.3.x.x)
Remove all JInitiator related entries in register (using regedit)
Delete JAR files cache
Delete a file under user direcotry called .jinit
Reboot machine
Visit the site calling JInitiator, this will automatically load JInitiator on your machine
when asked, install JInitiator in a different directory

the problem should disappear here
note that for us to manage implementing steps 1 to 8, we needed local admin rights for the same user we logged on with on windows
Mysteries to answer are:

what caused the conflict between Expeditor and JInitiator?
will re-installing JInitiator conflict with the newly Lotus Expeditor?


Creating a delayed constraint using the unity term manipulator in prolog

Question: This is my arithmetic inequality expression in prolog:
2*X + 3*Y > 4*Z

I used the unity term manipulator like this:
Expr =.. [Op, Lhs, Rhs]

And now I have Lhs = 2*X + 3*Y, Rhs as 4*Z and Op as >
Everything fine till now.
What I want is to construct a delayed goal using the IC library in Eclipse Prolog for this expression.
Example, I want a newly created variable to assigned like this:
Eq = (Lhs #Op Rhs)  %meaning, Eq = (2*X + 3*Y #> 4*Z)

Now, since the required inequality (in this case >), is stored in Op, though I use Eq = (Lhs #Op Rhs), eclipse is returning error.
How do i create this delayed constraint, when my operator is to be taken from the variable Op?
Thank You.
Answer: You could use facts to define the relations:
cstr(=,#=).

Or use concat_atom/2:
concat_atom([#,Op],CstrOp),

E.g.:
?- Eq = (X = 1),
   Eq =.. [Op, L, R],
   concat_atom([#, Op], CstrOp),
   Cstr =.. [CstrOp, L, R],
   call(Cstr).
Eq = 1 = 1
X = 1
Op = =
L = 1
R = 1
CstrOp = #=
Cstr = 1 #= 1
Yes (0.00s cpu)

Note that this only works for the basic equality/inequality operators. You cannot add # to just any operator and expect it to work as a constraint!


Compiler not recognizing defined type

Question: For some reason F# won't recognize a type I have defined. I have a couple of types:
type point = int * int
type colour = int * int * int

type figure =
  | Circle of point * int * colour
  | Rectangle of point * point * colour
  | Mix of figure * figure

The point and colour types work fine, but when I try to compile a function like:
let testFig : figure =
    (50,50), 45, (255,0,0)

the  compiler throws an fs001 exception, and says it expected figure but got (int*int) * int * (int*int*int) (Which is part of figure!).
I am a little lost and can't see why it's not working.
Comment: How do you expect this to work? How would you distinguish between creating a `Circle` and a `Rectangle` for example?
Comment: The type is to be used in a function, which uses patern maching, so the difference should just be defining it as `let testCircle = (50,50), 45, (255,0,0)` or `let testRect = (0,0), (50,50) (255,0,0)`, for example. Then the pattern matching can get to all the parameters
Comment: Oh, sorry, I misread them as having the same payload type, because they both ended with `int` I guess. In any case my point was that they _can_ have the same type of payload, and if they do you have to distinguish them some other way. That's what the names are for. Otherwise this can easily be answered by reading [the language reference](https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/discriminated-unions). It's not a bad idea to get into the habit of referring to that when you have questions about the basic language concepts.
Answer: To create a figure value, you need to specify the name of the case that you want to create. For example, if you want to create Circle you need to write:
let testFig : figure =
    Circle((50,50), 45, (255,0,0))

Without the Circle constructor, you just create a value (50,50), 45, (255,0,0), which has a type (int * int) * int * (int * int * int). This is the same as point * int * color (because point and color are just aliases).

Compiler not recognizing defined type


Link into Application Insights UI

Question: I have a self-developed dashboard on which I can see certain errors from my apps. I also have Application Insights.
Now I'd like to have links in the graphs of my custom dashboard to the search section of AI with the right filters to find the log events that correspond there.
The URLs in the Azure Portal are horrible though.
Is there any way to do that at all?
Comment: You want to add a link to dashboard which is pointing to the `Search` in app insight?
Comment: Yes, but with search parameters coming from what I clicked on in the dashboard. The point being that I see an error on the dashboard and want to find it quickly to get more details.
Answer: There are couple ways of pinning filtered views:

Pin Analytics query (as a chart). Click through will navigate to Analytics with this query opened
Apply needed filters on Failure / Performance blades and pin them. Click through will navigate to these blades and will preserve all configured filters
Comment: Pinning isn't enough. The filter parameters would depend on what I clicked on in my dashboard.

Link into Application Insights UI


workgroup and domain should not be on the same network?

Question: "A workgroup and domain should not be on the same network if it is then you have a problem. (Don't tell me any reson why a WG and DM should be on same network I don't care!)"
Why? What are the CONs and PROs?
Comment: What a load of garbage.
Comment: Please help us in building a clean knowledge base. So, don't use the answer box to comment or add details to your question. Thanks!
Comment: Note that forum post is from 2002, and references a Win 2000 domain. Hopefully the vast majority of people are running at least 2003 DCs, ideally with AD and DNS linked, in which case AD is resolved via straight to DNS/DHCP and workgroup just queries the local subnet.
Answer: If a workgroup and a Windows domain have the same name, and are on the same network then you'll have name resolution problems when looking for the domain.
If the names are different there shouldn't be a problem.
Comment: How so? I have a domain and a workgroup at home with the same name and have no problems. I do this so that I can browse all machines from the network. My workgroup doesn't cause problems for my domain and my domain doesn't cause problems for my workgroup.
Comment: Yeaah, I also was in doubt because domain and workgroup names are resolved quite differently and independently
Comment: I know that there used to be master browser issues because the machines in the workgroup could try and take over as the master browser for the domain.  This may have been fixed by name.  With a small domain you may not see the problems if they haven't been fixed by Microsoft.


can we "represent" this finite topology as submodules of $R^X$?

Question: Specific Question Let $X:= \{a,b,c,d\}$ equipped with the topology with base $c,d,abd,abc$ – where out of convenience we identify $x$ with $\{x\}$ and leave out union signs. Is there a ring $R$ containing a field $k$ (preferably $\mathbb R$ or $\mathbb C$, because I think I have a better mental picture of these than for other fields) and an $R$-module structure on $k^{abcd}$ such that the $k^S$, $S\subseteq X$, which are $R$-submodules are precisely the ones where $S$ is closed?
Context I was trying to revisit my knowledge of finite topologies and non-$T_1$ spaces, and found $X$ to be a nice example of a topology which is $T_0$ but for which the specialization preorder is not a lattice.  I then remembered that in representation theory of groups, one often can take a finite structure, like a finite group $G$, andd turn it into an interesting $RG$-Module (via the permutation action). One could do something similar with finite topological spaces: attach a copy of $k$ to each element, and you've got a $k$ vector space. To capture other structure, it is natural to ask whether we can identify the closure operator induced by the topology with something related to this vector space. Of course, acting with e.g. a linear operator $T$ yields a closure operator in terms of invariant subspaces: indeed, these are the submodules of $k^X$ when viewed as a $k[T]$-module in this way. For instance: if our topology was generated by $a,ab,abc$, a corresponding operator would map $a\mapsto b \mapsto c \mapsto d\mapsto 0$, since the invariant closures corresponding to $k^{a,b,c,d}$ are$k^S$ with $S=abcd,bcd,cd,d$, respectively – and these are precisely the closed sets.
My "gut feeling" says that we could try to realize the specialization preorder as some sort of monoid action of $M$ and construct a Ring $M[k]$ out of this – whatever that would be – to just copy the action on $X$ to $k^X$. Unfortunately, my knowledge of "actions" stops when our arrows are not invertible anymore (i.e., we have a preorder instead of (the category-theoretic isomorphism quotient of) a groupoid).
Comment: There is a similar notion '*graph algebra*' defined for any graph over a ring, it might be relevant: https://en.m.wikipedia.org/wiki/Graph_algebra
Comment: Because this question doesn't clearly fit in one category, the tags I've come up with all feel "somewhat accurate but actually not". Feel free to improve them if you have more suitable ideas.
Comment: I apologize for some typos and underwhelming formatting, but typing on mobile is hard. I will revisit typography once equipped with a real keyboard again.
Answer: More generally, let $C$ be any category.  Then you can define a $k$-algebra $k[C]$ which has as a basis the morphisms of $C$, with multiplication given by composition in $C$ or $0$ when the composition is not defined (because the domain and codomain do not match up).  Given a functor $F:C\to \mathtt{Vect}_k$, we then get an action of $k[C]$ on the direct sum $V$ of the values of $F$ on all the objects of $C$, with morphisms of $C$ acting via $F$ on the summand of $V$ corresponding to their domain and acting by $0$ otherwise.
In particular, suppose $F$ is the constant functor with value $k$, so $V=k^{\oplus O}$ where $O$ is the set of objects of $C$.  Then I claim the $k[C]$-submodules of $V$ are exactly the subsets of the form $k^{\oplus S}$ where $S\subseteq O$ has the property that if $s\in S$ and there is a morphism $s\to t$, then $t\in S$.  It is clear that these subsets are submodules.  Conversely, suppose $M$ is a submodule of $V$.  Note that the identity map on an object $o\in O$ acts on $V$ as the projection onto the summand corresponding to $o$.  It follows that if $m\in M$, so are each of its projections, and thus $M=k^{\oplus S}$ where $S$ is the set of $s$ such that $M$ contains an element whose $s$-coordinate is nonzero.  But now any morphism $s\to t$ maps the summand corresponding to $s$ to the summand corresponding to $t$ isomorphically, so if $s\in S$ then $t$ must be in $S$ as well.
In particular, if $C$ is a preorder, this gives a module structure on $k^{\oplus C}$ whose submodules are exactly sets of the form $k^{\oplus S}$ where $S$ is an upper set of $C$.  Taking the specialization preorder of an arbitrary topological space (or its opposite, depending on your conventions), this gives a module structure where the submodules correspond to the specialization-closed sets.  For a finite space, specialization-closed sets are the same as closed sets.


any() function in Python

Question: I am new to Python and was playing with it until I have a problem with any()  function. According to the Python library, the code for it is:
def any(iterable):
    for element in iterable:
        if element:
            return True
    return False

I created a list: list = [-1, 1] and I expected:
print any(list) < 0
print any(x < 0 for x in list)

would print two True's and the two statements are equivalent. But instead Python printed
False
True

Why is the first statement False? How is it different from the second one?
Comment: What made you think `any(list) < 0` would be equivalent to `any(x < 0 for x in list)`?
Comment: You should avoid using `list` as a variable name as that masks the built-in type. I used `lst` in my answer instead, so that I could use the `list()` callable to illustrate what the generator expression produces.
Comment: `any(list) < 0` is not equivalent.` Also avoid using list as a variable name
Answer: any(list) returns a boolean value, based only on the contents of list. Both -1 and 1 are true values (they are not numeric 0), so any() returns True:
>>> lst = [1, -1]
>>> any(lst)
True

Boolean values in Python are a subclass of int, where True == 1 and False == 0, so True is not smaller than 0:
>>> True < 0
False

The statement any(list) is in no way equivalent to any(x < 0 for x in list) here. That expression uses a generator expression to test each element individually against 0, and there is indeed one value smaller than 0 in that list, -1:
>>> (x < 0 for x in lst)
<generator object <genexpr> at 0x1077769d8>
>>> list(x < 0 for x in lst)
[False, True]

so any() returns True as soon as it encounters the second value in the sequence produced.
Note: You should avoid using list as a variable name as that masks the built-in type. I used lst in my answer instead, so that I could use the list() callable to illustrate what the generator expression produces.
Comment: @syj: Python is very straightforward when it comes to function calls; stuff outside the `(..)` doesn't apply to the call.. :-)
Comment: Thank you. Your answer is quite clear. I thought in the first case any() takes <0 before it returns a boolean. Now I feel I asked a very stupid question.
Answer: As stated in the docs, any(list) returns a boolean. You're comparing that boolean to the integer 0:
>>> any(list)
True
>>> True < 0
False

Comment: Thanks a lot. I did not realize it returns a boolean. I was thinking it evaluates the condition list[element] < 0 for all elements in list.

any() function in Python


Twoway binding in wasm

Question: I'm testing the Uno platform and wasm.
I test a simple databinding where I have a username in a textbox after login ainst a webapi I update the property of the username to test the update of the gui from a binded property in the viewmodel.
xaml.

in the login button
        var result = await webApiClient.LoginUser(ViewModel.LoginModel);
        ViewModel.LoginModel.Email = result.Model.Name;

If I run the app under UWP it works, under wasm the text box don't update.
<Page
x:Class="DeviceExchange.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DeviceExchange"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ios="http://nventive.com/ios"
xmlns:wasm="http://nventive.com/wasm"
mc:Ignorable="d ios wasm">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
        <TextBlock Grid.Row="1" Grid.Column="1" Text="Device Exchange
 Portal" Margin="20" FontSize="30" />
     <TextBlock Grid.Row="2" Grid.Column="1" Text="username" Margin="3"
 FontSize="15" />
     <TextBox Grid.Row="3" Grid.Column="1" Text="{x:Bind LoginModel.Email,
 Mode=TwoWay}" Background="White" />
     <TextBlock Grid.Row="4" Grid.Column="1" Text="username" Margin="3"
 FontSize="15" />
     <PasswordBox Grid.Row="5" Grid.Column="1" Password="{x:Bind
LoginModel.Password, Mode=TwoWay}" Background="White"/>
     <Button Margin="0,5" Click="LoginButton_Click"
VerticalAlignment="Center" HorizontalAlignment="Stretch" Grid.Row="6"
Grid.Column="1" x:Name="LoginButton" Content="Login" />
 </Grid>
 </Page>

Comment: Could you share the xaml code?
Comment: Have you validated that the API call works? If you add `Console.WriteLine(result.Model.Name)`, what do you see in the browser console?
Comment: Hi my console show this.mono_wasm_runtime_ready
mono.js:1 fail: Windows.UI.Xaml.UIElement[0]
mono.js:1       The member event PointerEventHandler UIElement.PointerWheelChanged is not implemented in Uno.
mono.js:1 fail: Uno.UI.DataBinding.BindingPropertyHelper[0]
mono.js:1       The [ScrollViewer] property getter does not exist on type [Windows.UI.Xaml.Controls.TextBox]
mono.js:1 The Bindable attribute is missing and the type [Windows.UI.Xaml.UnsetValue] is not known by the MetadataProvider.
 .....
Comment: Could you please report this with a simple reproduction app on GitHub? https://github.com/unoplatform/uno
Answer: {x:Bind Mode=TwoWay} is not supported right now on Uno.
https://github.com/unoplatform/uno/issues/2587
You can, instead, write it this way as a work-around:
Text="{Binding LoginModel.Email, Mode=TwoWay, RelativeSource={RelativeSource Self}}"

Twoway binding in wasm


Solutions to the heat equation with a ring of coolant

Question: I'm interested in solutions to the heat equation for the following problem
$ \dfrac{\partial u}{\partial t} = c^2 \nabla^2 u $
on $ \left\{ (x,y)           \vert x^2+y^2 \leq R^2 \right\}  $
such that
$ D = \left\{ (x,y)            \vert x^2+y^2 = r^2  \right\}$
$ u(t,x,y) = h$ if $ (x,y) \in D$
and $ u(0,x,y) = H$ if $(x,y) \not\in D$
and $\dfrac{\partial u}{ \partial \hat{n}} = 0$
If I have written this correctly, this is a PDE on an insulated disk on radius $ R $ with a ring of radius $ r $ on the interior held at a constant temperature of $ h $.
My main question is: Are there analytic methods of solving problems of this form, or are numerical solutions required. I've searched my undergrad PDE texts, but all the problems studied a PDE with a point source of heat/cold.
This is a problem of personal interest, not homework or research. References are appreciated.
Comment: Is $H$ constant?
Comment: Since there is no flux across the boundary $x^2+y^2=r^2$, I imagine that you can solve two separate problems:  one is for the annulus $r^2 \leq x^2+y^2 \leq R^2$ and the other for the disc $0<x^2+y^2 \leq r^2$.  Separation of variables might be a good method to use since you have simple geometries.  Since your domain is 2D, your solution should be logarithmic with respect to the distance from the origin.
Comment: There is something off about the second boundary condition for $H$. Not being in $D$ implies that that temperature is held on $\mathbb{R}^2 - D$ I think he meant to write a different formulation if the domain of interest is only on the disk.
Answer: First convert to polar coordinates $(x,y,t) \to (\rho,\phi,t) $. The equation becomes
$$ \frac{1}{c^2}u_t = u_{\rho\rho} + \frac{1}{\rho}u_{\rho} + \frac{1}{\rho^2}u_{\phi\phi} $$
Observe that $u = h$ is a steady-state solution satisfying the two boundary conditions, so we can write $u = h + v$, where $v$ also satisfies the heat equation but is homogeneous on the boundary
$$ \begin{align} v(r,\phi,t) &= 0 \\ v_\rho(R,\phi, t) &= 0 \\ v(\rho,\phi,0) &= H(\rho,\phi) - h \equiv f(\rho,\phi) \end{align} $$
Now use separation of variables. Let $v(\rho,\phi,t) = P(\rho)\Phi(\phi)T(t)$, then
$$ \frac{P''}{P} + \frac{P'}{\rho P} + \frac{\Phi''}{\rho^2 \Phi} = \frac{T'}{c^2 T} = -\lambda^2 $$
which gives $T(t) = e^{-c^2\lambda^2t}$. Next, separate again
$$ \frac{\rho^2P''}{P} + \frac{\rho P'}{P} + \lambda^2 \rho^2 = -\frac{\Phi''}{\Phi} = n^2 $$
Here, $n$ must be an integer to satisfy the periodicity condition $\Phi(\phi + 2\pi) = \Phi(\phi)$. Hence, $\Phi(\phi) = D\cos(n\phi) + E\sin(n\phi)$

For the radial function
$$ \rho^2 P'' + \rho P' + (\lambda^2\rho^2 - n^2)P = 0 $$
The substitution $z=\lambda\rho$ leads to the Bessel equation, thus we can write
$$ P(\rho) = A J_n(\lambda \rho) + B Y_n(\lambda \rho) $$
As stated in the comments, you have two separate problems due to the boundary condition at $\rho = r$. The solution on the smaller disk $\rho \in (0,r)$ is finite at the origin, so $B=0$ and
$$ P_{n,m}(\rho) = J_n(\lambda_{n,m} \rho) $$
where the eigenvalue $\lambda_{n,m}$ is such that $P(r) = J_n(\lambda_{n,m} r) = 0$. Here $m$ refer to the order of the zeroes of $J_n$, which can be found numerically.

The solution on the annulus $\rho \in (r,R)$ has different eigenvalues, so I'll call it $\mu$ to avoid confusion. The radial function needs to satisfy $P(r) = P'(R) = 0$ therefore
\begin{align}
A J_n(\mu r) + B Y_n(\mu r) &= 0 \\
A J_n'(\mu R) + B Y_n'(\mu R) &= 0
\end{align}
Eliminating either $A$ or $B$ leads to
$$ J_n(\mu r) Y_n'(\mu R) - Y_n(\mu r)J_n'(\mu R) = 0 $$
This is equation for $\mu$ that can be solved numerically. Once again, there are infinitely many solutions, so $\mu = \mu_{n,m}$. The derivatives of the Bessel function are given by the recurrence relations:
\begin{cases} J_0'(x) = -J_1(x) \\ J_n'(x) = \dfrac{J_{n-1}(x) - J_{n+1}(x)}{2} \end{cases}
Then the radial function is
$$ P_{n,m}(\rho) = Y_n(\mu_{n,m} r) J_n(\mu_{n,m} \rho) - J_n(\mu_{n,m} r) Y_n (\mu_{n,m} \rho) $$

We can assemble the general solution
$$ v(\rho,\phi,t) = \sum_{n=0}^\infty\sum_{m=0}^\infty P_{n,m}(\rho) \big[D_{n,m} \cos(n\phi) + E_{n,m}\sin(n\phi)\big]e^{-c^2\lambda_{n,m}^2 t} $$
Note that the function is piece-wise with different eigenvalues.
Matching the initial condition gives
$$ u(\rho,\phi,0) = f(\rho,\phi) = \sum_{n=0}^\infty\sum_{m=0}^\infty P_{n,m}(\rho) \big[D_{n,m} \cos(n\phi) + E_{n,m}\sin(n\phi)\big] $$
You can use orthogonality to find the constants. For example
$$ D_{n,m} = \dfrac{\displaystyle \int_0^{2\pi}\int_0^r f(\rho,\phi) J_n(\lambda_{n,m} \rho) \cos(n\phi) \ \rho\ d\rho\ d\phi}{\displaystyle \int_0^r \rho J_n^2(\lambda_{n,m}\rho)\ d\rho \int_0^{2\pi} \cos^2 (n\phi)\ d\phi} $$
Comment: Incredible answer, thank you.


Confused about Intel Optane DC SSD usage as extra RAM with IMDT?

Question: I'm a little confused about Intel Optane DC.
I want that my Optane DC will be able to perform as DRAM and storage both.
On the one hand, I understood that only "Intel Optane DC Persistent Memory DIMM" is able to perform as DRAM.That it because he has 2 modes (Memory mode and App-Direct Mode).
On the other hand, in this link: https://www.intel.com/content/www/us/en/products/docs/memory-storage/solid-state-drives/optane-ssd-dc-p4800x-mdt-brief.html
I read that "Together, DRAM and Intel® Optane™ SSDs with Intel® Memory Drive Technology emulate a single volatile memory pool".
I'm confused, is Intel Optane DC SSD is able to perform as DRAM or only Intel persistent Memory DIMM?
Answer: Yes you can use a P4800x with Intel's IMDT (Intel Memory Drive Technology) software to give the illusion of more RAM by using the Optane DC SSD as swap space.  This is what you want.  IMDT sets up a hypervisor that gives the OS the illusion of DRAM + SSD as physical memory, instead of just letting the OS use it as swap space normally.
Apparently this works well when you already have enough physical RAM for most of your working set, and IMDT has smart prefetching algorithms that try to page in ahead of when a page will be needed.
One advantage to running the OS under the IMDT hypervisor instead of just using the SSD as swap space is that it will get the OS to use some of that extra space for pagecache (aka disk caching), instead of needing special code to use (some of) an SSD as cache for a slower disk.

But no, it's not Optane DC Persistent Memory, that's something else.
See also a SuperUser answer for more about Optane vs. Optane DC PM.  And Hadi Brais added some nice sections to it about IMDT for Optane SSDs.
P4800x is connected over PCI-express (as you can see in pictures on https://www.anandtech.com/show/11930/intel-optane-ssd-dc-p4800x-750gb-handson-review) for example.  So it's not an NV-DIMM; you can't stick it in a DIMM socket and have the CPU access it over the memory bus.  The form-factor isn't DIMM.
As far as hardware, there are 3 things with the Optane brand name:

Consumer grade "Optane" SSDs.  Just a fast PCIe NVMe using 3D XPoint memory instead of NAND flash.

Enterprise "Optane DC" SSDs.  Just a fast PCIe NVMe using 3D XPoint memory.  Not fundamentally different from the consumer stuff, just faster and higher power-consumption.  P4800x is this.
The "expand your RAM" functionality here is pure software, fairly similar (and possibly worse) than just creating a swap partition on it and letting the OS handle paging to it.  Especially if you weren't using virtualization already.

Enterprise "Optane DC Persistent Memory" (PM for short).  3D XPoint memory that's truly mapped (by hardware) into physical address space for access with ordinary load/store instruction, without going through a driver for each read/write.  e.g. Linux mmap(MAP_SYNC) and using clflush or clwb asm instructions in user-space to commit data to persistent storage.
PM is still slower than DRAM, though, so if you just want volatile memory you might still use it as swap space like IMDT.  One key use-case for DC PM is giving databases the ability to commit to persistent storage without going through the OS.  This allows out-of-order execution around I/O, as well as much lower overhead.

See articles like https://www.techspot.com/news/79483-intel-announces-optane-dc-persistent-memory-dimms.html which put Optane DC Persistent Memory above Optane DC in the classic pyramid storage hierarchy.
AFAIK, Optane DC PM devices only exist in a DIMM form-factor, not PCIe (and uses something like DDR4 signalling).  This requires special support from the CPU because modern CPUs integrate the memory controller.
In theory you could have a PCIe device that exposed some persistent storage in a PCIe memory region.  Those are part of physical address space and can be configured as write-back cacheable.  (Or can they?  Mapping MMIO region write-back does not work)  So they could be memory-mapped into userland virtual address space.  But I don't think any PCIe Optane DC Persistent Memory devices exist, probably because PCIe command latency is (much) higher than over the DDR4 bus.  Bandwidth is also lower.  So it makes sense to use it as fast swap space (copying in a whole page), not as write-back cacheable physical memory where you could have cache misses waiting a very long time.
(Margaret Bloom also comments re: block size of writes maybe being a problem.)
i.e. you don't want a "hot" part of your working set on memory that the CPU accesses over the PCIe bus.  You probably don't even want that for Optane DC PM.

Optane / 3D XPoint is always persistent storage; it' up to software whether you take advantage of that or just use it as slower volatile RAM.
It's not literally DRAM, that has a specific technical meaning (dynamic = data stored in tiny capacitors that need refreshing frequently).  3D XPoint isn't dynamic, and isn't even volatile.  But you can use it as equivalent because 3D XPoint memory has very good write endurance (it doesn't wear out like NAND flash).  If people talk about using Optane as more DRAM, they're using the term to just mean volatile RAM, filling the same role that DRAM traditionally fills.
Comment: I think the OP is interested in the Optane DC PM, but when they looked it up, P4800x turned up in the search results, which is an SSD, not PM, resulting in the confusion. The terms "Optane DC PM", "Apache Pass", and "3D XPoint" are not synonyms. Optane DC PM is a brand for DIMM-compatible persistent memory modules. Apache Pass is a particular design, representing the first generation of Optane DC PM. This is similar to the Intel Core brand vs. microarchitecture. 3D XPoint is the memory technology used in the Optane DC PM and SSD products.
Comment: I've made an edit to your SuperUser answer to add more information.
Comment: @YoniGoikhman Yes, Intel Optane DC Persistent Memory can do that. you're just confusing two very different things: Optane DC PM and Optane DC SSD are different products with different purposes. Also you're question is not clear. First you said "I don't care about the speed" then you're asking whether the main difference between SSD and DIMM is speed. Anway, SSDs will not appear as RAM to the OS or any app unless you're using IMDT, discussed in the linked answer.
Comment: Agreed. I think IMDT can be completely implemented in the OS. This would even eliminate the requirement for and the overhead of virtualization. Also IMDT [appears](https://www.intel.com/content/dam/support/us/en/documents/memory-and-storage/intel-mdt-setup-guide.pdf) to require a non-trivial amount of setup, which can possibly be minimized had it been implemented in the OS.
Comment: @HadiBrais: updated this answer significantly, removing my wrong guess about PCIe memory regions.  On further thought, IMDT would have the advantage of getting the OS to use more pagecache, i.e. using the Optane SSD to cache the main storage.  OSes won't normally do that with a swap partition / pagefile.  Not sure how relevant that is for enterprise workloads, especially when it has to be accessed by paging into DRAM and then reading from there.
Comment: That may be possible (see the links [here](https://stackoverflow.com/questions/53311131/mapping-mmio-region-write-back-does-not-work)). But I think the I/O device itself has to be designed to handle fine-grained accesses (such as 64-byte granularity). This is usually supported for device commands sent from the driver to transfer blocks of data, but not for direct data accesses. Otherwise, the only alternative is emulation like IMDT.
Comment: Future generations of Optane DC PM and SSD were disclosed by Intel in [these](https://newsroom.intel.com/wp-content/uploads/sites/11/2019/09/Intel-2019_MemoryStorageDay_KristieMann_final.pdf) slides.
Comment: @HadiBrais: So none of their PCIe devices are HW memory-mappable?  It's just fast NVMe swap space + some software to fool the OS?  Only the "PM" stuff truly puts the storage in physical address space?  (And BTW, in my answer I did try to use 3D XPoint when talking specifically about the tech used for the memory cells, not just the products built out of them.  But I was fooled by DC vs. DC Persistent Memory.)
Comment: Right, the Optane SSDs are not accessed through memory-mapped I/O (but the files can certainly be memory-mapped, similar to HDD files). In contrast, Optane PC can be accessed like DRAM memory using load and store uops. I think the answer you linked to already says that. The answer there just incorrectly says that "Optane DC PM" and "Apache Pass" are synonyms.
Comment: @HadiBrais: Ah, thanks for that correction for my SuperUser answer, will update.  So there are no PCIe "Optane DC PM" devices that expose PCIe physical memory space, only NVMe?  Anyway, `mmap` of block devices into virtual address space is irrelevant and a red herring in this context.  As you know, mmaping a file (without `MAP_SYNC`) just copies to RAM and fakes it with software (page faults and page-table dirty bit).  The interesting part is mapping storage into *physical* address space, allowing persistent commit without OS interaction.
Comment: Got myself a little bit confused. I don't care about the speed, I just need the ability to perform as RAM. Will the SSD be able to do that? If so, the main difference between the SSD and DIMM is the speed and form factor? The main thing that concerns me is the ability of the system (Using SPDK) to see it as RAM, even if this is using software tricks and not being true DRAM. This article: https://arstechnica.com/gadgets/2018/05/intel-finally-announces-ddr4-memory-made-from-persistent-3d-xpoint/ presents the ability of using it as DRAM as something special. What am I missing?
Comment: @HadiBrais: Thanks for the edit on SU.  Reviewers rejected it but I was still able to approve it manually after the fact.
Comment: @HadiBrais Thank you, I think that IMDT is what I was looking for. I need it to perform as storage device and DRAM as well. From what I understand, if combining the SSD and IMDT, the SSD will be able to perform as RAM? I don't need the full speed of RAM, just his abilities and functionality when needed.
Comment: @YoniGoikhman: yes, IMDT is apparently a hypervisor that uses the SSD as swap space to create a VM that looks like it has lots of RAM.  IDK why that's better than letting the OS do it; maybe Intel figures they have better algorithms, and/or it's outside of any VMs vs. having OSes inside VMs do paging.
Comment: I think because Intel doesn't want to make IMDT open-source and they intend to only support their SSDs to promote them. @YoniGoikhman If this answers your question, consider upvoting and accepting the answer. Otherwise, clarify your question by editing it.
Comment: @HadiBrais: Good point about open-source and restricting it to their own SSDs.  But what does IMDT do that OSes don't already do for themselves with swap partitions?  Just custom prefetch / replacement algorithms?  i.e. I'm saying IMDT doesn't need to exist at all, except for the marketing point of claiming it works like RAM.  (Or IDK if hypervisors like Xen can do paging of VMs.  Sharing the whole SSD dynamically in the hypervisor is better than giving each VM a swap partition)
Comment: As far as I understand it, there exist devices that expose themselves as a MMIO persistent range, but not for "free". This is called the BLK (block) mode in the NVDIMM and ACPI specifications. I'm not sure but I suspect that single word write is still not possible with PM (especially if it's huge) so an intermediate buffer and some coordination is needed. The Optane DC PM has all onboard and don't need any coordination from the SW (though the DDR-T interface used by the HW is not documented and may do some coordination?) but other devices have explicit apertures where to map data and commands.
Comment: @MargaretBloom: If your MMIO persistent storage is mapped write-back cacheable, you'd be committing 64-byte lines with `clflushopt` or `clwb`.  I think this is the expected mode of use, although since you mention it I guess uncacheable, WC, or even WT could be options.  I think 3D XPoint is internally byte-addressable, but IDK about the bus command protocol.  What I was wondering about in my answer was whether there are any (Intel) devices that expose an MMIO persistent range *over PCIe*, rather than over DDR-T.  Thanks for the extra details on how actual NV-DIMMs are specced, though.
Comment: I was thinking more on the side of 1-4KiB for the PM "pages" if they share anything with the usual NV devices (i.e. flash ROMs). I've not digged into PM yet, just making hypothesis. I don't really know how block (as per spec) devices work :) One day I'll take a better look at the spec and hopefully a datasheet.
Comment: @MargaretBloom: My understanding is that 3D XPoint truly can be read/written with fine granularity, totally unlike flash's large write / erase blocks.  Along with high write endurance (that might make a wear-leveling / remapping layer unnecessary?) and high performance, that is a key part of what makes it usable as memory-mapped NV storage.  https://pcper.com/2017/06/how-3d-xpoint-phase-change-memory-works/ says "single bit overwrites are possible without disturbing adjacent cells."  It literally doesn't have to be erased before write.
Comment: @PeterCordes That's seems the case indeed. Very cool link, thank you!


Finding eigen values

Question: Consider the matrix
$$
    \begin{matrix}
    -1 & 3 & 5 \\
    -3 & -1 & 6 \\
    0 & 0 & 3\\
    \end{matrix}
$$
I know that the Eigen values are 3, -1+3i, -1-3i and I got the answer by solving the characteristic equation.
My confusion is, why don't I get this answer by just transforming this matrix to an upper triangular form in which case the Eigen values are its diagonal elements. On doing so, the diagonal elements that I got were -1,-10 and 3 (R2-3*R1).
I know that the sum of the eigens should be equal to trace (=3), which is not in this case. But isn't it true that the diagonals of a triangular matrix form it's Eigen values? What am I missing here?
Comment: It depends on what you mean by "transform". Some transformations preserve eigenvalues, some don't. What did you have in mind? Elementary row operations generally don't, I'm sure you can come up with a simple $2\times2$ example where you can see that.
Answer: That is not true as you just illustrated.
I think you are confused with the result that if $$A = PTP^*$$ then the eigenvalues of $A$ and $T$ are the same.
If $A = BT$ where $B$ is nonsingular, we can't conclude that eigenvalues of $A$ and $T$ are the same.

Finding eigen values


Drupal commerce and multiple products sharing SKU

Question: I have a commerce shop, and a question about product "sharing" SKU.
I have products which is sold as single products, but also in a box.
Lets say I have "Product A" with price $ 1 , with SKU 00001.
I have a box with 10 x "product A" which on the website should appear as "Product A box" and price $ 9. (I need it to be the same product, but shown as separate "product"
I need it because, if I have two separate products, then I can't be sure I have the correct amount in stock.
Is that even possible ?
Comment: Did you tried my answer?
Answer: You can handle that with Commerce Product Bundle. Some details about it, from its project page:

This module extends Drupal Commerce by allowing the site admin to
  collect a number of existing products together in a bundle, and offer
  them at a new bundle price, with a new bundle SKU.
You can define products that consists of other products. They are all
  combined in one add to cart form which works like the core add to cart
  form. The bundle is then represented by one order line item. This
  allows the maximum compatibility with other modules such as shipping
  or payment modules.

As an alternative, there is also Commerce Bundle. Some details about it, from its project page:

Implements product bundles for Drupal Commerce. For example, you want
  to offer products A, B, and C for a lower cost if purchased together
  rather than standalone. Notable features include setting the prices at
  the bundle group or product level, and product attribute support.

Note: if you wonder how those to modules compare to each other, then this might help (= quote from the Commerce Product Bundle project page):

Commerce Bundle also allows creating product bundles. Customers add a bundle to their cart, but the component products show in checkout and order history. It therefore doesn't allow assigning an overall price to the bundle (but it has some neat ways to assign prices to component products). With Commerce Product Bundle, the bundle, not the component products, show in checkout and order history. Therefore an overall price can be assigned to the bundle


How do I edit a cell in visual studio code interactive window

Question: In vscode you can use "Jupyter: Create interactive window" to create an interactive window that resembles jupyter notebook. However, in the interactive window I am unable to do a couple of things that I enjoy from jupyter notebook, such as editing a cell or moving the cells around. Is there any way to do these things inside an interactive window, without having to create an .ipynb file?
Answer: Not a direct answer but: for editing you can use <code># %%</code> to create 'cells' directly in the script you are working on. Then you can run the cells in the interactive window, this allows you to edit and re run. Explained in detail in the Jupyter code cells section from the Python Interactive Window Tutorial.
example from the Tutorial


SQL Server Database Connection Errors

Question: We're trying to, essentially, connect a database to a hall/worker management program custom built in Java. This is a multiple-module project and our database team decided to use SQL Server as base for their management.
Unfortunately, this proved problematic resulting in a deluge of errors that we're entirely not sure how to fix. After searching through the Stack, similar problems arose but were either not solved and simply 'started working' on their own or 'fixed' by moving away from SQL Server, which we can't do either.
Without further ado, here's the problem itself. The program operates on all data properly, as it was debugged in a 'testmode' wherein values are fed directly into the code without the use of an external database. The real problem arose when trying to put the two and two together.
Firstly, the connection ports for localhost proved problematic. Using port 1433 we failed to even establish a connection, and even unlocking the port changed nothing. After moving to 1434, we managed to establish a connection of sorts.
Here's the error-block regarding port 1433, if it's necessary:
The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:241)
at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2243)
at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:491)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1309)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.j256.ormlite.jdbc.JdbcConnectionSource.makeConnection(JdbcConnectionSource.java:252)
at com.j256.ormlite.jdbc.JdbcConnectionSource.getReadWriteConnection(JdbcConnectionSource.java:184)
at com.j256.ormlite.jdbc.JdbcConnectionSource.getReadOnlyConnection(JdbcConnectionSource.java:170)
at com.j256.ormlite.stmt.StatementExecutor.buildIterator(StatementExecutor.java:243)
at com.j256.ormlite.stmt.StatementExecutor.query(StatementExecutor.java:197)
at com.j256.ormlite.stmt.StatementExecutor.queryForAll(StatementExecutor.java:118)
at com.j256.ormlite.dao.BaseDaoImpl.queryForAll(BaseDaoImpl.java:239)
at controler.AdminRoomControler.getListRoomEquipmentData(AdminRoomControler.java:51)
at gui.panel.ReservationRoomPanel.reloadData(ReservationRoomPanel.java:57)
at gui.panel.ReservationRoomPanel.initialize(ReservationRoomPanel.java:82)
at gui.panel.ReservationRoomPanel.<init>(ReservationRoomPanel.java:40)
at gui.frame.ApplicationFrame.initialize(ApplicationFrame.java:58)
at gui.frame.ApplicationFrame.<init>(ApplicationFrame.java:37)
at main.Program$1.run(Program.java:22)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Upon changing the port to 1434, we were greeted with another problem. For some reason, SQL Server responds to our connection with a Prelogin Handshake problem we have absolutely no idea how to fix. The errors are as follows:
sty 11, 2014 5:32:02 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 0a8f83b1-ce25-48c1-8796-c2c5c7d080b7 Prelogin error: host localhost port 1434 Error reading prelogin response: Software caused connection abort: recv failed ClientConnectionId:0a8f83b1-ce25-48c1-8796-c2c5c7d080b7
sty 11, 2014 5:32:02 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 982a07f7-0cbd-417f-8bcb-47eebe6b4524 Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:982a07f7-0cbd-417f-8bcb-47eebe6b4524
sty 11, 2014 5:32:02 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 9c136851-d172-4b98-8722-16941642d14a Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:9c136851-d172-4b98-8722-16941642d14a
sty 11, 2014 5:32:03 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: bc3db9f2-6d56-43bd-9145-051dc418d8b9 Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:bc3db9f2-6d56-43bd-9145-051dc418d8b9
sty 11, 2014 5:32:04 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 93c0fd9c-925d-40d9-af4e-35be3f3ec0d4 Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:93c0fd9c-925d-40d9-af4e-35be3f3ec0d4
sty 11, 2014 5:32:05 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: cb32d339-0c63-4549-8821-61b2818c9548 Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:cb32d339-0c63-4549-8821-61b2818c9548
sty 11, 2014 5:32:06 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 5c63f908-8019-48ac-9b4e-0b9a4c29e6e6 Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:5c63f908-8019-48ac-9b4e-0b9a4c29e6e6
sty 11, 2014 5:32:07 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: ce8945a8-1fe7-40b8-a7c9-331f263be084 Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:ce8945a8-1fe7-40b8-a7c9-331f263be084
sty 11, 2014 5:32:08 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: a0ed799f-471e-4496-8fb5-6f2599faa45f Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:a0ed799f-471e-4496-8fb5-6f2599faa45f
sty 11, 2014 5:32:09 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: f35803a2-7e46-4163-a9db-08977c78fd63 Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:f35803a2-7e46-4163-a9db-08977c78fd63
sty 11, 2014 5:32:10 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 182e2bf0-9ad6-40e6-b767-ab6bf7173929 Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:182e2bf0-9ad6-40e6-b767-ab6bf7173929
sty 11, 2014 5:32:11 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 7d71a9ec-c22b-4247-8bd2-540e75470e80 Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:7d71a9ec-c22b-4247-8bd2-540e75470e80
sty 11, 2014 5:32:12 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 9a739139-241f-47c4-bfe8-bb3a1cbe3c18 Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:9a739139-241f-47c4-bfe8-bb3a1cbe3c18
sty 11, 2014 5:32:13 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: d53915f6-5419-4bd0-883f-5c25a12d5678 Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:d53915f6-5419-4bd0-883f-5c25a12d5678
sty 11, 2014 5:32:14 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 8eaec619-d01a-4138-bb06-44cdc8a08fe9 Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:8eaec619-d01a-4138-bb06-44cdc8a08fe9
sty 11, 2014 5:32:15 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 4c176172-9ff5-479a-b39a-40e026da9e16 Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:4c176172-9ff5-479a-b39a-40e026da9e16
sty 11, 2014 5:32:16 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 6b9ab775-5845-4b11-ad25-9cef7b56f041 Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:6b9ab775-5845-4b11-ad25-9cef7b56f041
sty 11, 2014 5:32:17 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 04ef0517-4410-4d63-947c-d349ed4684ad Prelogin error: host localhost port 1434 Error reading prelogin response: Connection reset ClientConnectionId:04ef0517-4410-4d63-947c-d349ed4684ad
com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset ClientConnectionId:04ef0517-4410-4d63-947c-d349ed4684ad
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1667)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1654)
    at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1789)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.Prelogin(SQLServerConnection.java:1424)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1319)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at com.j256.ormlite.jdbc.JdbcConnectionSource.makeConnection(JdbcConnectionSource.java:252)
    at com.j256.ormlite.jdbc.JdbcConnectionSource.getReadWriteConnection(JdbcConnectionSource.java:184)
    at com.j256.ormlite.jdbc.JdbcConnectionSource.getReadOnlyConnection(JdbcConnectionSource.java:170)
    at com.j256.ormlite.stmt.StatementExecutor.buildIterator(StatementExecutor.java:243)
    at com.j256.ormlite.stmt.StatementExecutor.query(StatementExecutor.java:197)
    at com.j256.ormlite.stmt.StatementExecutor.queryForAll(StatementExecutor.java:118)
    at com.j256.ormlite.dao.BaseDaoImpl.queryForAll(BaseDaoImpl.java:239)
    at controler.AdminRoomControler.getListRoomEquipmentData(AdminRoomControler.java:51)
    at gui.panel.ReservationRoomPanel.reloadData(ReservationRoomPanel.java:57)
    at gui.panel.ReservationRoomPanel.initialize(ReservationRoomPanel.java:82)
    at gui.panel.ReservationRoomPanel.<init>(ReservationRoomPanel.java:40)
    at gui.frame.ApplicationFrame.initialize(ApplicationFrame.java:58)
    at gui.frame.ApplicationFrame.<init>(ApplicationFrame.java:37)
    at main.Program$1.run(Program.java:22)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

Finally, we've encountered a typographic problem where the name of column in the file and in the database was mismatched. Correcting that, unfortunately, caused even more error to appear. To add insult to injury, sometimes it does not even detect the mismatch error, so we're completely at loss here.
Here's our code used to hook the database up:
package database;

import java.sql.SQLException;

import POJO.Administrator;
import POJO.Equipment;
import POJO.Event;
import POJO.Guest;
import POJO.Personnel;
import POJO.Room;

import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.dao.DaoManager;
import com.j256.ormlite.jdbc.JdbcConnectionSource;
import com.j256.ormlite.support.ConnectionSource;

public class DbManager  {

    // Proper db address should be placed here.
    private final String DATABASE_URL = "jdbc:sqlserver://localhost:1434;databaseName=IO;integratedSecurity=true;";

    private ConnectionSource connectionSource;

    public Dao<Administrator,Integer> administratorDao;
    public Dao<Equipment,Integer> equipmentDao;
    public Dao<Event,Integer> eventDao;
    public Dao<Guest,Integer> guestDao;
    public Dao<Personnel,Integer> personnelDao;
    public Dao<Room,Integer> roomDao;

    public DbManager() throws SQLException
    {
        connectionSource = new JdbcConnectionSource(DATABASE_URL);
        administratorDao = DaoManager.createDao(connectionSource, Administrator.class);
        equipmentDao = DaoManager.createDao(connectionSource, Equipment.class);
        eventDao = DaoManager.createDao(connectionSource, Event.class);
        guestDao = DaoManager.createDao(connectionSource, Guest.class);
        personnelDao = DaoManager.createDao(connectionSource, Personnel.class);
        roomDao = DaoManager.createDao(connectionSource, Room.class);
    }

    @Override
    protected void finalize() throws Throwable
    {
        connectionSource.close();
        super.finalize();

    }
}

We are completely out of ideas and really, anything that doesn't concern either completely rewriting the database from SQL Server to something else will be of aid. Thank you in advance!
Comment: Please tell us the actual Microsoft SQL Server version (2012, 2008, 2005, ...) and edition (Express Edition, Standard Edition, ...) that you are trying to use.
Comment: Of course! We're using Microsoft SQL Server 2012 Developer with Service Pack 1.
Comment: To verify the port that SQL Server is listening on, see the instructions [here](http://stackoverflow.com/a/12297597/2144390). This document might also prove helpful: [How to configure SQL Server to listen on a specific port](http://support.microsoft.com/kb/823938).
Answer: SQL Server Browser uses port 1434.  Verify that TCP/IP is enabled on SQL Server and try the default port again (1433).
See this post.
Comment: It was the TCP/IP. Thank you so much for this, it works now! Ah, the simplest things always escape you.
Comment: You're welcome!  Four eyes are always better than two.

SQL Server Database Connection Errors


Android AlertDialog can't rotate

Question: I have an activity and it creates and shows dialog in onCreate.
The dialog is made by AlertDialog.Builder.
It shows properly except when I rotate the screen, the dialog does not rotate....
How to solve it, thx?
Manifest
<activity android:excludeFromRecents="true" android:name="com.xxx.yyy" android:process=":core" android:theme="@android:style/Theme.Translucent.NoTitleBar"> </activity>

Activity
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        dialog = builder.create();
        dialog.show();

}
Answer: I've recently read a similar problem posted by another user. The problem was solved. Maybe it fits to your problem, too. Look here Android: Dialog etc restore after rotation changed

Android AlertDialog can't rotate


Variadic Functions - Is there an argument limit?

Question: An interesting question came up that I've done a bit of research on but cannot find a conclusive answer.  I also have a suspicion as to the answer but I thought the SO crowd might actually know.
Is there actually a limit to the number of arguments passed to a variadic function?
All of the documentation that I can find is completely silent on this point.  There are minimum numbers for supported arguments in the various C standards, but no maximum listed.  I have already tested code with north of 60,000 arguments with no trouble at all.
My Hypothesis
I suspect that this is actually architecture dependent and would effectively be limited by the maximum stack size.
Edit
I may have sent people haring off in the wrong direction.  My focus is not on the minimum but on whether or not they are aware of any actual maximum, whether that is based on a standard, compiler implementation or architecture.
Comment: Why would the C standard define a maximum?
Comment: The C standard does not require more than 127 arguments to be supported for any function call (C2011 126.96.36.199).  Conforming implementations may support more, and it may be easier for them to do so with a variadic function, but for maximum portability you should not use more than 127.
Comment: @JohnBollinger: Limiting yourself to 127 arguments doesn't really help portability. A conforming compiler needn't support 127 arguments for *all* function calls, only for one call in one specific program -- and that call needn't be to a variadic function.
Comment: I've amended to refocus the question.  It's not really about a minimum.  It's about a maximum.
Comment: @KeithThompson While the standard allows that just one call could use the full 127 arguments, it would be incredibly perverse for an implementation to be so specific in its limits.
Answer: No such limit is imposed by the C standard.
The C standard does require any conforming implementation to support some program that passes at least 127 arguments in a function call (see N1570 section 184.108.40.206), but that's neither an upper nor a lower bound for variadic functions; the call needn't be to a variadic function, and implementations are free to support more than 127 arguments. The section that defines <stdarg.h>, 7.16, doesn't mention any limits.
In practice, any limit is likely to be imposed by available resources, either at compile time (when compiling the call) or at run time (when executing it).
And simply due to common sense and market forces, compilers are likely to support arbitrarily long argument lists rather than imposing some fixed limit. Once you're required to support 127 arguments, it's probably easier to allocate any needed data structures dynamically than to use fixed-size structures. (The point of the translation limits in 220.127.116.11 is, in my opinion, to encourage compilers not to impose fixed limits at all.)
On the other hand, a conforming compiler could impose an unreasonable small limit, and a compiler for a very small embedded system might even have a valid reason to do so.
Comment: The unreasonably low number of arguments, I suspect, is why the C standard sets the minimum at 127.  Your answer, otherwise, seems to agree with my suspicions.
Comment: Many architectures impose limits on stack frame sizes, and arguments are usually passed on the stack.


Print element title in email

Question: Given the following element in my webform, how do I print Name: Fred in my email?
<code>Title   Key   Value
Name    name  Fred
</code>
I understand how to print the raw value. How do I print the title?
<code>[?]: [webform_submission:values:name:raw]
</code>
An admin may change the element's title, so I can't have Name: [webform_submission:values:name:raw].
Answer: Accessing a webform's element properties including #title, #description via tokens is not currently supported. I am not sure the core Webform module should provide these tokens, but a third-party module can easily make these tokens available.
Comment: Yes, for Drupal 8.
Answer: You can now use a Twig template. I have an if statement so that the label and colon are omitted if the element is left empty.
<code>{% if data.name %}
  {{ elements.name['#title'] }}: {{ data.name }}
{% endif %}
</code>

Print element title in email


Sonar-scanner failed after execute project builders on Azure DevOps pipeline

Question: Context: I have a pipeline on Azure DevOps running on a self-hosted agent (deployed on kubernetes) and I am using the task 'Run Code Analysis' (right after the task 'Prepare Analysis Configuration'), from the SonarQube extension on Azure marketplace.
Problem: After configuring SonarQube for Azure DevOps, while running the 'Run Code Analysis' task, the pipeline produces the error:
INFO: SonarScanner 220.127.116.112
INFO: Java 11.0.15 Private Build (64-bit)
INFO: Linux 5.4.17-2136.304.4.1.el7uek.x86_64 amd64
INFO: User cache: /root/.sonar/cache
INFO: Scanner configuration file: /azp/_work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/5.6.1/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /azp/_work/1/s/sonar-project.properties
INFO: Analyzing on SonarQube server 9.4.0
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=112ms
INFO: Server id: 41D5D374-AYHzDcd0-Nvlhdy2JQfz
INFO: User cache: /root/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=40ms
INFO: Load/download plugins (done) | time=143ms
INFO: Process project properties
INFO: Process project properties (done) | time=1ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=3ms
WARN: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ClassRealm{javascript}-org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl': Unsatisfied dependency expressed through constructor parameter 4; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'AnalysisTempFolder' defined in org.sonar.scanner.analysis.AnalysisTempFolderProvider: Unsatisfied dependency expressed through method 'provide' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultInputProject' defined in org.sonar.scanner.scan.InputProjectProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.api.batch.fs.internal.DefaultInputProject]: Factory method 'provide' threw exception; nested exception is Validation of project failed:
  o To use the property "sonar.branch.name" and analyze branches, Developer Edition or above is required. See https://redirect.sonarsource.com/doc/branches.html for more information.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1.808s
INFO: Final Memory: 16M/237M
INFO: ------------------------------------------------------------------------
##[error]ERROR: Error during SonarScanner execution
ERROR: Validation of project failed:
  o To use the property "sonar.branch.name" and analyze branches, Developer Edition or above is required. See https://redirect.sonarsource.com/doc/branches.html for more information.
ERROR: Error during SonarScanner execution
ERROR: Validation of project failed:
##[error]ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
##[error]The process '/azp/_work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/5.6.1/sonar-scanner/bin/sonar-scanner' failed with exit code 2
Finishing: Run Code Analysis

I've searched quite a bit and ran into branch analysis option being different between community and developer versions of SonarQube.
However, I have tried exec'ing into my azure agent and running sonar-scanner from there, and it works perfectly!
What I ran:
/azp/_work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/5.6.1/sonar-scanner/bin/sonar-scanner -Dsonar.host.url=<our-server-url> -Dsonar.login=<sonarqube-generated-token> -Dsonar.projectKey=<the-project-key> -Dsonar.scm.disabled=true
Some of the output from that:
INFO: Scanner configuration file: /azp/_work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/5.6.1/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 18.104.22.1682
INFO: Java 11.0.15 Private Build (64-bit)
INFO: Linux 5.4.17-2136.304.4.1.el7uek.x86_64 amd64
INFO: User cache: /root/.sonar/cache
INFO: Scanner configuration file: /azp/_work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/5.6.1/sonar-scanner/conf/sonar-scanner.properties
...
INFO: Analysis total time: 1:11.998 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:13.344s
INFO: Final Memory: 46M/237M
INFO: ------------------------------------------------------------------------

I have no idea what to do to fix this...
Comment: Ok, so after some more digging, I was able to fix that error by installing the [SonarQube Community Branch Plugin](https://github.com/mc1arke/sonarqube-community-branch-plugin/) in our Sonarqube server. And since we are running it on a kuberneted pod (running bitnami sonarqube), all I did was download the .jar, copy it to the plugins folder `/bitnami/sonarqube/extensions/plugins` and restart the pod. I chose not to answer the question for now, because another error arised after this and I want to be sure if it is related to this fix or not.
Answer: The solution was related to the steps provided in these instructions. All I did was add those lines to the helm values, being careful to replace the version value, and reinstall Sonarqube. The sonarqube step is running without issues now.
Comment: This is the answer.


Create javascript variable with thymeleaf

Question: I need to visualize some data and I want to create an javascript array based on this data.
I want to inject my own name and data to a variable from java code
/*[+
           var [+ [[${data.getDataName}]] =  [[${data.getData()}]];
+]*/

However name and data appears in brackets. Is there any walk around? Maybe you can recommend better html template engine, which works better with javascript?
Right now I have hard-coded html and javascript in my code and I want to get rid of it.
Comment: why you want create javascript array with your datas there comes from java? You be able to work with these datas (from java) directly in thymeleaf.
Comment: Because I need to plot those data using flotJS. Is there any way to do this directly in java?
Comment: ok, now i'm understand. we have a similar requirement but we handle that with ajax request. Sorry EDIT: One thing what you can do, is to call the javascript method in this what you have posted.
Comment: Ok. I found some example on documentation:
    var user = /*[[${session.user}]]*/ null
And as I assume this should parse type to null but this does not work for me (nor parsing to array[])
Answer: Probably solved this by now, but I'll give it a shot anyway...
I'm not sure I understand the [+ syntax, but other than that:
You probably don't want to dynamically name variables, unless you're writing your own framework or something.  It will be harder for someone else to read.  Also, explicitly defining variable names isn't usually considered 'hard-coding'.  However, if you do want to write your own mini-framework, you could try something crazy, like the following:
var data = {};
var name = /*[[${data.getDataName()}]]*/ '';
var value = /*[[${data.getData()}]]*/ '';

data[name] = value;

However, you could also initialize a series of pairs like so: [['name1', 'value1'],['name2', 'value2'], ['name3', 'value3']].  Maybe this is what you want.  Probably the easiest way to do this would be to define it in Java (as a List<Pair<String>> or something. Or you could use a List instead of a Pair, if you don't have one and don't feel like making one.


What string key and value map attribute can be placed with createAccount function with Smack api?

Question: I really have not tried this, I am just curious what are the attributes that can be set with createAccount with AccountManager:
createAccount(String username, String password, Map<String,String> attributes)

Can I put any String key and value, or there is a defined standard for this?
Answer: The attributes are obtained by calling
accountManager.getAccountAttributes()

Check the javadoc for the createAccount() method that you mentioned.  At the bottom.
See Also:
    getAccountAttributes()

Comment: Looking at the documentation I can see a bunch of attributes, however from within the Openfire server I can only see first name, last name and email attribute. Would that mean that the getAttributes would just output 3 items? Also does this mean that I can only add attributes defined in the documentation?
Answer: name -- the user's name.
first -- the user's first name.
last -- the user's last name.
email -- the user's email address.
city -- the user's city.
state -- the user's state.
zip -- the user's ZIP code.
phone -- the user's phone number.
url -- the user's website.
date -- the date the registration took place.
misc -- other miscellaneous information to associate with the account.
text -- textual information to associate with the account.
remove -- empty flag to remove account.

See AccountManager javadoc


How to use summernote with angularjs

Question: I would use summernote with AngularJS. I have found https://github.com/outsideris/angular-summernote, but this doesn't work for me. The only thing I get is an Error

Error: undefined is not a function (evaluating 'element.summernote(summernoteConfig)')

I have included all required files like jquery, bootstrap, summernote, etc.
My second idea was to use summer note without the angular-summernote directive. But also that shouldn't work perfectly.
If I try
$(document).ready(function() {
  $('.summernote').summernote();
});

summernote doesn't work, but If I try sth. like
$.getScript('//cdnjs.cloudflare.com/ajax/libs/summernote/0.5.1/summernote.min.js',function(){
  $('#summernote').summernote();
});

it works, but I would use my local copy of summernote so the second one isn't that what I need
Hope you understood my problem and thanks for any help
Rico
Answer: Ok guys, I've found the problem, for everyone with the same problem it's a very stupid mistake ;)
The problem was the I include the main angular.min.js file before jQuery an Bootstrap. Now I include jQuery first, then Bootstrap and then AngularJS and it works perfect.
<link rel="stylesheet" type="text/css" href="bootstrap.css" />
<link rel="stylesheet" type="text/css" href="summernote.css" />

In this order it works perfect for me.
A short tip, if you have also a problem with the button size, only thing to do is include <!DOCTYPE html> in you're main html file.
Rico
Answer: We have similar issue, the only workaround we see if to wrap it with it's own module (in the following it's summernoteDemo) like:

...

                    <summernote id="editor" code="text" ng-model="item.description"></summernote>

                    <textarea type="text" ng-model="item.description" style="width:100%;"></textarea>

But we have issue to make it appear in more than one place/instance. Maybe you can try and let us know.
Comment: Doesn't work for me :(, same error as before. Is it possible that summernote work only with a specific version of bootstrap, jquery etc.?

How to use summernote with angularjs


How to remove overhead caused by increasing number of CPU cores

Question: We have a situation where in a server with 8 core initializes a service in 6 minutes and the other server with 32 cpu-cores takes 35 minutes to initialize the service. After profiling it properly we have seen that it is because of two kernel APIs(get_counters and snmp_fold_field) which tries to collect data from each existing cores and as the number of cpu-cores increases execution time takes longer than expected.In order to reduce initialization time we thought to make extra cores disabled and later to initialization enable all the cpu cores.But in this approach also once we enable all cores synchronization happens on newly enabled cores as this is SMP kernel.
Can someone suggest us how to reduce overhead caused by increased CPU cores efficiently?

Instead code i would rather explain initialization functionality of this user defined system service.During its initialization this service plumbs virtual interfaces on configured IPs. To avoid overlapping IPs situation for each configured IP it creates an internal IP and all communication is done on the interfaces plumbed on internal IP.As the packet reaches to system with destination as configured IP , Mangling/NATting/Routing table rules are applied on the system to mange it.
An interface is also plumb for configured Ip to avoid IP forwarding.Our issue is when we scale our system configured for 1024 IPs on 8 core machine it takes 8 minutes and on 32 cores it takes 35 minutes.
On further debugging done using system profiling We saw that ARPtables/IPtables's kernel module is consuming most time in "get_counters()" and IP's kernel module is consuming time in snmp_fold_field(). If i simply disable ARPtables Mangling rules time drops to 18 minutes from 35 minutes.I can share the kernel modules's callstacks collected using profiler.
Comment: Write up a small program that shows the behavior.
Answer: A common bottleneck in applications utilizing multi-core is uncontrolled/-optimized access to shared resources. The biggest performance killer is the bus-lock (critical sections) followed by accesses to RAM, accesses to the L3 cache and accesses to the L2 cache. As long as a core is operating inside its own L1 (code and data) caches the only bottlenecks will be due to poorly-written code and badly-organized data. When two cores need to go outside their L1 caches they may collide when accessing their (shared) L2 cache. Who gets to go first? Is the data even there or must we move down into L3 or RAM to access it? For every further level required to find the data you're looking at a 3-4x time penalty.
Concerning your application it seems to have worked reasonably well because eight cores can only collide to a certain degree when accessing the shared resources. With thirty-two cores the problem becomes more than four times as large because you'll have four times the strain on the resource and four times as many cores to resolve who gets to access first. It's like a doorway: as long as a few people run in or out through the doorway now and then there's no problem. Someone approaching the doorway might stop a little to let the other guy through. Suddenly you have a situation where many people are running in and out and you'll not only have congestion, you'll have a traffic jam.
My advice to you is to experiment with restricting the number of threads (which will translate into number of cores) your application may utilize at any one time. The six minute startup time on eight cores could serve as a benchmark. You may find that it will execute faster on four cores than eight, not to mention thirty-two.
If this is the case and you still insist on running faster on thirty-two cores than you are today you're looking at an enormous amount of work both making the SNMP-server code more efficient and organizing your data to lessen the load on shared resources. Not for the faint-of-heart. You may end up re-writing the entire application.
Comment: Our application is using very less number of threads but we use third party applications like "ip","iptables" and "arptables" which internally call two apis get_sockopt() and recvmsg(). These APIs take longer time in kernel.Corresponding APIs in kernel for them are get_sockopt() and snmp_fold_field()[I mentioned them earlier].
Comment: You need to determine to what extent they contribute to the adverse overhead characteristics. Try experimenting by decreasing the number of IPs to see if it is possibler to find one sweet spot for four cores and another for thirty-two.


jquery set url to submit

Question: i have a form with this validation
jquery
$("#aioForm").on('submit',function(e){
        var errorCount = 0;
        $('span.errorMessage').text('');
        // checkign for multiple select [now you have one]
        var select = $('#addIO select').filter(function(){
            return this.selectedIndex == 0;
        }).next('span').text('Please select a cell');
        // checking for inputs
        var input = $("#aioForm input[type=text]").filter(function() {
            return !this.value;
        }).next('span').text("fill the name please");
        // no error checking
        if(input.length==0 && select.length == 0){
            $(this)[0].submit(); // submit form if no error
        }
        e.preventDefault();
    });

if there is no error i want to set the url to submit before submit , i mean before the statement
$(this)[0].submit();

Answer: if(input.length==0 && select.length == 0){
   $(this).attr('action', 'url_to_submit').submit();
}

Comment: @LinCR `action` is the `form` attribute where to submit form
Comment: ok i got you , so even if i put this in my html code `<form action="new.php"` then the submit will take the url you put in ur code right ?
Answer: You need to use:
$(this).submit();

Edit: (After OP comments)
If you want to submit your form with some specific values from javascript:
Add two fields in your form like this:
<input type='hidden' name='currentRelation' id='currentRelation'>
<input type='hidden' name='currentConcept' id='currentConcept'>

Now in jQuery you need to do this before submit:
// Get values from HTML (According to your previous question)
var ioAddConcept = $(".ioAddConcept").html();
var ioAddRelation = $(".ioAddRelation").html();

// Set these values to hidden fields
$('#ioAddConcept').text( ioAddConcept );
$('#ioAddRelation').text( ioAddRelation );

// Now submit form
$(this).submit();

Now on server side:
print_r( $_POST );
// OR
print_r( $_GET );

Comment: your code works excelent , but there is one thing , please check my jquery code , the currentConcept and currentRelation are in a loop so i can't guess how many hidden input  i have to make , and in this case the name should be currentConcpet[] , currentRelation[] cos i have to send an array that generated dynamicly , very thank you
Comment: hi again man , i tested [0] and it works , i want to put the currentConcept and currentRelation in the url :)
Comment: Please review the edited answer. Hope it will help this time :)
Comment: i solve it `            var currentconcepts = new Array();
            $(".ioAddConcept").each(function(index){
                currentconcepts[index] = $(this).html();
            });
            var currentrelations = new Array();
            $(".ioAddRelation").each(function(index){
                currentrelations[index] = $(this).html();
            });
            //$(this)[0].submit(); // submit form if no error
            $(this).attr('action', 'http://localhost/Mar7ba/InformationObject/addIO/'+currentconcepts+'/'+currentrelations ).submit();`

jquery set url to submit


is there a better way to show loading message with jquery ui tabs?

Question: using jquery ui tabs, when you load a tab in ajax, the tab changes message to say "Loading . ." i think this is a little subtle.
Is there anyway you can do something in this content area of the tab similar to what block ui does when you are loading a call in ajax.
Comment: 'similar to blockUI' or 'using blockUI'?
Answer: You would display a loading message within the content area like so (untested):
<code>$('#selector').bind('tabsselect', function(event, ui) {

    // show default $.blockUI loading message
    $('ui.panel').blockUI();
}).bind('tabsload', function(event, ui) {

    // remove loading message
    $('ui.panel').unblockUI();
});
</code>


Probability that shuffled deck contains no two consecutive cards of the same suit

Question: If a deck of 52 standard cards is completely randomly shuffled, what are the odds that not once do two cards of the same suit end up right next to each other?
Rephrasing:
If I have a bag of 13 red balls, 13 blue balls, 13 yellow balls, and 13 white balls, and I keep pulling out balls without replacement, then what are the odds that I never pull a ball of the same color twice consecutively?
I've tried doing this for small sets, and looking for a rule (2 of each suit, and 3 of each suit)
I've tried to find a statistical significance to get a good estimate, or a certain pdf, or cdf to use, but I could find none.
Is there any way of finding this without massive computations?
Comment: This is a special case of the following:

http://math.stackexchange.com/questions/430000/how-many-arrangements-of-a-generalized-deck-of-generalised-cards-have-pairs
Answer: It's not that massive a computation.  Let $Q(a,b,c,d)$ be the probability that the top card isn't the first suit and no two adjacent cards share a suit, given that there are $a$ cards of the first suit left in the deck, $b$ of the second, etc., and the deck is thoroughly shuffled.  Then the probability you want is $Q(12,13,13,13)$ (having drawn the top card and identified its suit, whatever it was, as the "first suit").  The recursion is
$$
Q(a,b,c,d)=\frac{bQ(b-1,a,c,d)+cQ(c-1,a,b,d)+dQ(d-1,a,b,c)}{a+b+c+d},
$$
with boundary condition $Q(0,0,0,0)=1$.  The following Python code calculates the value for any values of $a,b,c,d$:
def q(a,b,c,d,cache={(0,0,0,0):1.0}):
  if a<0: return 0.0
  if (a,b,c,d) in cache: return cache[(a,b,c,d)]
  sm = (b*q(b-1,a,c,d) + c*q(c-1,a,b,d) + d*q(d-1,a,b,c)) / (a+b+c+d)
  cache[(a,b,c,d)] = sm
  return sm

Once defined, q(12,13,13,13) returns 1.1817474309603094e-06 almost instantly.
Comment: Thats a very clever formula you derived! I like this
Answer: If you are willing to use massive computations, you can get the exact answer as follows
 based on the method in this answer. If $q(x)=\sum_{i=1}^{13} \frac{(-1)^{i-13}}{i!} {13-1 \choose i-1}x^i$, then the number of permutations with no consecutive cards of the same suit is $$\int_0^\infty q(x)^4\,e^{-x}\,dx=63394531038905867912088.$$
Dividing this by $52!/(13!)^4$ gives the probability $.000001181747431$.
Comment: @ThomasAndrews The second one: 13 Hearts, 13 Diamonds, 13 Spades, and 13 Clubs (with the values erased if you like).
Comment: Wow, that was much faster than I expected for an answer. Additionally, thanks for linking to helpful answers. I knew it would be small, but I did not expect almost less than 1 in 1 million.
Comment: Shouldn't it be dividing by $52!$? Or is it the number of permutations assuming that the cards of the same suit are indistinguishable?
Comment: @Asimov I agree, the probability is lower than I expected. About 1 in 846,000.
Answer: I wouldn't call this by any means fast (its exptime) but its quite a bit more efficient than attempting to just brute force enumerate
Denote the the balls as "r", "b", "y", and "w" respectively
Denote pulling out the balls as assembling a sequence of "r", "b", "y" ,"w" such that there are 13 of each
We are looking for the number of scenarios where no 2 of the same color are found in a row
This can be computed as
$$1 - \frac{number  \  where \ least  \ 2  \ are  \ found}{total} $$
So now the total is a trivial excercise to compute as it is $$ \frac{52!}{13!13!13!13!} $$
Based on the permutation formula
Now to find the number where at least 2 are present will require us to exploit an inclusion exclusion principle
We consider an empty of sequence of balls with locations $a_1, a_2 ... a_{52}$
Now for a start we can pick any two consecutive number $i,j$ and assign them the same color. From here we can ask what are all the possible permutations. In doing so however we will see some overcounting occur. Consider the following smaller case of 4 reds, 1 yellow, 1 blue
$$rrybrr$$
is a sequence which both the $rra_3a_4a_5a_6$ and $a_1a_2a_3a_4rr$ sequence count. Thus we need to remove it from the sum of combinations of these two sequences.
But now consider the more involved case of 4 reds, 2 yellows, 1 blue
$$rryybrr$$
Is counted by $rra_1a_2a_3a_4a_5a_6a_7$, $a_1a_2yya_5a_6a_7$, and $a_1a_2a_3a_4a_5rr$ which means that if we add up the counts of these three combos we have counted it 3 times, but then if we take a pair of sequences: find the intersection and then subtract we have subtracted it 3 times, in other words we forgot to count it.
This reveals to us a more general inclusion exclusion rule will be necessary and shows us an algorithm for efficiently computing your problem
Create all the different possible empty sequences that can be constructed by using only 2 of the same color placed consecutively and the remaining 50 spots blank.
Now from this generate the set of possible "intersections" of 2 sequences (ex: $rra_3$ and $a_1rr$ can be intersected to form $rrr$ but $bba_3$ and $rra_3$ cannot be intersected since that would require one of the positions to be simaltaneously red and blue.
Now generate the set of intersections of 3 original sequences, 4 original sequences, etc...
Now for each sequence you have made (including those generated from intersections) count the number of permutations of remaining elements possible
Then sum up all the first case sequence numbers, subtract the 2-intersection numbers, add 3 intersection numbers, subtract 4-intersection numbers etc... all the way down the line
The result will be the total number of sequences where at 2 of the same color are guaranteed to be next to each other, without any overcounting. Call this number N
$$1 - \frac{N (13!)^4}{52!}$$
Is the answer you are looking for
If we denote $u_i$ as a sequence generated, $u_i \cap u_j $ as the intersection of the two sequences (if possible) and null if not possible and lastly $P(u_i)$ equals the number of permutations possible for some argument inside which is a sequence or intersection of sequences (this returns 0 if the intersection inside is Null)
Then the total is
$$  \sum_{i = 1}^{total \ sequences \ of \ 2} \left( (-1)^{i+1}\sum \left[P\left(\cap_{i \ elements \in U} \right] \right) \right)$$


Left alignment seems to create additional spacing draft js

Question:
When I click left alignment, extra spacing appears.
I'm using "react-draft-wysiwyg": "^1.14.4"
any help will be appreciated.
Answer: Ignore its height and set it to new value by setting the height property of class .rdw-left-aligned-block as !important.
.rdw-left-aligned-block {
    height : 2.2rem!important;
}


Como dar permissões para rodar aplicação pelo GENEXUS WEB START, WIN, GX9, JAVA ((build 1.8.0_31-b13))

Question: alguém tem aplicação gerada pelo GX9, JAVA, WIN, e fez a atualização para a VM do JAVA ((build 1.8.0_31-b13)) ?
Conseguiram dar permissões para a aplicação ser iniciada ?
Answer: Você pode colocar informação mais detalhada da mensagem de erro ou aviso que está recebendo?
Qual o sistema operacional?
Não ficou claro para mim se é um problema no momento de instalar a aplicação ou na hora de rodar a aplicação. Embora ache que seja na hora de rodar.
Minha ideia é conseguir mais informações para saber se o problema é relacionado a algum problema em certificado ou se é problema de permissões na máquina, como UAC, IIS, etc...
Mas acho que vale a pena você dar uma olhada no seguinte link: (olhar em espanhol, pois está mais completo)
http://www2.gxtechnical.com/portal/hgxpp001.aspx?15,4,61,O,S,0,,36829
E dê uma olhada também neste outro link (pois ainda não tenho claro qual o seu problema):
https://stackoverflow.com/questions/15277496/registry-key-has-value-1-7-but-1-6-is-required-java-1-7-is-installed


linux hang + kernel messages about failed to assign mem

Question: we have 5 Linux rhel machines ,
we noticed that all machines was hang with the same time
from messages file we can se the following
<code>Dec 29 19:54:25 localhost kernel: pci 0000:ff:12.4: BAR 4: failed to assign [mem size 0x00000040]
Dec 29 19:54:25 localhost kernel: pci 0000:ff:12.0: BAR 1: failed to assign [mem size 0x00000010]
</code>
is this kernel messages are maybe the reason for linux crash/hang?
according to redhat , they recommended to update the kernel version ( https://access.redhat.com/solutions/2772311 )
but they not mention anything about linux crash/hang
Answer: Not every problem is a crash, hang, or security issue. Or, what you found might not be related to the root cause of your problem.
Per that Red Hat KB 2772311, you are affected if:

Red Hat Enterprise Linux 7
Intel Broadwell-EP CPU
kernel version is
older than 3.10.0-514.el7

That log message means the kernel warned about PCI base address registers out of specification. Red Hat notes that Intel has noticed no functional problems.
Update your kernel, plus any other important updates. Unknown if it will fix your hang problem. However, updates definitely have security and functional fixes, including this minor thing.


Elastic Beanstalk .ebextensions config script not running on Windows deployment

Question: I have a Microsoft ASP.NET app that I am deploying successfully via Elastic Beanstalk to a server.
However, I am trying to run a few config files under the .ebextensions in order to set up certain packages that are used by my application.
For example, I have an installation of NewRelic script as follows:
<code>files:
  "c:\\temp\\redistribution\\newrelic\\NewRelicDotNetAgent_x64.msi":
    source: http://download.newrelic.com/dot_net_agent/release/NewRelicDotNetAgent_x64.msi

commands:
  instNewRelic:
    command:   msiexec.exe /i c:\\temp\\redistribution\\newrelic\\NewRelicDotNetAgent_x64.msi /qb NR_LICENSE_KEY=<mylicense here> INSTALLLEVEL=1
  iisRestart:
    command:   c:\\windows\\system32\\iisreset.exe /RESTART
</code>
This command should download the installer (which is accessible via the server) and run the package.
The problem is that I don't see any indication that the files were downloaded, or that the scripts were even attempted to be run by the elastic beanstalk process.
I have checked the following:

The config files under the .ebextensions are included in the solution and I have checked that they are deployed to the server.
The server can access any of the files that I am trying to download.
The application runs OK, is just that this initialization script is not working.
I have tried deploying to both Windows 2008 IIS 7.5 and Windows 2012 IIS 8.5, and it doesn't work on either.

Any help figuring out this will be appreciated.
Thanks,
Comment: This command will make the copy of msi, how we can fix this? http://prntscr.com/b69bs6
Answer: i was able to get the ebextensions to run after setting the files build action to "Content".
Right click file > properties > Build action. Set to "Content"
Its also helpful to verify that the contents of the file are valid with an online parser.
Answer: I solved this problem by making sure that in VS you include All files in the project.
I thought that by marking the scripts as Content / Copy Always they would be included in the target, which they are but under the bin folder.   The issue is that the .ebextensions need to be at the root of the site, and you can only achieve that by selecting  under Package/Publish Web the option Include All Files. This will copy the .ebextensions  at the root of the site which it will then be picked up by the Elastic Beanstalk workers.


Criação de tabelas flutter gerando erro no such table

Question: Estou com um problema onde não estou conseguindo criar mais de uma tabela no sqlite com fluuter. Ao tentar criar uma tabela caso o banco já tenha sido criado gera o erro no such table
Estou criando da seguinte forma:
static Future<Database> database() async {
  final dbPath = await getDatabasesPath();
  final sql = '''CREATE TABLE cartoes(
    id INTEGER,
    instituiBanc int NOT NULL,
    bandeira int NOT NULL,
    isDebito INTEGER,
    vencimento TEXT,
    saldoDisponivel REAL,
    limite REAL,
    PRIMARY KEY("id" AUTOINCREMENT)
  )''';

  return openDatabase(
    path.join(dbPath, 'table.db'),
    onCreate: (db, version) {
    return db.execute(sql);
    },
    version: 1,
  );
}

static Future<Database> database() async {
final dbPath = await getDatabasesPath();
final sql = '''CREATE TABLE categoria(
  id INTEGER,
  descricao TEXT NOT NULL,
  isReceita INTEGER ,
  PRIMARY KEY("id" AUTOINCREMENT)
)''';

return openDatabase(
  path.join(dbPath, 'table.db'),
  onCreate: (db, version) {
    return db.execute(sql);
  },
  version: 1,
);
}

Se ele entrar no banco e entrar o mesmo já criado, ele não deveria criar apenas a tabela faltante?
Answer: O problema é que você deve criar todas as tabelas que precisa ao criar o Banco de Dados.
Cada nova tabela adicionada depois deve ser adicionada junto com o incremento da versão "version".
Para o seu caso, faça da seguinte forma, que assim deve funcionar:
static Future<Database> database() async {
  final dbPath = await getDatabasesPath();

  final sqlCartoes = '''CREATE TABLE cartoes(
    id INTEGER,
    instituiBanc int NOT NULL,
    bandeira int NOT NULL,
    isDebito INTEGER,
    vencimento TEXT,
    saldoDisponivel REAL,
    limite REAL,
    PRIMARY KEY("id" AUTOINCREMENT)
  )''';

  final sqlCategoria = '''CREATE TABLE categoria(
    id INTEGER,
    descricao TEXT NOT NULL,
    isReceita INTEGER ,
    PRIMARY KEY("id" AUTOINCREMENT)
  )''';

  return openDatabase(
    path.join(dbPath, 'table.db'),
    onCreate: (db, version) async {
      await db.execute(sqlCartoes);
      await db.execute(sqlCategoria);
    },
    version: 1,
  );
}

Se quiser mais alguns exemplos, você pode ver na própria página do package sqflite.


Saving thumb nail preview with JCrop, JQuery and asp.net

Question: I've been dabbling with JCrop and I can get it working so far as uploading an image, selecting a region and then saving what I've selected to a cropped version of the original image. I can also get the thumbnail preview working, so that whatever I've selected (however big or small fits into a 150px*150px region)..so far all good.
The only problem I'm having now is saving what is in the thumbnail preview which is 150*150 and as mentioned contains whatever I have selected...
I've had a good look around on google and can't see anything to save the thumbmail preview..
Anyone come across this before?
Answer: Ok bascially what I'm doing is saving the cropped image and then saving it again but resizing it to whatever dimensions are in the preview pane....I'm not sure it gives me the an exact replica of what's in the preview pane in terms of quality but it's not so bad I guess.