text:
Q: Is any dual metrizable locally convex space a Frechet space? [I have posted this question on MSE some time ago, but received no answer.]
The title basically says all of it.
If a normed space $F$ is a dual of a normed space $E$, then $F$ is a Banach space. I wonder if the same holds for Frechet spaces.
The strong dual $F$ of a locally convex space $E$ is complete, once $E$ is bornological, but I am not sure if this is the case here. Perhaps the completion of $E$ is though.

A: I am not 100% clear what you are asking, but I will answer according to two interpretations:
a) Suppose that $F$, a metrizable TVS, is the strong dual of $E$, a locally convex TVS. Need $F$ be complete?
The answer to this question is no, by the following counterexample, where we obtain an incomplete normed space as the strong dual of a locally convex space.
Take $E$ to be $B(\mathcal{H})$, the bounded operators on an an infinite dimensional Hilbert space $\mathcal{H}$. The topology on $B(\mathcal{H})$ we will use is the strong operator topology (SOT, i.e. pointwise convergence of Hilbert space norm). It is not hard to show that, as a vector space, $F = E'$ is $\mathrm{FinRank}(\mathcal{H})$, the finite-rank operators (see, for example, Takesaki's Theory of Operator Algebras I, Theorem II.2.6). To work out what the strong dual topology on $F$ is, we need to know what the bounded sets are for the SOT on $B(\mathcal{H})$.
To this end, we can use the completeness of $\mathcal{H}$ and apply the uniform boundedness principle (see Schaefer's Topological Vector Spaces, III.4.2), showing SOT-bounded sets are exactly equicontinuous sets, a.k.a. norm-bounded sets in $B(\mathcal{H})$. Therefore the strong dual topology on $F$ is that defined by the dual norm, which is the trace-class norm on $\mathrm{FinRank}(\mathcal{H})$. As $\mathcal{H}$ is infinite-dimensional, $F$ is not complete in this norm, as there are trace-class operators that are not of finite rank.
(Added in edit: Here, the definition of strong dual topology on $F$ that I used was the unique locally convex topology having the polars of the bounded sets of $E$ as basic 0-neighbourhoods. It can also mean (as it does in Schaefer) the topology obtained by taking the polars of weakly (i.e. $\sigma(E,F)$) bounded sets instead. In this case, as $\sigma(E,F) = \sigma(B(\mathcal{H}),\mathrm{FinRank}(\mathcal{H}))$ is the weak operator topology, these are the WOT-bounded sets. Fortunately, WOT-bounded sets can be shown to be SOT-bounded by applying the uniform boundedness principle pointwise, so the two definitions of strong topology on $F$ coincide.)
b) Suppose that $F$, a metrizable TVS, is the strong dual of $E$, a metrizable TVS. Need $F$ be complete?
The answer to this question is yes, and also that $F$ is a Banach space (or "Banachable" space, without choosing any norm in particular). This is a consequence of this answer, plus the fact that the dual of a normed space is a Banach space.


text:
Q: Increase width of drag handles W10 Is there a way to increase the width of drag-handles in Win 10 ?
It always takes me aout five attempts to activate the cursor/handle so I can drag the edges of windows to resize them. The divider between the search window and address bar is even worse. Resizing column widths (in "details" view) is pretty painful, too.
I have a high DPI 13" laptop and you have to be within a nanometer of the window edge to get the handle up.   It was the same in Win 8.
thanks

A: Search in your registry for the value
Computer\HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics
double click on BorderWidth and increase the negative value, which usually is something like -13. You'll might have to test some settings, but a value between -100and -200 should do the job. Maybe even less, according to your preferences.
You might have to restart for the change to be effective.
Answer adapted from this article

A: There are various solutions to this problem.
Using a larger mouse cursor might help a bit, in
Control Panel > Mouse > Pointers.
Changing the border widths could help, but has its gotchas.
You may read about it in the post
How to change border width in MS Windows to grab and resize it?
I would counsel rather to use third-party products, some are listed below.
They allow one to move and resize windows, even ones that
have no borders or title.
X-Window Manager like dragging and resizing of windows
This old program still works flawlessly. It uses the Alt
key like this:

*

*Alt+Right-click dragging resizes
the clicked window

*Alt+Left-click dragging moves
the clicked window

Window Manipulator
Similar, but uses Alt+R which is
somewhat more awkward to use.

redpajama_set_name: RedPajamaStackExchange


text:
Q: RStudio no muestro import dataset por URL Acabo de empezar con un curso de R y estoy en la parte de importar datos, en el curso sale la opcion de importar desde una URL-

Pero en mi Rstudio no sale, esto se debe a que me falta algun package? la version que instale (ultima) ya no permite ese tipo de importe?

Puedo hacerlo por comando solo que no me sale la opcion desde el import:
> sample <- read.table("http://aprender.uib.es/Rdir/pearson.txt", header=TRUE, quote="\"")
> View(sample)

A: Si mal no recuerdo esta opción fue reemplazada hace tiempo por "From text (readr)...", en la cual puedes indicar la url a importar, haces click en el botón "update" para leer la misma y luego es solo configurar las opciones adecuadas, esto además te genera el código para copiar en el script si lo necesitarás.


text:
Q: Roxygen: Defaulting help to another function I'm writing the help for one function, and I would like a second function to display the same help file. How do I do this in Roxygen/devtools?
For example, consider the following:
We first have a function with a full helpfile
#' Plot random points
#' @param color Color of random points
#' @export
plotRandomPoints = function(color = "red"){
   plot(NA, xlim = c(0, 10), ylim = c(-2,2))
   drawRandomPoints(col = color)
}

Now we have a second function we want to just share the same help file
#' <link to plotRandomPoints>
#' @export
drawRandomPoints = function(color = "red"){
  points(rnorm(10), col = color)
}

How do we <link to plotRandomPoints>?

A: I believe the @rdname tag is what you're looking for. If you change the second code block to this
#' @rdname plotRandomPoints
#' @export
drawRandomPoints = function(color = "red"){
 points(rnorm(10), col = color)
}

the resulting help file should include both plotRandomPoints() and drawRandomPoints()


text:
Q: disable-randomization in gdb doesn't work The gdb variable disable-randomization is ON, but still the memory address of a variable changes on different run.
First run:
(gdb) p &g[v].bIsDummyVertex
$13 = (bool *) 0x143d6a7c

Second run:
(gdb) p &g[v].bIsDummyVertex
$13 = (bool *) 0x143d63e4

I was expecting the same value for the memory location because disable-randomization is on.


text:
Q: Performance Explanation: code runs slower after warm up The code below runs the exact same calculation 3 times (it does not do much: basically adding all numbers from 1 to 100m).
The first 2 blocks run approximately 10 times faster than the third one. I have run this test program more than 10 times and the results show very little variance.
If anything, I would expect the third block to run faster (JIT compilation), but the typical output is:

35974537
  36368455
  296471550

