only one raw user defined table can be passed to stored procedure

 select @MaxSeq=(case when (select count(*) from app_Attachments where app_Attachments.AppId=@appID)<=0 then 1 else (select (MAX(seq)+1) from app_Attachments where app_Attachments.AppId=@appID )end)
declare @Id int;select @Id = (Coalesce((select max(Id)+1 from app_Attachments),1))
insert into app_Attachments(Id,AppID,AttName,AttContentType,AttData,AddedBy,AddedDate,Seq)
select  @Id,
        from @Attachments --user defined table

CREATE TYPE [dbo].[AppsAttachments] AS TABLE(
[AppId] [int] NULL,
[Bytes] [varbinary](max) NULL,
[ImgNames] [nvarchar](max) NULL,
[ImgType] [nvarchar](200) NULL)

Insert into table using stored procedure that has user defined table as parameter only success if table passed has one raw,it was working well when the primary key is set as identity, after i changed the primary key into manual integer to be entered the problem occured

Methods defined as TestMethod do not support Web service callouts – Unit Test

We have a custom object called ‘support’ – we have process builder configured for this object. in one of the process builder action it will invoke Apex (Invocable Method). This will trigger a callout to External System. In Apex Test Class we have mocked the response for HTTP callout by using Test.setMock & HttpCalloutMock interface. code coverage for that apex class is 96%.

We have different apex test classes where we are need test records for Support Object – we are creating test data using testDataFactory Class. While running the test we are seeing below error – “Methods defined as TestMethod do not support Web service callouts”.

Please provide your suggestion to resolve this issue.

Postgresql UDF (User Defined Functions) overhead


The task may seem esotheric, but nevertheless I want to create a POC of some sorts.

The goal

My goal is to make PostgreSQL database (version 10) expose an API to an application that uses it.

An API needs to be in form of a set of UDFs: all functions belong to a public scheme which is the only one accessible to an application. The tables and other stuff are hidden in private scheme. Almost like, you know, an object-oriented database.

Here’s why I’m trying to make it work:

  • It would decouple database from application, so you can restructure/optimize/denormalize the former with lesser risk of breaking the latter. You can even delegate its maintenance to another team or department (oh my)
  • An API formalizes the requirements for a service. A database surely is a service, but the traditional mechanics called migrations doesn’t serve well in figuring out what’s going on in there. Think of hundreds or thousands of migrations that collected over the years, and some of them are broken and never will work again, and

Well, nevermind.

The issue

So when I’ve tried to create some very simple functions (like getting all records from a table), I mentioned that they are always slower than the query it wraps. While this is totally acceptable and understandable by itself, the timing difference can be huge. Hence, unacceptable.

The example

I’ve got a table like this.