Can somebody explain what is happening? (Just to be clear, I'm not trying to fix anything here, just trying to better understand what is going on)
Note:

*

*no GC is run during the program (monitored with -XX:+PrintGC)

*tested with Oracle JDK versions 1.6.0_30, 1.7.0_02 and 1.7.0_05

*also tested with the following parameters: -XX:+PrintGC -Xms1000m  -Xmx1000m -XX:NewSize=900m => same result

*it the block is put in a loop instead, all runs are fast

*if the block is extracted to a method, all runs are fast (whether the method is called 3 times or in a loop makes no difference)

public static void main(String... args) {
    //three identical blocks
    {
        long start = System.nanoTime();
        CountByOne c = new CountByOne();
        int sum = 0;
        for (int i = 0; i < 100000000; i++) {
            sum += c.getNext();
        }
        if (sum != c.getSum()) throw new IllegalStateException(); //use sum
        long end = System.nanoTime();
        System.out.println((end - start));
    }
    {
        long start = System.nanoTime();
        CountByOne c = new CountByOne();
        int sum = 0;
        for (int i = 0; i < 100000000; i++) {
            sum += c.getNext();
        }
        if (sum != c.getSum()) throw new IllegalStateException(); //use sum
        long end = System.nanoTime();
        System.out.println((end - start));
    }
    {
        long start = System.nanoTime();
        CountByOne c = new CountByOne();
        int sum = 0;
        for (int i = 0; i < 100000000; i++) {
            sum += c.getNext();
        }
        if (sum != c.getSum()) throw new IllegalStateException(); //use sum
        long end = System.nanoTime();
        System.out.println((end - start));
    }
}

public static class CountByOne {

    private int i = 0;
    private int sum = 0;

    public int getSum() {
        return sum;
    }

    public int getNext() {
        i += 1;
        sum += i;
        return i;
    }
}

A: You need to place each loop in a different method.  The reason you need to do this is that the JIT collections statistics on how the code was run and this is used to optimise the code.  However, a method is optimised after it is called 10000 time or a loop is run 10000 times.
In your case, the first loop trigger the whole method to be optimised, even though the later loops have not been run so no statistics have been collected.  Place each loop in its own method and this won't happen.

A: Short: The Just In Time Compiler is dumb.
First of all you can use the option -XX:+PrintCompilation to see WHEN the JIT is doing something. Then you will see something like this:
$ java -XX:+PrintCompilation weird
    168    1             weird$CountByOne::getNext (28 bytes)
    174    1 %           weird::main @ 18 (220 bytes)
    279    1 %           weird::main @ -2 (220 bytes)   made not entrant
113727636
    280    2 %           weird::main @ 91 (220 bytes)
106265475
427228826

So you see that the method main is compiled sometimes during the first and the second block.
Adding the options -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOption will give you more information about what the JIT is doing. Note, it requires hsdis-amd64.so which seems to be not very well available on common Linux distributions. You might have tom compile it on your own from the OpenJDK.
What you get is a huge chunk of assembler code for getNext and main.
For me, in the first compilation it seems that only the first block in main is actually compiled, you can tell by the line numbers. It contains funny things like this:
  0x00007fa35505fc5b: add    $0x1,%r8           ;*ladd
                                                ; - weird$CountByOne::getNext@6 (line 12)
                                                ; - weird::main@28 (line 31)
  0x00007fa35505fc5f: mov    %r8,0x10(%rbx)     ;*putfield i
                                                ; - weird$CountByOne::getNext@7 (line 12)
                                                ; - weird::main@28 (line 31)
  0x00007fa35505fc63: add    $0x1,%r14          ;*ladd
                                                ; - weird::main@31 (line 31)

(Indeed it is very long, due to unrolling and inlining of the loop)
Appearently during the recompile of main, the second AND third block is compiled. The second block there looks very similar to the first version. (Again just an excerpt)
 0x00007fa35505f05d: add    $0x1,%r8           ;*ladd
                                                ; - weird$CountByOne::getNext@6 (line 12)
                                                ; - weird::main@101 (line 42)
  0x00007fa35505f061: mov    %r8,0x10(%rbx)     ;*putfield i
                                                ; - weird$CountByOne::getNext@7 (line 12)
                                                ; - weird::main@101 (line 42)
  0x00007fa35505f065: add    $0x1,%r13          ;*ladd

HOWEVER the third block is compiled differently. Without inlining and unrolling
This time the entire loop looks like this:
  0x00007fa35505f20c: xor    %r10d,%r10d
  0x00007fa35505f20f: xor    %r8d,%r8d          ;*lload
                                                ; - weird::main@171 (line 53)
  0x00007fa35505f212: mov    %r8d,0x10(%rsp)
  0x00007fa35505f217: mov    %r10,0x8(%rsp)
  0x00007fa35505f21c: mov    %rbp,%rsi
  0x00007fa35505f21f: callq  0x00007fa355037c60  ; OopMap{rbp=Oop off=580}
                                                ;*invokevirtual getNext
                                                ; - weird::main@174 (line 53)
                                                ;   {optimized virtual_call}
  0x00007fa35505f224: mov    0x8(%rsp),%r10
  0x00007fa35505f229: add    %rax,%r10          ;*ladd
                                                ; - weird::main@177 (line 53)
  0x00007fa35505f22c: mov    0x10(%rsp),%r8d
  0x00007fa35505f231: inc    %r8d               ;*iinc
                                                ; - weird::main@180 (line 52)
  0x00007fa35505f234: cmp    $0x5f5e100,%r8d
  0x00007fa35505f23b: jl     0x00007fa35505f212  ;*if_icmpge
                                                ; - weird::main@168 (line 52)

My guess is that the JIT identified that this part of the code is not used a lot, since it was using profiling information from the second block execution, and therefore did not optimize it heavily. Also the JIT appears to be lazy in a sense not to recompile one method after all relevant parts have been compiled. Remember the first compilation result did not contain source code for the second/third block AT all, so the JIT had to recompile that.


text:
Q: How to perform joins at particular ID using MongoDB and NodeJS As i'm a new bee to MongoDB, having difficulty in performing joins in collections. I need to join the two collections at particular ID. Actually i'm using models for the database purpose.
Collection 1
{

   "id" : "1",

   "user_id" : "101",

   "job_id" : "j1001"

}

{

   "id" : "2",

   "user_id" : "101",

   "job_id" : "j1002"

}

{

   "id" : "3",

   "user_id" : "101",

   "job_id" : "j1003"

}

Collection 2
{

   "id" : "1",

   "job_id" : "j1001",

   "name" : "Software engineer",

}

{

   "id" : "2",

   "job_id" : "j1002",

   "name" : "Project manager"

}

{

   "id" : "3",

   "job_id" : "j1003",

   "name" : "FullStack Developer"

}

I want to retrieve all the names in collection2 where the user_id is 101 in collection1
The expected result would be like this
{"Software engineer", "Project manager", "FullStack Developer"}

Any help is greatly appreciated. Thanks in Advance!

A: You can use $lookup stage with aggregate framework of MongoDB.
Syntax of the
{
   $lookup:
     {
       from: <collection to join>,
       localField: <field from the input documents>,
       foreignField: <field from the documents of the "from" collection>,
       as: <output array field>
     }
}

Example
db.collection1.aggregate([
   {
     $lookup:
       {
         from: "collection2",
         localField: "id1",
         foreignField: "reference id which will be same as id1",
         as: "Array_Docs"
       }
  }
])


text:
Q: Datetimes for Julia dataframes pandas has a number of very handy utilities for manipulating datetime indices. Is there any similar functionality in Julia? I have not found any tutorials for working with such things, though it obviously must be possible.
Some examples of pandas utilities:
dti = pd.to_datetime(
    ["1/1/2018", np.datetime64("2018-01-01"),
datetime.datetime(2018, 1, 1)]
)

dti = pd.date_range("2018-01-01", periods=3, freq="H")

dti = dti.tz_localize("UTC")

dti.tz_convert("US/Pacific")

idx = pd.date_range("2018-01-01", periods=5, freq="H")
ts = pd.Series(range(len(idx)), index=idx)
ts.resample("2H").mean()

A: Julia libraries have "do only one thing but do it right" philosophy so the layout of its libraries matches perhaps more a Unix (battery of small tools that allow to accomplish a common goal) rather then Python's.
Hence you have separate libraries for DataFrames and Dates:
julia> using Dates, DataFrames

Going through some of the examples of your tutorial:
Pandas
dti = pd.to_datetime(
    ["1/1/2018", np.datetime64("2018-01-01"), datetime.datetime(2018, 1, 1)]
)

Julia
julia> DataFrame(dti=[Date("1/1/2018", "m/d/y"), Date("2018-01-01"), Date(2018,1,1)])
3×1 DataFrame
 Row │ dti
     │ Date
─────┼────────────
   1 │ 2018-01-01
   2 │ 2018-01-01
   3 │ 2018-01-01

Pandas
dti = pd.date_range("2018-01-01", periods=3, freq="H")

Julia
julia> DateTime("2018-01-01")  .+ Hour.(0:2)
3-element Vector{DateTime}:
 2018-01-01T00:00:00
 2018-01-01T01:00:00
 2018-01-01T02:00:00

Pandas
dti = dti.tz_localize("UTC")

dti.tz_convert("US/Pacific")

Julia
Note that that there is a separate library in Julia for time zones. Additionally "US/Pacific" is a legacy name of a time zone.
julia> using TimeZones

julia> dti = ZonedDateTime.(dti, tz"UTC")
3-element Vector{ZonedDateTime}:
 2018-01-01T00:00:00+00:00
 2018-01-01T01:00:00+00:00
 2018-01-01T02:00:00+00:00

julia> julia> astimezone.(dti, TimeZone("US/Pacific", TimeZones.Class(:LEGACY)))
3-element Vector{ZonedDateTime}:
 2017-12-31T16:00:00-08:00
 2017-12-31T17:00:00-08:00
 2017-12-31T18:00:00-08:00

Pandas
idx = pd.date_range("2018-01-01", periods=5, freq="H")
ts = pd.Series(range(len(idx)), index=idx)
ts.resample("2H").mean()

Julia
For resampling or other complex manipulations you will want to use the split-apply-combine pattern (see https://docs.juliahub.com/DataFrames/AR9oZ/1.3.1/man/split_apply_combine/)
julia> df = DataFrame(date=DateTime("2018-01-01")  .+ Hour.(0:4), vals=1:5)
5×2 DataFrame
 Row │ date                 vals
     │ DateTime             Int64
─────┼────────────────────────────
   1 │ 2018-01-01T00:00:00      1
   2 │ 2018-01-01T01:00:00      2
   3 │ 2018-01-01T02:00:00      3
   4 │ 2018-01-01T03:00:00      4
   5 │ 2018-01-01T04:00:00      5
julia> df.date2 = floor.(df.date, Hour(2));

julia> using StatsBase

julia> combine(groupby(df, :date2), :date2, :vals => mean => :vals_mean)
5×2 DataFrame
 Row │ date2                vals_mean
     │ DateTime             Float64
─────┼────────────────────────────────
   1 │ 2018-01-01T00:00:00        1.5
   2 │ 2018-01-01T00:00:00        1.5
   3 │ 2018-01-01T02:00:00        3.5
   4 │ 2018-01-01T02:00:00        3.5
   5 │ 2018-01-01T04:00:00        5.0


text:
Q: Single link clustering I'm looking for a way to do single link clustering with OpenCV.  My scenario:

*

*Hundreds (potentially thousands) of feature vectors (vectors dimension can be up to ~800 features).

*Unknown number of clusters (likely to be much lower than the number of vectors).

*Fixed similarity threshold E - if the l1 norm between two vectors is less than E, then the vectors should be in the same cluster.

*I don't need a cluster to be compact.  That is, I don't need all the vectors in the cluster to be within E of each other.  This can lead to long "chains" instead of clusters, but I'm OK with this.

I tried using K-means, but because I don't know the number of clusters it's not really applicable here.  I could do iterative K-means and look for the best K, but it sounds inefficient.  Is there a more suitable clustering algorithm implemented in OpenCV that I could use here?
Ideally, I need something similar to the SLINK algorithm, as this is what is quoted in the paper that I'm currently trying to implement.  My options are to implement SLINK directly (a bit of a task, because of debugging & testing) or look for an existing algorithm that does something similar.
Any suggestions?

A: I'd suggest constructing a graph by your similarity threshold and finding connected components. Once you construct the graph, finding connected components will be fairly easy and efficient. If you like NetworkX already has a connected component function.

A: I ended up doing an implementation by myself:
import cv
def main():
    import sys
    x = cv.Load(sys.argv[1])
    epsilon = float(sys.argv[2])
    y = cv.CloneImage(x)
    labels = range(x.height)
    tmp = cv.CreateImage((x.width, 1), x.depth, x.nChannels)
    for i in range(x.height):
        cv.SetImageROI(x, (0, i, x.width, 1))
        for j in range(i+1, x.height):
            cv.SetImageROI(y, (0, j, x.width, 1))
            cv.AbsDiff(x, y, tmp)
            dist, _, _, _ = cv.Avg(tmp)
            if dist < epsilon:
                for k, lbl in enumerate(labels):
                    if lbl == j:
                        labels[k] = i

    for i, lbl in enumerate(labels):
        print i, lbl

if __name__ == '__main__':
    main()

x is a N x M matrix containing N vectors.  The dimensionality of a vector is M.  It basically compares each pair of vectors using the L1 norm, and considers a pair to be identical if their difference is less than epsilon.  This algorithm is very slow --- O(N^3), but it's good enough for me at the moment.


text:
Q: Can I use .getpoint for select position for top of cone I use this code for get point and a point that I select is the base of cone But I need to use a selected point to be a top of my cone that is drawing then.
conecenter = .GetPoint(, vbCr & "select position for base of cone:")

A: Yes, the .getpoint method merely prompts the user to specify an arbitrary point, either by selecting the point graphically, or entering the point coordinate values at the AutoCAD command line. As such, the user may specify any point in the current viewport.
To calculate the top of the cone, you will need to decrease the z-coordinate of the user-supplied point conecenter by half the cone height, e.g.:
conecenter(2) = conecenter(2) - coneheight / 2.0

This assumes that you have a variable called coneheight which represents the height of the cone.


text:
Q: In Go, given a location name, how can we determine the current time in that location? We can't use the offset returned by Zone():
package main

import "fmt"
import "time"

func main() {
    loc, _ := time.LoadLocation("America/Los_Angeles")
    t := time.Date(2015,04,12,19,23,0,0,loc)
    t2 := time.Date(2015,03,1,19,23,0,0,loc)
    _, offset := t.Zone()
    _, offset2 := t.Zone()
    fmt.Printf("t1: %v  offset: %d\n", t, offset)
    fmt.Printf("t2: %v  offset: %d\n", t2, offset2)
}

This returns:
t1: 2015-04-12 19:23:00 -0700 PDT  offset: -25200
t2: 2015-03-01 19:23:00 -0800 PST  offset: -25200

The offset does not reflect daylight savings.
Is parsing manually the offset after formatting a time instance the only option (-0700 and -0800)?
We can retrieve the current time with time.Now(), but using .In() simply changes the location without adjusting the hours and minutes.

A: Fix the bug in your program. For example,
package main

import "fmt"
import "time"

func main() {
    loc, _ := time.LoadLocation("America/Los_Angeles")
    t := time.Date(2015, 04, 12, 19, 23, 0, 0, loc)
    t2 := time.Date(2015, 03, 1, 19, 23, 0, 0, loc)
    _, offset := t.Zone()
    _, offset2 := t2.Zone()
    fmt.Printf("t1: %v  offset: %d\n", t, offset)
    fmt.Printf("t2: %v  offset: %d\n", t2, offset2)
}

Output:
t1: 2015-04-12 19:23:00 -0700 PDT  offset: -25200
t2: 2015-03-01 19:23:00 -0800 PST  offset: -28800


text:
Q: When do we use 2 equals when identifying the value of a variable? I'm learning how to use the LOVE engine, which uses Lua, but this engine cannot identify an error about, you know, if you need to do this:
if value=1 then

or
if value==1 then

to the engine identify a variable, so I'm asking this to prevent errors.

A: if value==1 then etc.
As you can read here https://www.lua.org/manual/5.1/manual.html#2.5.2 and here https://www.lua.org/pil/3.2.html or just here http://www.google.com/


text:
Q: custom blade command in laravel 5 i want to create directive in laravel5's blade similar self blade as below that capture content of betwen @X and @endX:
@can('blablabla')

xxxxxxx

@endcan

in fact i want helper that if return true show content of betwen @X and @endX
for example:
@if(a==10)

sssss


text:
Q: Problem deploying Cocoon within Tomcat I am trying to deploy cocoon (2.1.11) in Tomcat (7.0.12) (I know that I can run cocoon standalone and have done that successfully, but I am trying to better understand the whole web application environment) I have built the cocoon.war file, copied it to the tomcat/webapps directory and started tomcat.
All the web pages I have consulted explicitly say that this is all that is required.
I can see that the .war file is unpacked into a cocoon subdirectory, and cocoon shows up as one of the applications. But when I browse to this URL:
http://localhost:8080/cocoon

I get this Java traceback:
org.apache.cocoon.ResourceNotFoundException: No pipeline matched request: index.html
    at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:149)
    at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
    at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
    at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
    at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
    at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:254)
    at org.apache.cocoon.Cocoon.process(Cocoon.java:699)
    at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1154)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:636)

Can anyone help me to understand why?

A: I know this is years old,
I just used http://www.xml.com/lpt/a/1178 cocoon-soap.war on a tomcat 7.0.29 deployment and needed to modify sitemap.xmap to include a
 <map:match pattern="index.html">

as well as the following:
<map:match pattern="">
 <map:generate src="index.html"/>
 <map:serialize/>
</map:match>

A: This error usually occurs because you do not have your sitemap setup correctly.  do you have a generic .html pipeline declared in your sitemap.


text:
Q: The events are not getting removed when draggable attribute is set to false var attachEvents=(function(){
          var events="click mouseover mouseout mousedown mouseup mousemove keydown keyup dragstart dragend drag".split(" ");
          for(var i=0;i
            })(events[i]);
           }
      })();
        Object.prototype.draggable=function(f){
          this.setAttribute("draggable",f);
          var currentX,currentY,clickX,clickY;
         function mouseMove(e){
         e.preventDefault();
         if(this.getAttribute("click")=="true"){
            currentX+=e.clientX-clickX;
            currentY+=e.clientY-clickY;
            clickX+=e.clientX-clickX;
            clickY+=e.clientY-clickY;
            if(this.hasAttribute("cx")){
             this.setAttribute("cx",currentX);
             this.setAttribute("cy",currentY);
            }
            else{
             this.setAttribute("x",currentX);
             this.setAttribute("y",currentY);
            }

             }
         };
        function mouseDown(e){
            e.preventDefault();
            this.setAttribute("click","true");
            click=true;
            clickX=e.clientX;
            clickY=e.clientY;
         };
       function mouseUp(){
            this.setAttribute("click","false");
        };
        if(this.getAttribute("draggable")=="true"){
         if(this.hasAttribute("cx")){
             currentX=Number(this.getAttribute("cx"));
             currentY=Number(this.getAttribute("cy"));
             this.mousedown(mouseDown);
             this.mouseup(mouseUp);
             this.mousemove(mouseMove);
         }
         else{
             currentX=Number(this.getAttribute("x"));
             currentY=Number(this.getAttribute("y"));
             this.mousedown(mouseDown);
             this.mouseup(mouseUp);
             this.mousemove(mouseMove);
         }
      }
      else if(this.getAttribute("draggable")=="false"){
          this.unmousedown(mouseDown);
          this.unmouseup(mouseUp);
          this.unmousemove(mouseMove);
      }
  };


text:
Q: Dynamically call Func with Emit i am trying to create functions dynamically that when executed just calls a given Func
 public IProxifier<T> Override(string method, Func<T, object[], object> handler)
    {
        if (!overr.ContainsKey(method))
        {
            Ops op = new Ops();
            op.GenericTypes = new Type[] { typeof(T) };
            op.MethodInfo = handler.GetMethodInfo();

            MethodBuilder mb = tb.DefineMethod(method, MethodAttributes.Public | MethodAttributes.ReuseSlot |
                    MethodAttributes.Virtual | MethodAttributes.HideBySig, typeof(object), new Type[] { typeof(object[]) });

            ILGenerator il = mb.GetILGenerator();

            //il.EmitCall(OpCodes.Callvirt, op.MethodInfo, op.GenericTypes);
            il.Emit(OpCodes.Ldarg_0);
            il.Emit(OpCodes.Callvirt, handler.GetMethodInfo());
            il.Emit(OpCodes.Ret);
            overr.Add(method, op);
        }
        return this;

    }

I am creating a dynamic type using reflection, and everytime this Override method is called i need to create in this Dynamic created object the given method (overriding the prexisting one, i.e ToString() ).
I Have tried in various ways with Emit and EmitCall but all i have been getting is either InvalidProgramException or nothing at all.
What i am trying to achieve is:

*

*For a given Func, to override a method, that when it is called this Func is instead triggered and its result returned, all with ILGenerator. How can i do this? i have been stuck for days and nothing works.

A: First problem is that when you calling method in IL it always take as first parameter object for which method should be called. For static method this parameter is null but it still should be present. So first fix is load null to stack before other parameters:
il.Emit(OpCodes.Ldnull); // method object parameter
il.Emit(OpCodes.Ldarg_0);
il.Emit(OpCodes.Callvirt, handler.GetMethodInfo());
il.Emit(OpCodes.Ret);