CREATE TABLE notifications (
    source_type INTEGER NOT NULL,
    content JSONB,

And >120k records in it.
Imagine we want to get all of them.
Here we do it with a simple query. No indexes, JSONB data is almost 1kb for every record.

                                                         QUERY PLAN                                                              
Seq Scan on private.notifications  (cost=0.00..16216.13 rows=120113 width=877) (actual time=0.015..496.473 rows=120113 loops=1)
  Output: id, source_type, content, created
  Buffers: shared hit=15015
Planning time: 0.063 ms
Execution time: 973.935 ms

Now let’s try to utilize a pl/pgsql function like this one:

CREATE OR REPLACE FUNCTION notifications_get()
RETURNS SETOF private.notifications AS
    RETURN QUERY SELECT * from private.notifications;
LANGUAGE 'plpgsql' 


                                                            QUERY PLAN                                                             
Function Scan on love.notifications_get  (cost=0.25..10.25 rows=1000 width=48) (actual time=99.561..589.129 rows=120113 loops=1)
  Output: id, source_type, content, created
  Function Call: notifications_get()
  Buffers: shared hit=15015
Planning time: 0.045 ms
Execution time: 1091.698 ms

Obviously, the difference between function and a query is these 99.5ms spent getting first record.
I’ve tried further optimizations (maybe naively):

  1. Adjust rows to make query planning more realistic. Let’s say 120k. It yields the same results (102.373..593.628)
  2. Use the SQL language (fair enough, the query is simple). Surprisingly, same results (95.760..595.746)
  3. Make function STABLE. Should get better now, right? Nope. Same results (93.132..594.331)


  1. Is there anything else that can be done with the function?
  2. Why none of these optimization made a difference?
  3. What exactly are these first 100ms? These aren’t constant: when there were 20k rows in the table, the function would spend mysterious 18-20ms trying to do something first. So obviously it tries to do it with every single row it the table. How to reduce this wasting or get rid of it at all? Is this event possible?

Thanks in advance!


Another issue I faced was with the function that gets a record by its id. 0.25ms vs 0.025ms. Ten-fold difference, but I more or less get where it comes from. Again, no optimization trick listed above made a difference (seems like it shouldn’t).

How to apply TransformedProcess to a user defined ItoProcess?

Hi I would like to manipulate user defined Ito processes,
say multiply my process by a deterministic function . Thanks in advance

 LFD = ItoProcess[[DifferentialD]x[t] == 
 x[t]  [DifferentialD]t + 
 Sqrt[ x[t]] [DifferentialD]w[t], x[t], {x, [Epsilon]},
 t, w [Distributed] WienerProcess[]]

 L1 = TransformedProcess[b[t]   Exp[ -  t] , b [Distributed] LFD, t]

Why having a conserving metric defined on a product space guarantees that projections are isometries?

I wanted to know when the metric (between 2 spaces A and B) is preserved.

Is metrics preserved when isometries are projections that guarantee or define a product space existence within or of product space existence itself ?

Product Space
A Cartesian product equipped with a “product topology” is called a product space (or product topological space, or direct product).

The generalized Kronecker delta and three sets of 16 tetrahedra defined by 192 of the 240 roots of E8…

Edited as per Jim Humphreys 9/16/2018 to make it clearer that the 192 are 192 of the 240 total roots of E8, and also to add this link for information on Gosset’s polytope 4_21:

Edited 9/18/2018 to add new information from Wendy Krieger (see bottom of this post.)

Edited 9/24/2018 to add new information provided by Dr David Richter (see bottom of this post)

Edited 10/1/2018 to add new information provided by Dr Derek Smith (see bottom of this post.)

Edited 10/21/2018 to provide new information from Roger Bagula re “Krieger-tetrahedra” in relation to 2x2x matrices of SL(2,C) type. (Roger Bagula is the depositor of OEIS A152459.)

Original question (without additional information from Wendy):

Using 192 of the 240 roots of E8 (vertices of 4_21), Wendy Krieger has defined 48 disjoint tetrahedra this way:

Taking the E8 as {128,112}, of radius 2, we get

16 tetrahedra at (1,1,1,1)E, (1,1,1,1)E

16 tetrahedra at (1,1,1,1)O (1,1,1,1)O

16 tetrahedra in (2,0,0,0)A (2,0,0,0)A

In the first two,

E means take an even number of sign-changes in the bracket.

O means take an odd number of sign-changes in each bracket.

A means all permutations, all change of sign in the brackets.

The vertices of the tetrahedron then comes from three coordinates in a
given set, so these are the coordinates of a tetrahedron in the first set,
using the first three coordinates.

1,1,1,1 1,1,1,1

1,-1,-1,1 1,1,1,1

-1,1,-1,1 1,1,1,1

-1,-1,-1,1 1,1,1,1


Is it possible to define a generalized Kronecker delta function which takes Wendy’s E, O, and A sets to 1, -1, and 0 respectively (or -1, 1, 0)?

See this link for definition of the GENERALIZED Kronecker delta:

New information from Wendy Krieger (added 9/18):

Of the 240 total roots of E8, 192 are consumed by Wendy’s 48 tetrahedra, leaving 48. And she has discovered that these 48 define two 24-cells. So in addition to the generalized Kronecker delta question, there is an additional question as to whether the 48 vertices of the two 24-cells “organize” the 48 tetrahedra in any interesting way.

Wendy has provided an affirmative and interesting answer to this question:

The centres of the 48 octahedral faces of each of the two 24-cells, in
rectangular product, produce a 3*3 array of the 48 tetrahedra, of which
there are six distinct sets of 24.

See this link for definition of the famous and unique 24-cell, which has no analogs in spaces lower or higher than 4 dimensions:

New information from Dr. David Richter (9/24/2018)

Dr. Richter has kindly suggested that Wendy’s construction is not new within the literature of Lie-algebras. He writes:

“It does not seem new to me. Eugene Dynkin studied these things in depth in the 1940’s, for example. (In Russia during World War II. He avoided the draft due to poor eyesight.) You should look up his article “Semisimple subalgebras of semisimple Lie algebras”. This was published in the Translations of the American Mathematical Society in 1952. Although he does not use the language of regular polytopes, I think you will find the structures that you describe, encoded as rank -8 Lie subalgebras of the E(8) Lie algebra.”

New information from Dr. Derek Smith provided 10/1/2018)

There are 16 “nearest neighbors” to any one of Wendy’s tetrahedra, in the following sense.

Consider the tetrahedron T that has its four vertices in R^8 given by the following rows (here + is 1, – is -1, and we’re using the even coordinate system, scaled up by a factor of 2 to avoid some fractions, so minimal non-zero vectors have norm 8):

+ + + + + + + +
+ - - + + + + +
- + - + + + + +
- - + + + + + +

The center c of T is the average of those vectors, namely c = 0 0 0 + + + + +.