Second problem is that according to handler type you trying to call method that requires parameters of type T and object[] in stack before you call it. Currently you only loading second parameter of type object[] so you also should parameter with type T.
Depending on what you are trying to do you can solve it in tree different ways:
Simplest option is to add parameter T to generated method:
MethodBuilder mb = tb.DefineMethod(method, MethodAttributes.Public |
    MethodAttributes.ReuseSlot | MethodAttributes.Virtual | MethodAttributes.HideBySig,
    typeof(object), new Type[] { typeof(T), typeof(object[]) });

And then use it's value for calling Func:
il.Emit(OpCodes.Ldnull);  // method object parameter
il.Emit(OpCodes.Ldarg_0); // first parameter of type T
il.Emit(OpCodes.Ldarg_1); // second parameter of type object[]
il.Emit(OpCodes.Callvirt, handler.GetMethodInfo());
il.Emit(OpCodes.Ret);

If you can't change dynamic method signature you can remove T from Func parameter and path it as another parameter to Override method:
public IProxifier<T> Override(string method, T someName, Func<object[], object> handler)

If you also can't change signature for Func but you don't use value of T in it, you can just load default value to stack. It could be done easily for reference types by loading null:
il.Emit(OpCodes.Ldnull);  // method object parameter
il.Emit(OpCodes.Ldnull);  // first parameter of type T
il.Emit(OpCodes.Ldarg_1); // second parameter of type object[]
il.Emit(OpCodes.Callvirt, handler.GetMethodInfo());
il.Emit(OpCodes.Ret);

But for value types it becomes a bit trickier, you should declare local variable with this type initialize it, then call initobj instruction to create value and then load it into stack:
il.Emit(OpCodes.Ldloca_S, generator.DeclareLocal(typeof(T)); //create local variable
il.Emit(OpCodes.Initobj, typeof(T)); //initialize it with default value

il.Emit(OpCodes.Ldnull);  // method object parameter
il.Emit(OpCodes.Ldloc_0); // first parameter of type T from local variable
il.Emit(OpCodes.Ldarg_0); // second parameter of type object[] from argument

il.Emit(OpCodes.Call, handler.GetMethodInfo());
il.Emit(OpCodes.Ret);


text:
Q: Spring Boot 2.0.0.M6 and file upload more than 10 MB To my Spring Boot 2.0.0.M6 application.properties I have added the following lines:
spring.http.multipart.max-file-size=100MB
spring.http.multipart.max-request-size=100MB

but when I try to upload to my RestController the 21MB file it fails with the following exception:
Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (21112803) exceeds the configured maximum (10485760)

I run my application on Embedded Tomcat packaged with Spring Boot.
How to properly configure my application in order to allow file upload up to 100MB?

A: As shown in the documentation, and in its appendix, the correct  properties are spring.servlet.multipart.max-file-size and spring.servlet.multipart.max-request-size.

A: For SpringBoot 1.5.7 till or before 2.1.2 the property need to set in application.properties file are:
spring.http.multipart.max-file-size=100MB
spring.http.multipart.max-request-size=100MB

Also make sure you have application.properties file in "resources" folder. In case you are not sure with the size then "-1" is the value.

A: spring.servlet.multipart.max-file-size=1000MB
spring.servlet.multipart.max-request-size=1000MB

spring.http.multipart.max-file-size=50MB
spring.http.multipart.max-request-size=50MB

Above both the way not working in my version(1.3.4) also,
So that i used following way and it's working,
multipart.enabled=true
multipart.max-file-size=100MB
multipart.max-request-size=100MB

A: For Spring boot version 2.4.3 and after this version use this
spring.servlet.multipart.max-file-size=-1 spring.servlet.multipart.max-request-size=-1


text:
Q: C# panorama view 2 titles is it possible to give the panorama view with 2 pages, separate titles? for page 1 example "Heading 1" and page 2 "Heading 2", but not using the subheadings for each panorama item, but the title property of the main panorama control
thanx

A: You could set the text of the title to nothing. Then use the Margin property of the subheadings to move them up to where the title would be.
When setting the margin put the second number as a negative to move the object up the page. (Example: Margin="0,-50,0,0")

A: I think you shouldn't do this. This isn't with the guidelines
But maybe you can try it without a Title. just using the Subheadings and Pivot Controls in the panorama item content. But I think there is no guideline for doing this^^


text:
Q: Can't import local python module I retrieved the source code of an existing project, even though, while I'm running it it gives me an error while trying to import a module named "geo". The line where the error occurs is:
from . import geo

The error:
ImportError: cannot import name geo

I'm running the project using Python 2.7 in a miniConda virtual environnement.
Any suggestions ?
Thanks


text:
Q: Update only for non-blanks in KDB I have a query tab with column date with format yyyy.mm.dd. I want to convert these dates into the format yyyy-mm-dd and I can do it successfully below:
q) tab:update date:{"0"^"-"sv'flip 4 -2 -2$'string`year`mm`dd$\:x}date from tab

However, some values in my column are blank and I will get 0000-00-00 for these values. From this answer I understand I probably can just replace them with blanks, but it does not seem to be very efficient:
date[; "0000-00-00"; ""]

I was wondering if someone can point me in the right direction to update the whole column only for non-blank values? I am guessing it is something along the lines of [date not like ""] but I just can't get it to work with my update statement as a single command. Thank you.

A: Perhaps something like this?
q)update date:{"-" sv "." vs string x}'[date] from tab
date
------------
"2020-07-16"
""
"2020-07-15"

A: you can circumvent this issue altogether by changing the way you parse the dates:
q)t:([]date:`date$(10?100),0N)
q)t
date
----------
2000.01.20
2000.01.18
2000.03.28
2000.03.23
2000.02.15
2000.02.10
2000.02.02
2000.02.07
2000.01.26
2000.02.08

q)update ssr[;".";"-"]each string date from t
date
------------
"2000-01-20"
"2000-01-18"
"2000-03-28"
"2000-03-23"
"2000-02-15"
"2000-02-10"
"2000-02-02"
"2000-02-07"
"2000-01-26"
"2000-02-08"
""

This uses the ssr function on each date to simply replace each "." with a "-".

A: To answer your original question, the reason why an update statement with a where clause isn't working is because your original column is of type date. The update statement would only convert a subset of this column to type string, resulting in a mixed list, which is not compatible with the column of type date. To avoid this, while still using your original code, you can use a conditional vector update (https://code.kx.com/q/ref/vector-conditional/)
q)tab:([]date:(3?.z.d),2#0Nd)
q)parseDate:{"0"^"-"sv'flip 4 -2 -2$'string`year`mm`dd$\:x}
q)update date:parseDate date from tab where not null date
'type
q)update date:?[not null date;parseDate date;count[i]#enlist""]from tab
date
------------
"2006-06-02"
"2017-05-31"
"2006-09-28"
""
""

The other solutions provided achieve the same goal and in a much more direct manner, so I would recommend using one of those.


text:
Q: Export PowerPoint slides into java.awt.Graphics2D i started a test to convert a ppt document to jpeg or png image. i use java to test.
follow the instruction on the apache web: http://poi.apache.org/slideshow/how-to-shapes.html#Render, and the code:
FileInputStream is = new FileInputStream("slideshow.ppt");
        SlideShow ppt = new SlideShow(is);
        is.close();

        Dimension pgsize = ppt.getPageSize();

        Slide[] slide = ppt.getSlides();
        for (int i = 0; i < slide.length; i++) {

            BufferedImage img = new BufferedImage(pgsize.width, pgsize.height, BufferedImage.TYPE_INT_RGB);
            Graphics2D graphics = img.createGraphics();
            //clear the drawing area
            graphics.setPaint(Color.white);
            graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height));

            //render
            slide[i].draw(graphics);

            //save the output
            FileOutputStream out = new FileOutputStream("slide-"  + (i+1) + ".png");
            javax.imageio.ImageIO.write(img, "png", out);
            out.close();
        }

in the ppt doc, i just type the "hello world", than i run the java program, and the png image generated successfully. but i open the image with ACDsee software to view the image, but the "helloworld" didn't appear in the png image. what is the matter? Can anyone here give me some advice? you can also test by yourself to look at the result, pls let me know if you have got the same result.

A: It appears that you aren't doing anything at all with your BufferedImage.  You are simply filling the image with white and saving it to a file.


text: Q: Variables in double parentheses in YAML file I am working on a pipeline and bumped into YAML file with multiple variables inserted with double parentheses, e.g. ((project_name)). Google surprisingly was not helpful with that. What can it mean/do? Based on studying the repository some of them refer to the global variables in the config directory, some however are nowhere to be found. Thanks for help, I am new to YAML!


text:
Q: Firebase Crash Reporting iOS - Unreadable Crashes - Upload Symbol Files? I'm trying to integrate Firebase Crash reporting for my iOS app. I am using Xcode 8.1, Swift 3 and the latest Firebase Crash reporting version as of 29/11/16.
I have installed Firebase Crash reporting via Cocoapods and have I gone through the limited setup guide from the documentation shown below where I added a run script with my Google App ID and the path to my Google Crash Key son file (Service account)

*

*Replace this with the GOOGLE_APP_ID from your GoogleService-Info.plist file
GOOGLE_APP_ID=1:my:app:id

*Replace the /Path/To/ServiceAccount.json with the path to the key you just downloaded
"${PODS_ROOT}"/FirebaseCrash/upload-sym "/Path/To/ServiceAccount.json"

I am not sure if I have implemented the second step correctly. I did this
    "${PODS_ROOT}"/FirebaseCrash/upload-sym "${SRCROOT}/******/GoogleCrashKey.json"

The problem I have is that my app crash reports are pretty unreadable. I believe I either need to upload a symbol file or I have got the second step wrong.

How would I upload the symbol files for crash reporting. I get this instruction when pressing the upload symbol file option in the Firebase Crash reporting console. However I am unsure how to implement it.
1: Using the command line, navigate to your Xcode project folder and run the following:
    ./Pods/FirebaseCrash/batch-upload  < service-account-file >  my_UUID

Any help would be great.
Thank you

A: I was making a mistake when I was trying to implement the second step. I had the Speech marks in the wrong place and had the whole file path as a string :(.
instead of doing this:
    "${PODS_ROOT}"/FirebaseCrash/upload-sym "${SRCROOT}/******/GoogleCrashKey.json"

I changed it to this:
     "${PODS_ROOT}"/FirebaseCrash/upload-sym "${SRCROOT}" /******/GoogleCrashKey.json"

My crash report now looks like the following:

Thanks for the help Martin. Much appreciated.

A: I had the same problem with the Firebase log - a bunch of unreadable information. After adding the symbol file, it worked fine.
Just in case someone is wondering how to add the symbol file, here is the link.


text:
Q: Issue with word-wrap property in HTML code Does anyone have idea why "word-wrap" not working in below html code?

<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" /><meta name=\"viewport\" content=\"width=341.0px, minimum-scale=1, word-wrap=break-all, maximum-scale=1, user-scalable=no, shrink-to-fit=no\" />HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHello

A: You have to use word-wrap: break-word;  CSS in body tag.

  <meta http-equiv=\ "content-type\" content=\ "text/html; charset=UTF-8\" />
  <meta name=\ "viewport\" content=\ "width=341.0px, minimum-scale=1, word-wrap=break-all, maximum-scale=1, user-scalable=no, shrink-to-fit=no\" />

HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHello


text:
Q: Issue getting my objects properties Hi guys I have just started learning to code and I have hit a road block in accessing the properties of the object I have created.
Here is my object.
var restaurantOrder = {
  "my entree": "cheeseburger",
  "my side": "fries",
  "the drink": "water"
};

I would like to get the value of entree however nothing I am trying seems to work  :(
Here is what I have tried.
var entreeValue = restaurantOrder.my entree;
var entreeValue = restaurantOrder[my entree];
var entreeValue = restaurantOrder.[my entree];
var entreeValue = restaurantOrder.["my entree"];

None of the above lines work :( Thank you for your help.

A: Because the properties of your restaurantOrder object have spaces, you will need to use [] to access them. You cannot use . like you can with a property name that is a single word.
Also, because of the spaces you will need to enclose the property name with quotes, so either:
var entreeValue = restaurantOrder["my entree"];

or
var entreeValue = restaurantOrder['my entree'];

will work.


text:
Q: RabbitMQ Automatic Consuming I've write python file to write somethin in database.
This task is adding in RabbitMQ queue.
How can DB automatically consume task From Queue ??

import MySQLdb
from celery import Celery
import pika

app2 = Celery('task2', broker='amqp://guest@localhost//')

@app2.task(queue='Test')
def update_db():
    # Open database connection
    db = MySQLdb.connect("localhost","root","root","test" )

    # prepare a cursor object using cursor() method
    cursor = db.cursor()

    # Prepare SQL query to DELETE required records
    sql = "insert into tt values(1,'james')"
    #print sql
    # Execute the SQL command
    cursor.execute(sql)
    # Commit your changes in the database
    db.commit()
        # disconnect from server
    db.close()

A: You have to run a celery worker which will listen to the queue and execute your code
http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html#running-the-celery-worker-server


text:
Q: Why does the output seem rotated? I'm wanting to create a 2D pixel like platformer using pygame and I've stumbled across this issue where the output seems to be rotated from what the pixel array shows. Could anyone explain why it seems rotated?
I have this array that is basically like a level designer where each digit represents a different pixel on the game.
[
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 1, 0, 0, 1, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0],
]

I also have this function that loops through each row and in that row each digit and gets the value and creates a rectangle with the color for the corresponding color for that digit at the specific index.
color = (0, 0, 0)
for x in range(len(level)):
    for y in range(len(level[x])):
        value = level[x][y]
        if value == 1:
            color = (255, 255, 255)
        elif value == 0:
            color = (0, 0, 0)
        pygame.draw.rect(win, color, (x * BLOCK_SIZE, y * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE))

and the output is this

but you can cleary see that the 1's in the array are in the same row not stacked on eachother...
can anyone explain?

A: The axis are inverted so instead of x, y like a normal plain, it is y, x and that is why it it looks rotated.


text:
Q: Update an object creates new object in stripes Whenever want to update an object,view by Id is fetching the detch clean object but when saving after the changes,stripes creates an object by setting fields value's one by one.so state of the object getting transient.
So,I want to ask is there any way to use the same object which has been fetched from database and after modification saving the same with its detached dirty state?
as because for new object it will always have transient state.
I am using stripes,Datanueclus JDO,google app engine,java


text:
Q: undefined method merge_wrapper_options I am trying to use a fake input for Simple form as documented here: https://github.com/plataformatec/simple_form/wiki/Create-a-fake-input-that-does-NOT-read-attributes.
f.input :address, as: :fake

However, I get an error "undefined method `merge_wrapper_options' for #". I get this error even after restarting the rails server.
Please help me solve this.
Thanks.

A: Summary
The instance method merge_wrapper_options is defined on the SimpleForm::Inputs::Base class, but not until version 3.1.0.rc1.
Here's the relevant source code for version 3.0.2 (no merge_wrapper_options):
https://github.com/plataformatec/simple_form/blob/v3.0.2/lib/simple_form/inputs/base.rb
Contrast this with version 3.1.0.rc1:
https://github.com/plataformatec/simple_form/blob/v3.1.0.rc1/lib/simple_form/inputs/base.rb
So if you're at v3.0.2 or prior, you won't have it. But, no big deal, just define the method yourself:
Code
/app/inputs/fake_string_input.rb
class FakeStringInput < SimpleForm::Inputs::StringInput

  # Creates a basic input without reading any value from object
  def input(wrapper_options = nil)
    merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
    template.text_field_tag(attribute_name, nil, merged_input_options)
  end # method

  def merge_wrapper_options(options, wrapper_options)
    if wrapper_options
      options.merge(wrapper_options) do |_, oldval, newval|
        if Array === oldval
          oldval + Array(newval)
        end
      end
    else
      options
    end
  end # method

end # class

/app/views/some_form.html.haml
= f.input :some_parameter,
  label:      false,
  as:         :fake_string,
  input_html: { value: 'some-value' }

The POST request will contain:
Parameters: {"utf8"=>"✓", "some_parameter"=>"some-value" }


text:
Q: Safely truncating a string in C# that may be `null` I have the following method but it fails if the string is null. How could I make it just return a null if the string is null?
public static string Truncate(this string value, int maxChars)
{
    return value.Length <= maxChars ?
           value :
           value.Substring(0, maxChars) + " ..";
}

Could someone also explain to me what the "this" is there for. Sorry I'm not so good at C# and this is not my code.

A: By checking for null and returning appropriately :)
public static string Truncate(this string value, int maxChars)
{
    if (value == null)
    {
        return null;
    }
    return value.Length <= maxChars ?
           value : value.Substring(0, maxChars) + " ..";
}

Or you could even use another conditional:
public static string Truncate(this string value, int maxChars)
{
    return value == null ? null
        : value.Length <= maxChars ? value
        : value.Substring(0, maxChars) + " ..";
}

A: In addition to Jon Skeet's good anwer you wanted to know what the this is for. This makes this method an extension method. You extend the functionality of the string class with your specific function. this string value is the magic for Visual Studio to show you this function in the context menu for every string variable and for the compiler to give the variable, the method is called on as the first parameter to it. The function has to be static.

A: Put a try catch block. If it triggers, return null.


text:
Q: How do I set the default value of a TkInter widget? I have a Checkbutton that I need ticked as a default when I open the window. Setting the variable to the on value doesn't seem to work, so what should I do?
Here is a short, self contained example of what yields an unticked checkbox.
#!/usr/bin/python3

from tkinter import ttk
from tkinter import *
class Sizzle(Frame):

    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent

        self.initUI()
    def initUI(self):
        self.parent.title("Sizzle")
        self.style = ttk.Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)
        ifalphagrams=BooleanVar()
        b=Checkbutton(self, variable=ifalphagrams, onvalue=True, offvalue=False)
        b.grid(row=1,column=3 ,sticky=W)
        b.select()
def main():

    root = Tk()
    root.geometry("700x700+700+700")
    app = Sizzle(root)
    root.mainloop()
if __name__ == '__main__':
    main()

A: Most likely you're using a local variable to hold the reference to the StringVar, and it's getting garbage collected. When you prevent the variable from being garbage-collected your code works fine:
from Tkinter import *