The vectors in E8 closest to c are the four vertices of T, each of whose (squared) distance from c is 3. The next possible distance is 5, and the 16 vectors in E8 that achieve this are of the form 0 0 0 a b c d e, where each of the five letters is either 0 or 2, and there are an even number of 2’s.

As we’ve discussed previously, there are geometric symmetries of the lattice taking any one of the tetrahedra to any other, so there’s nothing special about this one. For instance, if we had taken

2 0 0 0 2 0 0 0
0 2 0 0 2 0 0 0
0 0 2 0 2 0 0 0
0 0 0 2 2 0 0 0

as our tetrahedron instead, with center c = 1/2 1/2 1/2 1/2 2 0 0 0, then the 16 vectors at distance 5 from c aren’t as easily described in one sentence; but you can check that they are

0 0 0 0 0 0 0 0
0 0 0 0 4 0 0 0
+ + + + + a b c   a, b, and c are + and -, with an even number of -‘s
+ + + + 3 x y z   x, y, and z are + and -, with an odd number of -‘s
0 0 0 0 2 p q r   p, q, and r are -2, 0, and 2, with exactly two 0’s

for a total of 1+1+4+4+6=16 vectors.

There may be other ways to describe “nearest neighbors” that might yield different answers, e.g. take vectors close to the 4 centers of the tetrahedron’s faces, or close to the 6 centers of the tetrahedron’s edges.

Email from Roger Bagula 10/21/2018 (and mine to him):

My email to Roger Bagula (10/20/2018):

My research team seems to have uncovered a pretty clear biomolecular
instantiation of OEIS A152459.
Furthermore, this instantiation appears to be connected with a particular
decomposition of the root-system of E8 (via the geometry of 4_21 or 
a Dynkin sub-algebra).

His email to me (10/21/2018):

Thank you for letting me know about your discovery.
That idea / result appears to be an amazing connection of SL(2,C) type
of 2x2 matrices to the higher geometry.
I wish you luck as E_8 symmetry breaking is near my heart, LOL.

No Publication Target or Target Type defined for Experience Manager-enabled Web site

I have a websites having few pages present on domain root and others inside sub-domain en. On root pages we have dynamic component presentations from en publication in use. Whenever we are updating the root pages in XPM, we are getting error message:

No Publication Target or Target Type is defined for this Experience Manager-enabled Web site. To resolve this problem, Contact your SDL Web administrator.
   at Tridion.Web.UI.Models.SiteEdit.Services.GetPreviewSessionToken(PublishedItemInfo[] publishedItemsInfo, String publishingTargetId)
   at Tridion.Web.UI.Models.SiteEdit.SessionPreviewService.GetPreviewToken(PublishedItemInfo[] publishedItemsInfo, String publishingTargetId)
   at SyncInvokeGetPreviewToken(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at Tridion.Web.UI.Core.Extensibility.DataExtenderOperationInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.Pr

This seems correct as we have publication mapping defined for subdomains(en) only as per the topology manager settings configured below:


CmEnvironmentId     : Environment1
PublicationId       : tcm:0-4-1
EnvironmentPurpose  : EP1
WebApplicationId    : Application1
RelativeUrl         : /en
PrimaryMappedUrl    : https://domain/en
IsOffline           : False
CdEnvironment       : 
Id                  : Mapping1
ExtensionProperties : {}


BaseUrls             : {}
CdEnvironmentId      : CDEnvironment1
EnvironmentPurpose   : EP1
CdEnvironment        : 
ScopedRepositoryKeys : {}
Id                   : Website1
ExtensionProperties  : {}


ContextUrl           : /
WebsiteId            : Website1
EnvironmentPurpose   : EP1
CdEnvironment        : 
ScopedRepositoryKeys : {}
Id                   : Application1
ExtensionProperties  : {}

Now my question is can we configure topology manager to work for domain and sub-domain both in Web 8.5? Is there any way, we can use same publication with domain and sub-domain to work with XPM.

HSPICE – Probing Current of an Element Defined By SUBCKT

For a regular resistor model, to plot I-V curve, I write:
R1 m0 m1 1
.probe DC i(R1)
Then, I open CSCOPE. i(R1) is listed. By selecting it, I can see its I-V behavior.

Now, I have a device that is defined with .subckt:
.subckt device m0 m1 param=p
Then, I instantiate it and probe it by:
x1 m0 m1 device
.probe DC i(X1)
However, when I open CSCOPE, i(x1) is not listed, so I cannot see the diagram.

Does anyone know the reason?

Prove that the paraboloid in $R^3$, defined by $x^2 + y^2 – z^2 =a$ is a manifold if $a>0$. why does not…

Prove that the paraboloid in $R^3$, defined by $x^2 + y^2 – z^2 =a$ is a manifold if $a>0$. why does not $x^2 + y^2 -z^2 =0$ define a manifold?

Could anyone give me a hint of the solution of this question?