class Example(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        ifalphagrams = StringVar()
        alp = Checkbutton(self, variable=ifalphagrams, onvalue='yes', offvalue='no')
        alp.grid(row=1,column=3, sticky=W)
        alp.select()
        self.ifalphagrams = ifalphagrams

if __name__ == "__main__":
    root = Tk()
    Example(root).pack(fill="both", expand=True)
    root.mainloop()


text:
Q: Using the value of a string to cast an object I have to cast an object to a type which is contained in a string and I don't know if it's possible.
My class is in a string :
NSString *myClass = @"User";

and I have an object that I want to cast with this type.
object = (myClass)object; // Doesn't work
object = (myClass *)object; // Doesn't work

How can I do that ?

A: There's no point to doing this — objects' static types only get checked at compile time, and this could only happen at runtime even if there were a way to do it (since objects such as strings don't actually exist until runtime).
If you're trying to change the object from one class to another, that wouldn't work anyway — casting from one pointer type to another only lies to the compiler about what type of data it points to, it doesn't actually change the data. In order to convert objects from one type to another, there has to be a method or function that takes the data from the old object and creates a new object of the desired type (such as NSString's dataUsingEncoding: to convert from NSString to NSData).
But if you have a dynamically selected class and you need some type to give the variables for instances of that class, you can just use id (possibly with a protocol if all the possible classes respond to the same messages).


text:
Q: Java: Adding to a list of lists Consider the following declaration...
List<List<Person>> groups;
I can add to this list by saying groups.add(new Person(John));
Is there any way I can add to the inner list rather than the outer one?

A: List<List<Person>> groups; basically says that each item in the list is a list of Person.
This means that in order to add a Person to the list, you need to first create a List for the element you want to add...
List<Person> person = //...
groups.add(person);

When you want to add a Person to this inner list, you need a reference to it...
Person aPerson = //...
groups.get(0).add(aPerson);

For example...
Updated based on comments
A Map might be a better solution for "grouping" like items, for example...
Map<String, List<Person>> groups = new HashMap<>();
List<Person> persons = groups.get("family");
if (persons == null) {
    persons = new ArrayList<>(25);
    groups.put("family", persons);
}
persons.add(aPerson);

This is a VERY basic example, but help you getting started...A walk through the Collections trail might also help

A: actually you cannot do groups.add(new Person(John));
you can do:
ArrayList<Person> t = new ArrayList<Person>();
t.add(new Person());
groups.add(t)

A: With List<List<Person>> groups; you cannot do groups.add(new Person(John)); because groups is a List<List..> and not List<Person>.
What you require is get-and-add:
List<List<Person>> groups;
//add to group-1
groups = new ArrayList<List<Person>>();
//add a person to group-1
groups.get(0).add(new Person());

//Or alternatively manage groups as Map so IMHO group fetching would be more explicit
Map<String, List<Person>> groups;
//create new group => students,
groups = new HashMap<String, List<Person>>();//can always use numbers though
groups.put("students", new ArrayList<Person>());

//add to students group
groups.get("students").add(new Person());

A: You could define a generic double list class to do it for you. Obviously you can extend this if you have certain business logic that will help you figure out internally which list to add to (without giving the index).
import java.util.*;

public class DoubleList<T>
{
    private List<List<T>> list;

    public DoubleList()
    {
        list = new ArrayList<List<T>>();
    }

    public int getOuterCount()
    {
        return list.size();
    }

    public int getInnerCount(int index)
    {
        if (index < list.size())
        {
            return list.get(index).size();
        }
        return -1;
    }

    public T get(int index1, int index2)
    {
        return list.get(index1).get(index2);
    }

    public void add(int index, T item)
    {
        while (list.size() <= index)
        {
            list.add(new ArrayList<T>());
        }
        list.get(index).add(item);
    }

    public void add(T item)
    {
        list.add(new ArrayList<T>());
        this.add(list.size() - 1, item);
    }
}

Then you use it like this:
DoubleList<String> mystrs = new DoubleList<String>();

mystrs.add("Volvo");
mystrs.add(0, "Ferrari");

mystrs.add(1, "blue");
mystrs.add(1, "green");

mystrs.add(3, "chocolate");

for (int i = 0; i < mystrs.getOuterCount(); i++)
{
    System.out.println("START");
    for (int j = 0; j < mystrs.getInnerCount(i); j++)
    {
        System.out.println(mystrs.get(i,j));
    }
    System.out.println("FINISH");
}


text:
Q: c++ define directive fails and code looks OK I am trying to build the mongo-cxx-driver library
mmuratet@fisher:~/mongo-cxx-driver/build$ cmake --prefix=/usr/local ..
-- No build type selected, default is Release
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mmuratet/mongo-cxx-driver/build

mmuratet@fisher:~/mongo-cxx-driver/build$ make
[  3%] Built target EP_mnmlstc_core
[ 10%] Built target bsoncxx
[ 16%] Built target bsoncxx_static
[ 21%] Built target test_bson
[ 22%] Building CXX object src/mongocxx/CMakeFiles/mongocxx.dir/bulk_write.cpp.o
In file included from /usr/local/include/libbson-1.0/bson-compat.h:38:0,
             from /usr/local/include/libbson-1.0/bson.h:23,
             from /home/mmuratet/mongo-cxx-driver/src/mongocxx/private/libbson.hpp:17,
             from /home/mmuratet/mongo-cxx-driver/src/mongocxx/bulk_write.cpp:18:
/usr/local/include/libbson-1.0/bson-macros.h:48:28: error: expected declaration before '}' token
 #  define BSON_END_DECLS   }
                        ^
/usr/local/include/libmongoc-1.0/mongoc-stream-tls-private.h:61:1: note: in expansion of macro 'BSON_END_DECLS'
 BSON_END_DECLS

^
        make[2]: * [src/mongocxx/CMakeFiles/mongocxx.dir/bulk_write.cpp.o] Error 1
        make[1]: * [src/mongocxx/CMakeFiles/mongocxx.dir/all] Error 2
        make: *** [all] Error 2
and get the error above.
Here is the offending code (line #s added by less):
 46 #ifdef __cplusplus
 47 #  define BSON_BEGIN_DECLS extern "C" {
 48 #  define BSON_END_DECLS   }
 49 #else
 50 #  define BSON_BEGIN_DECLS
 51 #  define BSON_END_DECLS
 52 #endif

This code looks OK to me. Can someone point out what I have missed? Could there be a problem upstream in the includes? How would one go about finding it?
Cheers

A: It appears that you're using libmongoc from the master branch, which appears to have a bug where that BSON_END_DECLS isn't paired with a BEGIN_DECLS above (it was dropped out by accident in a previous commit)
I've filed a bug at: https://jira.mongodb.org/browse/CDRIVER-1162
The 1.3.4 tag is an actual stable release and doesn't appear to have the same problem.


text:
Q: I'm trying to print sum and average of three numbers taken from user. Program's not running properly .data

prompt: .asciiz "Enter number 1: "
prompt2: .asciiz "Enter number 2: "
prompt3: .asciiz "Enter number 3: "
newline: .asciiz "\n"

fnum: .asciiz "Average is: "
snum: .asciiz "Sum is: "

.text
.globl main

main:
li $v0, 4
la $a0, prompt
syscall

li $v0, 5
syscall
move $t1, $v0
li $v0, 4
la $a0, prompt2
syscall

li $v0, 5
syscall
move $t2, $v0

li $v0, 4
la $a0, prompt3
syscall

add $t4,$t1,$t2
add $t4,$t4,$t3

li $v0, 4
la $a0, snum
syscall

move $a0, $t4
li $v0, 1
 syscall

li $v0, 4
la $a0, newline
syscall

li $t5,3
div $t6, $t4,$t5

move $a0, $t6
li $v0, 1
syscall

A: you didn't read the numbers from the console and store them in registers. Fixed your code and it should be working now. Added comments for you to understand.
.data

prompt: .asciiz "Enter number 1: "
prompt2: .asciiz "Enter number 2: "
prompt3: .asciiz "Enter number 3: "
newline: .asciiz "\n"

fnum: .asciiz "Average is: "
snum: .asciiz "Sum is: "

.text
.globl main

main:
li $v0, 4
la $a0, prompt  #prompt for first number
syscall

li $v0, 5
syscall
move $t1, $v0    #read number from console and store in $t1

li $v0, 4
la $a0, prompt2   #prompt for first number
syscall

li $v0, 5
syscall
move $t2, $v0     #read number from console and store in $t2

li $v0, 4
la $a0, prompt3   #prompt for first number
syscall

li $v0, 5
syscall
move $t3, $v0     #read number from console and store in $t2

add $t4,$t1,$t2
add $t4,$t4,$t3

li $v0, 4
la $a0, snum   #sum string printing
syscall

move $a0, $t4
li $v0, 1        #print sum value
syscall

li $v0, 4
la $a0, newline    #print newline string
syscall

li $t5,3
div $t6, $t4,$t5

li $v0, 4
la $a0, fnum   #print average string
syscall

move $a0, $t6
li $v0, 1        #print average value
syscall

li $v0, 10
syscall


text:
Q: django issues between forms and models i am a beginner with Django. I want to ask how can i access a variable in forms.py to print out for the user. I know that models.py create the database for the user. The variable that i want to print it is a checkbox multiple choice field. I need to print the value of the multiplechoice in a table.The image is here
This is the Form.py:
class BacktestForm(forms.ModelForm):

     period_start = forms.DateField(initial=datetime.datetime.today().date() - datetime.timedelta(days=365+16), widget=forms.widgets.DateInput(format="%Y/%m/%d"), input_formats=["%Y/%m/%d"])
     period_end     = forms.DateField(initial=datetime.datetime.today().date() - datetime.timedelta(days=16), widget=forms.widgets.DateInput(format="%Y/%m/%d"), input_formats=["%Y/%m/%d"])

    market = forms.MultipleChoiceField(required=False,widget=CheckboxSelectMultiple, choices=MARKET_CHOICES)
    sector = forms.MultipleChoiceField(required=False,widget=CheckboxSelectMultiple, choices= MEDIA_CHOICES)
class Meta:
    model = Parameters

Models.py:
class Parameters(models.Model):
user        = models.ForeignKey(User)
title       = models.CharField('title', max_length=100, default='', blank=True, help_text='Use an indicative name, related to the chosen parameters')
type = models.CharField('forecast type', choices=FORECAST_TYPES, max_length=20, default="backtest")

#input characteristics
price_1_min             = models.FloatField('1. Price, min', default=0.1, validators=[MinValueValidator(0.1), MaxValueValidator(20000)])
price_1_max             = models.FloatField('1. Price, max', default=20000, validators=[MinValueValidator(0.1), MaxValueValidator(20000)])

This is my view.py for the button save:
def backtest(request, pk=None):

if pk is not None:
    param = get_object_or_404(Parameters, pk=pk, user=request.user)
    form = BacktestForm(request.POST or None, instance=param)
else:
    form = BacktestForm(request.POST or None)

    if request.method == 'POST':
    if form.is_valid():
        if 'save' in request.POST:
            obj = form.save(commit=False)
            obj.user = request.user
            obj.type = "backtest"
            obj.save()
            messages.info(request, 'Saved!')
            return redirect(obj.get_backtest_url())

A: Please post the full forms class. I don't see how your model and form is connected. I think you might need a modelform instead of a form if you want to access the model.
So the way to connect them would be like this
forms.py
from .models import Parameter
class ParameterForm(forms.ModelForm):
    market = forms.MultipleChoiceField(required=False,widget=CheckboxSelectMultiple, choices=MARKET_CHOICES)
    sector = forms.MultipleChoiceField(required=False,widget=CheckboxSelectMultiple, choices= MEDIA_CHOICES)

        class Meta:
            model = Parameters


text:
Q: Accessing variables from the aspx.cs class in my website! (ASP.NET Web Forms) My plan is to access waypoints from a database and show them in bing maps as a polyline.
The problem is the following: I have my default.aspx.cs class:
public partial class _Default : System.Web.UI.Page
{
    List<Waypoints> waypointList;
    IWaypointLogic waypointLogic;

    protected void Page_Load(object sender, EventArgs e)
    {
        waypointLogic = new WaypointLogic();
        waypointList = waypointLogic.GetWaypointsByTrackId(1);
    }
}

And now I want to access the waypointList in my default.aspx page.
I want to do something like:
<% foreach (GPS_Tracker.Entities.Waypoints waypoint in waypointList %>

But I can't access the waypointList like this, can I?

A: You can access it if you make it protected since the aspx markup generates a class that inherits your code behind. Also consider using some databound control if appropriate.

A: Change the scope of your field to protected. e.g.
protected List<Waypoints> waypointList;

A: try making your variables public.
public partial class _Default : System.Web.UI.Page
{
    public List<Waypoints> waypointList;//or protected
    public IWaypointLogic waypointLogic;//or protected

    protected void Page_Load(object sender, EventArgs e)
    {
        waypointLogic = new WaypointLogic();
        waypointList = waypointLogic.GetWaypointsByTrackId(1);
    }
}

EDIT:Also you can make them protected to access them, you can refer to George's comment on my answer for an explanation why you should use protected instead of public.


text:
Q: Converting date and/or time from character string in vb.net. Getting the diference of two times then update the table Here is my code:
Dim time_in As DateTime = Nothing
    Dim time_out As DateTime = Nothing
    Dim totalWorkHours As String = Nothing

    getQuery = "SELECT dtr.time_in, dtr.time_out FROM dtr, worker WHERE dtr.worker_id ='" & getWorkerID & "' AND worker.worker_id ='" & getWorkerID & "' AND dtr.time_out IS NOT NULL"
    getCommand = New SqlCommand(getQuery, cn)
    cn.Open()
    getReader = getCommand.ExecuteReader

    While getReader.Read

        time_in = (getReader.Item("time_in").ToString())
        time_out = (getReader.Item("time_out").ToString())

        totalWorkHours = DateDiff(DateInterval.Second, time_in, time_out) / 3600.0

    End While

    cn.Close()
    getReader.Close()

    getQuery = "UPDATE dtr SET dtr.hours_work ='" & totalWorkHours & "' WHERE dtr.worker_id ='" & getWorkerID & "' AND dtr.date ='" & Format(Date.Today, "yyyy-MM-dd") & "'"
    getCommand = New SqlCommand(getQuery, cn)
    cn.Open()
    getReader = getCommand.ExecuteReader
    cn.Close()
    getReader.Close()

I'm getting an unhandled exception in updating the table. What I'm working in my code is to get the total hours_work by getting the difference of two times time_in and time_out.
This is my table dtr
CREATE TABLE [dbo].[dtr] (
    [worker_id]  INT      DEFAULT (NULL) NULL,
    [time_in]    DATETIME DEFAULT (NULL) NULL,
    [time_out]   DATETIME DEFAULT (NULL) NULL,
    [date]       DATE     DEFAULT (NULL) NULL,
    [hours_work] DATETIME DEFAULT (NULL) NULL
);

A: So I'm wrong with the data type I used in database.
I used
[hours_work] DATETIME DEFAULT (NULL) NULL
instead of [hours_work] DECIMAL(18, 2) NULL
So problem solved. Thank you @jmcilhinney for giving me the answer.
What I did on my totalWorkHours I changed it to double and still doesn't work. So I changed it back to string then tried changing the data type on my database. So thank you again :D


text:
Q: google cloud CDN always serve my static file through only 1 IP I have my google bucket connect with a load balancer and CDN enabled in google cloud, but I really don't get how google CDN working for static file, checking in the log viewer i can see the "statusDetails: response_from_cache" and "cacheHit: true" so i can say that the CDN is working properly.
Trying to issue a request for the image in my google CDN bucket from a computer located in Europe, the file return from the frontend IP address of my load balancer. Also the same IP address served my image if i make the request from a computer located in Asia.
So the same IP address was used for serving my static image ignore the location where the request coming from, checking the log viewer again, i can see that both of the request has claimed to go through google CDN, again google log viewer tell me that CDN working properly.
i think that the CDN should serve the file from the nearest server to the end-users, what is the point for using google CDN if the file always served from only 1 single IP address for all user over the world?
I have a free account of cloudflare, once i configure my DNS, the image file go through cloudflare network and if i do the test as above, i will see my static image file returned from multiple IP address which is nearest to my end-users.
Could somebody help me to understand what is the purpose for using google CDN in this case ? did i miss something in the configuration process for google CDN?
Thanks a lot in advance.

A: *

*Google Cloud CDN uses Google's global edge network to serve content
closer to users and it leverages Google Cloud global external HTTP(S)
load balancers to provide routing, health checking, and Anycast IP
support. The HTTP(S) load balancing configuration specifies the
frontend IP addresses and ports on which Cloud CDN receives requests
and the backends that originate responses to those requests.

*Google CDN has a special feature of 'single anycast IP for the whole
network' letting all contents served through the load balancer
frontend IP resulting in low latency. So rather than having one load
balancer per region, you can simplify your architecture and have
every instance behind a single global load balancer. Also it has a
feature of HTTP/2 which supports the latest HTTP protocol for faster
performance. For additional information,  you can check here.

*Cloud CDN reduces latency by serving assets directly at Google's
network edge. To know more about the caching using Cloud CDN, refer
to this caching-overview docs.


text:
Q: How can I open the form that I created in HTML in a new window? I am trying to find out how to open a form (I already made in HTML) in a new pop-up window? I have tried many solutions and explanations, but nothing works? Here is my code:
<center>
<FORM NAME="tic" method="post" target="_blank">
<INPUT TYPE="button" NAME=".1.." class=".2.." value="    " style= "background-color:#00BFFF" onClick="if.......................
<INPUT TYPE="button" NAME=".1.." class=".2.." value="    " style= "background-color:#00BFFF" onClick="if.......................
<INPUT TYPE="button" NAME=".1.." class=".2.." value="    " style= "background-color:#00BFFF" onClick="if.......................
<INPUT TYPE="button" NAME=".1.." class=".2.." value="    " style= "background-color:#00BFFF" onClick="if.......................
<INPUT TYPE="button" NAME=".1.." class=".2.." value="    " style= "background-color:#00BFFF" onClick="if.......................
<INPUT TYPE="button" NAME=".1.." class=".2.." value="    " style= "background-color:#00BFFF" onClick="if.......................
<INPUT TYPE="button" NAME=".1.." class=".2.." value="    " style= "background-color:#00BFFF" onClick="if.......................
<INPUT TYPE="button" NAME=".1.." class=".2.." value="    " style= "background-color:#00BFFF" onClick="if.......................
<INPUT TYPE="button" NAME=".1.." class=".2.." value="    " style= "background-color:#00BFFF" onClick="if.......................
</form>
</center>

BTW: The dots are not actually in my code (which works the way I want it to). They are examples that are used in place of my code.


text:
Q: HAProxy being killed with more that 54,000 connections I am trying to run HAProxy (1.4.8) on a EC2 machine running Ubuntu 10.04. I need HAProxy to be able to handle many thousands of long-running persistent connections (websockets). With the current setup HAProxy gets killed at around 54,300 connections (roughly).
If I am running HAProxy in the foreground, the only output is "Killed". Am I right in thinking this is the Kernel killing the process? Is this because it is out of resources? Can I increase the resources?
The CPU and memory consumption are low with 50,000 connections, so I don't suspect either of these.
How can I prevent this from happening?

A: Switching to a 64-bit instance solved the problem. I'm guessing we were running into the per-process memory limit on a 32-bit instance.

A: You should check this answer from Wily Tarreau to the very same question:


text:
Q: Android Authentication. Сохранение данных пользователя Хочу реализовать Android client для веб сервиса.
Возник такой вопрос: как правильно сделать авторизацию что бы арр сохранял  данные пользователя ?
Есть для этого специальные либы или фреймворки ? Возможно ли это сделать при помощи Retrofit ?

A: Можно использовать механизм самого Android для хранения аккаунта вашего приложения, в которых можно хранить какие то кастомные данные. Советую почитать тут


text:
Q: What is the $X_{ij}\, Z_{.j}\,\gamma_{k0}\,\gamma_{0k}$ term in this equation of a multilevel regression from a paper? reading a sociology paper (https://link.springer.com/article/10.1007/s11577-015-0343-4, german) for a course today, I stumbled upon the following equation:

It's supposed to describe a 2-level "random intercept" (intercept-as-outcome) regression model where j denotes a level 2 group and i denotes level 1 case within a group. I take the sums to sum over the number of variables on each level respectively. Obviously terms 1, 3 und 5 stem from the level 2 equation. What I for the life of me can't figure out is the fourth term. Is that supposed to be an interaction? Are there two sum signs missing before it or where do the ks come from? Why is there a product of coefficients? What am I missing here?

A: I've had a look at the paper and (with the help of Google translate) concluded that this part is just terribly written. It's just really bad notation and spending time trying to figure out what the authors might or might not have meant is futile, IMO.
It's always good to at least do a cursory check of how reputable a journal is. The impact factor is flawed as a measure, but this journal has an IF of 0.393, which is in the bottom 14% of journals worldwide. Don't waste your time.


text:
Q: How to change proxy programmatically? I wish to test my web server which have checking to detect abusive API usage by IP address. One IP address is limited to a few hundred API calls per day.
As part of testing & simulation procedure, I need to be able to switch IP frequently & programmatically. How to do this? I am thinking of using publicly available free proxy service (or even TOR) to hide my IP. But I am not sure how to change the proxy settings programmatically.
I am using Ruby but any languages are welcome.

A: In ruby you can make calls to the command prompt. If I were you I would make a method that uses these calls. To do this use %x command.
Edit----
This is the code I made.
def ipChanger(name,ip)
    return %x(netsh interface ip set address #{name} static #{ip} 255.255.255.0)
end

The syntax is "netsh interface ip set address "Your adapter name here" static "new ip" "new netmask" "optional default gateway"


text:
Q: Migrate MySQL to PostgreSql and share tables I want to use PgSql in my new proyect, but I have old tables I need to use. Which is the best way to share tables between both databases? Is there any way of synchronizing several tables between databases?

A: You can use SQLWays that convert T/SQL stored procedure, function, trigger, database schema (DDL) and data from Microsoft SQL Server to PostgreSQL.
See this link : Migrate from MySQL  to PostgreSQL
or
Full Convert 6.4
You can find more solutions at Database Administrator or ServerFault.
See this: Dba Administrator


text:
Q: Polynomial invariants for unoriented links I have seen that usually one finds polynomial invariants for oriented links (for example the Jones polynomial, the Hompfly polynomial). Does anyone know what polynomial invariants exist for non-oriented links?
Thank you for the help.
Update
I have found out that there exists another polynomial, not mentioned in the other answers/comments. It is the BLM/Ho polynomial. One can read the definition in the original papers (Brandt, R. D.; Lickorish, W. B. R.; and Millett, K. C. "A Polynomial Invariant for Unoriented Knots and Links." Invent. Math. 84, 563-573, 1986; Ho, C. F. "A New Polynomial for Knots and Links--Preliminary Report." Abstracts Amer. Math. Soc. 6, 300, 1985) or http://mathworld.wolfram.com/BLMHoPolynomial.html

A: Colored Kauffman polynomials are independent of orientations of links. If you look at the skein relation of Kauffman polynomial, there is no arrow. This is true for colored cases. Kauffman polynomials are related to SO(N) quantum knot invariants by substitution $q^{N-1}=a$. Since the representations of SO(N) are pseudo-real, they are independent of orientation.

A: Let $\mathfrak g$ be a simple Lie algebra, $U_q(\mathfrak g)$ the corresponding quantum group and $V$ a simple module over it. From this you get an invariant of framed oriented links. Now since $V$ is simple, it depends on the framing only up to scalar multiplication, so there is a standard way to renormalize your invariant so that it becomes an invariant of oriented links.
Now assume that $V$ is self-dual, ie that there exists a $U_q(\mathfrak g)$-module isomorphism $V\rightarrow V^*$. If you fix one of those isomorphism you can compose it with the evaluation and coevaluation to get maps $V\otimes V\rightarrow \mathbb{C}$ and $ \mathbb{C} \rightarrow V\otimes V$ and interpret them as unoriented cap and cup (since they don't involve $V^*$ anymore). So now it seems that you can build an invariant of unoriented link. Thing is, it won't work if you use the standard ribbon element, but it will, I think (I'm not 100% sure), if you make a certain non standard choice: the square of a "half-twist" in the sense of Snyder-Tingley.
For more details :

*

*Peter Tingley, A minus sign that used to annoy me but now I know why it is there

*Noah Snyder, Peter Tingley, The half-twist for U_q(g) representations

A: In Kauffmans "abstract tensor" approach, you can translate the Reidemeister moves to tensor equations. (This works equally well for directed and undirected case.) Of course, solving n^6 cubics and whatnot is hell, but I still have tabulated all "nice" ("charge conserved") cases up to n=6 and each gives rise to an undirected invariant (and you can immediately give its skein equation too).
For example, with S being the S matrix, $1/q*S^2+q*S^{-2}-(q+1/q)*S^0+(1/q^2-q^2)*S^1+(q^2-1/q^2)*S^{-1}=0$ is my simplest example (n=4) that might be unknown. For knots it's identical to the Jones polynomial, but not for links.
Note that these solutions may or may not be related to a Lie algebra (cf. Adriens answer), that's way over my head. (Feel free to PM me for details)


text:
Q: How to restart "pinch-to-zoom" feature via terminal? Both my macs have been having this issue with the latest releases of MacOS:

*

*Quick Look stops working randomly and Finder needs to be relaunched.

*Pinch-to-zoom feature stops working with the trackpad (external or integrated) and I need to go to settings > trackpad > scroll & zoom and re-enable it.

I made a Quick Action using Automator that when I click a keyboard shortcut, it will restart the Finder via Terminal.
I'm using killall Finder and it works great.
Then, I was trying to add a command to restart the P-T-Z functionality as well, but I can't find it.
After doing research online, I tried the following options with no luck:
killall Dock
(saw it somewhere saying that it would do the trick)
defaults write com.apple.AppleMultitouchTrackpad USBMouseStopsTrackpad 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad USBMouseStopsTrackpad 1
defaults write com.apple.AppleMultitouchTrackpad USBMouseStopsTrackpad 0
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad USBMouseStopsTrackpad 0

(supposedly restarts the trackpad, but didn't work)
Does anybody know what the right command would be to achieve this goal?
Thanks!

Edit:
I want to clarify that I've also been doing research on the bugs per se. Trying to find the root problem, but I had no luck with that either.
It's been happening to both my old MBP and my new iMac. So I think that these are definitely bugs with the OS.
I've read about other users having the same issues, and the common solution is just to manually restart Finder or the Zoom gesture. So that's why I'm looking for a solution that will make this manual process less annoying while Apple works on fixing them.

A: I also have this problem, as have other people, pretty sure its a known bug at this point. I've noticed it particularly when using Powerpoint pinch to zoom, and only after the latest update. Using Shortcuts (introduced in Monterrey) I wrote up this AppleScript which checks and unchecks the box. Then in the Shortcut details you can pin it to menu bar. Confirmed this works on Monterrey 12.4.
on run {input, parameters}
    tell application "System Preferences"
        if it is running then
            quit
            delay 0.2
        end if
    end tell
    tell application "System Preferences" to reveal pane id "com.apple.preference.trackpad"
    tell application "System Events"
        tell front window of application process "System Preferences"
            repeat until (exists checkbox 2 of tab group 1)
                delay 0.01
            end repeat
            click checkbox 2 of tab group 1
            click checkbox 2 of tab group 1
        end tell
    end tell
    quit application "System Preferences"
    return input
end run

A: -- EDIT:
For some reason, at some point this script stopped working, so if anyone is in the same situation, this modified version did it for me.
The first time you run it it asks you to grant multiple accessibility permissions, but after that, it seems to work fine.
on run {input, parameters}
    tell application "System Preferences"
        if it is running then
            quit
            delay 0.2
        end if
    end tell
    tell application "System Preferences"
        activate
        set current pane to pane id "com.apple.preference.trackpad"
        delay 1
        tell application "System Events"
            tell front window of application process "System Preferences"
                repeat until (exists checkbox 2 of tab group 1)
                    delay 0.01
                end repeat
                click checkbox 2 of tab group 1
                click checkbox 2 of tab group 1
            end tell
        end tell
    end tell
    -- quit application "System Preferences"
    return input
end run

-- ORIGINAL:
Ghart's answer was definitely the right approach to do this systematically. The bug still exists and in my case, I've noticed it's randomly triggered by Figma and/or Illustrator.
Using Ghart's code, I removed the part that takes data from the Shortcuts app and just left the instructions for the System Settings.
Then I created a new Quick Action in Automator so that it runs the Applescript.
I saved the Quick Action then went to System Settings > Keyboard > Shortcuts > Services and my Quick Action was already listed there and I just assigned it one of my function keys that was not assigned for anything else.
So now, when the pinch to zoom functionality stops working, I just press F14 and it runs the script in the background and makes it work again.
So in conclusion:
If you want to do this with Shortcuts, use Ghart's answer.
If you want to do it with a hotkey/Automator, you can follow my mini tutorial.
This is definitely a game changer! Thank you Ghart!