text:
Q: How does one remove material from a token list? This is a follow-up question to How does one append material to a token list?
The macros \prependto and \appendto work nicely to add content to token lists. How would one go about creating macros like \gobblefirst and \gobblelast that removes the first/last token from the list?
Assume the following cases:

*

*The tokens are separated by some fixed token (like \relax); or

*The tokens are not separated by any fixed token.

I assume a solution to 1 would be (far) easier than a solution to 2.

A: Here are three versions of \gobblelast:
\makeatletter

\def\gobblelast@nil{gobblelast@nil}

\newtoks\gobblelast@toks

\let\gobblelast@obr={
\let\gobblelast@cbr=}
\def\gobblelast@mkspc#1%
{%
  \expandafter\futurelet\expandafter\gobblelast@spc\expandafter\@gobble
}
\futurelet\next\gobblelast@mkspc a b

\newcommand\gobblelast[2]
{%
  \global\@tempcnta#2\relax
  \global\advance\@tempcnta\@ne
  \global\gobblelast@toks={}%
  \begingroup
  \let\@gobblelast@iter\@@gobblelast@iter
  \expandafter\futurelet\expandafter\next\expandafter\gobblelast@iter
  \the#1\relax\gobblelast@nil
  #1=\expandafter{\the\gobblelast@toks}%
}

\newcommand\gobblelast@iter
{%
  \gobblelast@ifx{\next\gobblelast@nil}
  {\endgroup\@gobble}
  {%
    \gobblelast@ifx{\next\gobblelast@obr}
    {\gobblelast@readobr}
    {%
      \gobblelast@ifx{\next\gobblelast@cbr}
      {\gobblelast@readcbr}
      {%
        \gobblelast@ifx{\next\gobblelast@spc}
        {\gobblelast@readspc}
        {\gobblelast@readtoken}
      }%
    }%
  }%
}

\newcommand\gobblelast@ifx[1]
{%
  \ifx#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
}

\newcommand\gobblelast@readobr
{%
  \afterassignment\@gobblelast@readobr\let\next=%
}%

\newcommand\@gobblelast@readobr
{%
  \toks0\expandafter\expandafter\expandafter{\expandafter\string\expandafter{\iffalse}\fi}%
  \@gobblelast@iter
}

\newcommand\gobblelast@readcbr
{%
  \afterassignment\@gobblelast@readcbr\let\next=%
}%

\newcommand\@gobblelast@readcbr
{%
  \toks0\expandafter\expandafter\expandafter{\expandafter\iffalse\expandafter{\expandafter\fi\string}}%
  \@gobblelast@iter
}

\def\gobblelast@readspc%
{\afterassignment\@gobblelast@readspc\@tempcntb=`}

\def\@gobblelast@readspc%
{%
  \toks0{ }%
  \@gobblelast@iter
}

\def\gobblelast@readtoken#1%
{%
  \toks0{#1}%
  \@gobblelast@iter
}

\newcommand\@@gobblelast@iter
{%
  \begingroup
    \aftergroup\gobblelast@finish
    \futurelet\next\gobblelast@iter
}

\newcommand\gobblelast@finish
{%
  \ifnum\@tempcnta>\z@
    \global\advance\@tempcnta\m@ne
   \else
    \global\gobblelast@toks=\expandafter{\the\toks\expandafter\z@\the\gobblelast@toks}%
  \fi
  \endgroup
}

\newcommand\weakgobblelast[2]
{%
  \global\@tempcnta#2\relax
  \global\advance\@tempcnta\@ne
  \global\gobblelast@toks={}%
  \begingroup
  \let\@gobblelast@iter\@weak@gobblelast@iter
  \expandafter\futurelet\expandafter\next\expandafter\weakgobblelast@iter
  \the#1\relax\gobblelast@nil
  #1=\expandafter{\the\gobblelast@toks}%
}

\newcommand\weakgobblelast@iter
{%
  \gobblelast@ifx{\next\gobblelast@nil}
  {\endgroup\@gobble}
  {%
    \gobblelast@ifx{\next\gobblelast@obr}
    {\gobblelast@readbr}
    {%
      \gobblelast@ifx{\next\gobblelast@spc}
      {\gobblelast@readspc}
      {\gobblelast@readtoken}
    }%
  }%
}

\newcommand\@weak@gobblelast@iter
{%
  \begingroup
    \aftergroup\gobblelast@finish
    \futurelet\next\weakgobblelast@iter
}

\newcommand\gobblelast@readbr[1]
{%
  \toks0{{#1}}%
  \@gobblelast@iter
}%

\newcommand\voodoogobblelast[2]
{%
  \global\@tempcnta#2\relax
  \global\advance\@tempcnta\@ne
  \global\gobblelast@toks={}%
  \global\gobblelast@temptoks{}
  \begingroup
  \let\@gobblelast@iter\@voodoo@gobblelast@iter
  \expandafter\futurelet\expandafter\next\expandafter\voodoogobblelast@iter
  \the#1\relax\gobblelast@nil
  \edef\tmp{\expandafter\unexpanded\expandafter{\expandafter\unexpanded\expandafter{\the\gobblelast@temptoks}}\the\gobblelast@toks}
  #1=\expandafter{\tmp}%
}

\newcommand\voodoogobblelast@iter
{%
  \gobblelast@ifx{\next\gobblelast@nil}
  {\endgroup\@gobble}
  {%
    \gobblelast@ifx{\next\gobblelast@obr}
    {\vgobblelast@readobr}
    {%
      \gobblelast@ifx{\next\gobblelast@cbr}
      {\vgobblelast@readcbr}
      {%
        \gobblelast@ifx{\next\gobblelast@spc}
        {\gobblelast@readspc}
        {\gobblelast@readtoken}
      }%
    }%
  }%
}

\newcommand\@voodoo@gobblelast@iter
{%
  \begingroup
    \aftergroup\voodoogobblelast@finish
    \futurelet\next\voodoogobblelast@iter
}

\newcommand\vgobblelast@readobr
{%
  \afterassignment\v@gobblelast@readobr\let\next=%
}%

\newcommand\gobblelast@vobr{{\iffalse}\fi}

\newcommand\v@gobblelast@readobr
{%
  \toks0{\gobblelast@vobr}%
  \@gobblelast@iter
}

\newcommand\vgobblelast@readcbr
{%
  \afterassignment\v@gobblelast@readcbr\let\next=%
}%

\newcommand\gobblelast@vcbr{\iffalse{\fi}}

\newcommand\v@gobblelast@readcbr
{%
  \toks0{\gobblelast@vcbr}%
  \@gobblelast@iter
}

\newtoks\gobblelast@temptoks

\newcommand\voodoogobblelast@finish
{%
  \ifnum\@tempcnta>\z@
    \global\advance\@tempcnta\m@ne
   \else
    \expandafter\ifx\expandafter\gobblelast@vobr\the\toks\z@
      \edef\tmp{\noexpand\gobblelast@vobr\expandafter\unexpanded\expandafter{\expandafter\unexpanded\expandafter{\the\gobblelast@temptoks}}\the\gobblelast@toks}
      \global\gobblelast@toks=\expandafter{\tmp}%
      \global\gobblelast@temptoks{}
     \else
      \expandafter\ifx\expandafter\gobblelast@vcbr\the\toks\z@
        \edef\tmp{\noexpand\gobblelast@vcbr\expandafter\unexpanded\expandafter{\expandafter\unexpanded\expandafter{\the\gobblelast@temptoks}}\the\gobblelast@toks}
        \global\gobblelast@toks=\expandafter{\tmp}%
        \global\gobblelast@temptoks{}
       \else
        \global\gobblelast@temptoks=\expandafter{\the\toks\expandafter\z@\the\gobblelast@temptoks}%
      \fi
    \fi
  \fi
  \endgroup
}

The first version, \gobblelast, will remove tokens one by one, but braces have to be treated specially. I haven't found a way to put them into a token list such that it becomes unbalanced, so they are converted to catcode 12.
Testing with
\newtoks\mytoks

\mytoks={a\foo#{this and that} \hhh  \fi \egroup  \bgroup}

\gobblelast{\mytoks}{10}

\showthe\mytoks

will give
> a\foo ##{this and .
l.274     \showthe\mytoks

but the braces are not real braces any more.
If you are willing to accept the following recusive definition of weak token:
A weak token is

*

*Any single token which is not a brace or

*any list of weak tokens enclosed in braces.

then \weakgobblelast will preserve braces, but everything enclosed in braces will be counted as one token. Hence,
\newtoks\mytoks

\mytoks={a\foo#{this and that} \hhh  \fi \egroup  \bgroup}

\weakgobblelast{\mytoks}{6}

\showthe\mytoks

will give
> a\foo ##.
l.274     \showthe\mytoks

If you really really want do do voodoo magic with 'real' unbalanced brace groups, then \voodoogobblelast is for you. It will create a "safety package" of tokens which upon full expansion recreate the truncated token list including possibly unbalanced braces...
Handle with care! ;-)
The following
\newtoks\mytoks

\mytoks={a\foo#{this and that} \hhh  \fi \egroup  \bgroup}

\voodoogobblelast{\mytoks}{10}

\showthe\mytoks

\mytoks{\newcommand\foo{\newcommand\bar[1]{\baz\space\quux}}}

\voodoogobblelast{\mytoks}{4}

\showthe\mytoks

\expandafter\edef\expandafter\next\expandafter{\the\mytoks}}}

\show\next

\next

\show\foo

will give
> \unexpanded {a\foo ##}\gobblelast@vobr \unexpanded {this and }.
l.274     \showthe\mytoks

> \unexpanded {\newcommand \foo }\gobblelast@vobr \unexpanded {\newcommand \bar [1]}\gobblelast@vobr \unexpanded {\baz }.
l.280     \showthe\mytoks

> \next=macro:
->\newcommand \foo {\newcommand \bar [1]{\baz }}.
l.284     \show\next

> \foo=\long macro:
->\newcommand \bar [1]{\baz }.
l.288     \show\foo

I have the subtle feeling I committed a couple of deadly sins making this, but anyway...

A: I wanted spaces and braces preserved but I find Stephan Lehmke's solution too long.
\documentclass{article}
\makeatletter
\newtoks\giventoks
\newtoks\@temptokenb
\def\removelasttoken{%
  \let\origbgroup\bgroup
  \let\bgroup\@undefined
  \@temptokena{}\@temptokenb{}%
  \expandafter\removelasttoken@a\the\giventoks\removelasttoken
  \giventoks=\@temptokenb
  \let\bgroup\origbgroup
}
\def\removelasttoken@a{\futurelet\next\removelasttoken@b}
\def\removelasttoken@b{%
  \ifx\next\@sptoken
    \expandafter\removelasttoken@c
  \else
    \expandafter\removelasttoken@e
  \fi
}
\@namedef{removelasttoken@c} {\futurelet\next\removelasttoken@d}
\def\removelasttoken@d{%
  \ifx\next\removelasttoken
    \@temptokenb\expandafter{\the\expandafter\@temptokenb\the\@temptokena}%
    \expandafter\removelasttoken@e
  \else
    \@temptokenb\expandafter
      {\the\expandafter\@temptokenb\the\expandafter\@temptokena\space}%
    \@temptokena{}%
    \expandafter\removelasttoken@a
  \fi
}
\def\removelasttoken@e#1{%
  \ifx\removelasttoken#1\else
    \@temptokenb\expandafter{\the\expandafter\@temptokenb\the\@temptokena}%
    \@temptokena{#1}%
    \edef\reserved@a{%
      \@temptokena{\ifx\next\origbgroup
        {\the\@temptokena}\else\the\@temptokena\fi}%
    }%
    \reserved@a
    \expandafter\removelasttoken@a
  \fi
}
\makeatother
% Example:
\begin{document}
\def\showout{\typeout{\the\giventoks}}
\giventoks{a\foo{#} {{this and that}} \hhh \fi \ifx \egroup  \bgroup \undefined}
\removelasttoken\showout
\removelasttoken\showout
\removelasttoken\showout
\removelasttoken\showout
\removelasttoken\showout
\removelasttoken\showout
\removelasttoken\showout
\removelasttoken\showout
\removelasttoken\showout
\removelasttoken\showout
\end{document}

The example produces
a\foo {##} {{this and that}} \hhh \fi \ifx \egroup \bgroup
a\foo {##} {{this and that}} \hhh \fi \ifx \egroup
a\foo {##} {{this and that}} \hhh \fi \ifx
a\foo {##} {{this and that}} \hhh \fi
a\foo {##} {{this and that}} \hhh
a\foo {##} {{this and that}}<space>
a\foo {##} {{this and that}}
a\foo {##}<space>
a\foo {##}
a\foo

With eTeX, we can also do
% \gobblelasttoken<cmd>
\def\gobblelasttoken#1{%
  \let\origbgroup\bgroup
  \let\bgroup\@undefined
  \@temptokena{}\@temptokenb{}%
  \expandafter\removelasttoken@a#1\gobblelasttoken
  \let\bgroup\origbgroup
  \edef#1{\the\@temptokenb}%
}

\removelasttoken@a and the other macros remain the same.
Example:
\begin{document}
\def\showout{\typeout{\unexpanded\expandafter{\giventoks}}}
\edef\giventoks{\unexpanded{a\foo{#} {{this and that}} \hhh \fi \ifx
  \egroup\bgroup \undefined}}
\gobblelasttoken\giventoks\showout
\gobblelasttoken\giventoks\showout
\gobblelasttoken\giventoks\showout
\gobblelasttoken\giventoks\showout
\gobblelasttoken\giventoks\showout
\gobblelasttoken\giventoks\showout
\gobblelasttoken\giventoks\showout
\gobblelasttoken\giventoks\showout
\gobblelasttoken\giventoks\showout
\gobblelasttoken\giventoks\showout
\end{document}

A: When you want to maintain token lists where something can be added or removed at either end, it's best to add a separator:
\catcode`@=11 % \makeatletter
\def\prependtolist#1#2{% #1=list name, #2=item to add
  \toks@={\listitem{#2}}%
  \toks@=\expandafter{\the\expandafter\toks@#1}%
  \edef#1{\the\toks@}
}
\def\appendtolist#1#2{%
  \expandafter\def\expandafter#1\expandafter{#1\listitem{#2}}%
}
\def\removetop#1#2{% #1=list,#2=macro to store the removed item
  \expandafter\removetopaux#1\removetop{#1}{#2}}
\def\removetopaux\listitem#1#2\removetop#3#4{%
  \def#2{#1}%
  \def#3{#2}%
}

\catcode`@=12

(there are better ways, this is just to give the flavor).
When the list has to be used, just set
\def\listitem#1{#1}

With LaTeX3 there are a bunch of facilities for easing the job. The "sequence" data type is the easiest:
\usepackage{expl3}
\seq_new:N \l_werner_my_seq
\seq_put_left:Nn \l_werner_my_seq {a} % analog of \prependtolist
\seq_put_right:Nn \l_werner_my_seq {a} % analog of \appendtolist
\seq_pop_left:NN \l_werner_my_seq \l_tmpa_tl % analog of \removetop
\seq_pop_right:NN \l_werner_my_seq \l_tmpa_tl % analog of \removebottom

% How to deliver the contents of a sequence
\seq_map_function:NN \l_werner_my_seq \use:n

The last line shows how to deliver the contents of the list (the implicit separator is redefined to do nothing).
Working with token lists is possible too, but one can remove items rather than tokens, where an item is either a token which is not an explicit brace or a braced group.
\tl_new:N \l_werner_my_tl
\tl_put_left:Nn \l_werner_my_tl {a} % analog of \prependto
\tl_put_right:Nn \l_werner_my_tl {a} % analog of \appendto
\tl_set:Nx \l_werner_my_tl { \tl_tail:N \l_werner_my_tl } % your \gobblefirst

The \gobblelast macro can be obtained by reversing twice the token list:
\cs_generate_variant:Nn \tl_reverse:n {f}
\tl_set:Nx \l_werner_my_tl { \tl_reverse:f { \tl_tail:f { \tl_reverse:V \l_werner_my_tl } } }

Implementation of the "token list" approach:
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\uselist}{ m }{ \tl_use:c { l_werner_#1_tl } }
\NewDocumentCommand{\createlist}{ m }{ \tl_new:c { l_werner_#1_tl } }
\NewDocumentCommand{\prependtolist}{ m m }
 {
  \werner_prepend:nn { #1 } { #2 }
 }
\NewDocumentCommand{\appendtolist}{ m m }
 {
  \werner_append:nn { #1 } { #2 }
 }
\NewDocumentCommand{\gobblefirst}{ m }
 {
  \werner_gobble_first:n { #1 }
 }
\NewDocumentCommand{\gobblelast}{ m }
 {
  \werner_gobble_last:n { #1 }
 }

\cs_new_protected:Npn \werner_prepend:nn #1 #2
 {
  \tl_put_left:cn { l_werner_#1_tl } { #2 }
 }
\cs_new_protected:Npn \werner_append:nn #1 #2
 {
  \tl_put_right:cn { l_werner_#1_tl } { #2 }
 }
\cs_new_protected:Npn \werner_gobble_first:n #1
 {
  \tl_set:cx { l_werner_#1_tl } { \tl_tail:v { l_werner_#1_tl } }
 }
\cs_new_protected:Npn \werner_gobble_last:n #1
 {
  \tl_set:cx { l_werner_#1_tl } { \tl_reverse:v { l_werner_#1_tl } }
  \werner_gobble_first:n { #1 }
  \tl_set:cx { l_werner_#1_tl } { \tl_reverse:v { l_werner_#1_tl } }
 }
\cs_generate_variant:Nn \tl_reverse:n {v}
\NewDocumentCommand{\showlist}{m}{ \tl_show:c { l_werner_#1_tl } }

\ExplSyntaxOff

\createlist{my}
\appendtolist{my}{z}
\prependtolist{my}{{ab}c}
\appendtolist{my}{\texttt}

\showlist{my}    % {ab}cz\texttt
\gobblefirst{my}
\showlist{my}    % cz\texttt
\gobblelast{my}
\showlist{my}    % cz
\gobblelast{my}
\showlist{my}    % c

Instead of \showlist you can say \uselist{my} to deliver the list's content.
Implementation of the "sequence" approach
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn

\NewDocumentCommand{\createlist}{ m }{ \seq_new:c { l_werner_#1_seq } }
\NewDocumentCommand{\uselist}{ m } { \seq_map_function:cN { l_werner_#1_seq } \use:n }
\NewDocumentCommand{\showlist}{ m } { \seq_show:c { l_werner_#1_seq } }
\NewDocumentCommand{\prependtolist}{ m m }{ \werner_prepend:nn { #1 } { #2 } }
\NewDocumentCommand{\appendtolist}{ m m }{ \werner_append:nn { #1 } { #2 } }
\NewDocumentCommand{\gobblefirst}{ m }{ \werner_gobble_first:n { #1 } }
\NewDocumentCommand{\gobblelast}{ m }{ \werner_gobble_last:n { #1 } }

\cs_new_protected:Npn \werner_prepend:nn #1 #2
 {
  \seq_put_left:cn { l_werner_#1_seq } { #2 }
 }
\cs_new_protected:Npn \werner_append:nn #1 #2
 {
  \seq_put_right:cn { l_werner_#1_seq } { #2 }
 }
\cs_new_protected:Npn \werner_gobble_first:n #1
 {
  \seq_pop_left:cN { l_werner_#1_seq } \l_tmpa_tl
 }
\cs_new_protected:Npn \werner_gobble_last:n #1
 {
  \seq_pop_right:cN { l_werner_#1_seq } \l_tmpa_tl
 }

\ExplSyntaxOff

The same input as before will do, with the difference that \gobblefirst will remove {ab}c and not {ab}.

A: I think you need to give some conditions on what is allowed in your token list.
Token registers can contain arbitrary balanced list such as {ab}{cd} that is 8 tokens  but presumably when you say "remove the first token" you mean get {cd} as if you just remove the { you get a list ab}{cd} which can't be stored in a token register. (Although if you really wanted that you could convert it to ab\egroup{cd} which is similar in some respects, and can be stored).  however I'll assume you want to consider brace groups as tokens. Other interesting tokens are # and unmatched \if etc.
So removing from the start can be done with essentially no restrictions:
\newtoks\aa

\def\gobble#1{}

\def\gobblefirst{%
  \aa\expandafter\expandafter\expandafter{\expandafter\gobble\the\aa}}

\aa{a\foo#{this and that}\hhh \if \egroup  \bgroup}\showthe\aa

\gobblefirst\showthe\aa
\gobblefirst\showthe\aa
\gobblefirst\showthe\aa
\gobblefirst\showthe\aa
\gobblefirst\showthe\aa
\gobblefirst\showthe\aa
\gobblefirst\showthe\aa
\gobblefirst\showthe\aa

\bye

Produces (if run through plain TeX)
> a\foo ##{this and that}\hhh \if \egroup \bgroup .
l.10 ...that}\hhh \if \egroup  \bgroup}\showthe\aa

?
> \foo ##{this and that}\hhh \if \egroup \bgroup .
l.12 \gobblefirst\showthe\aa

?
> ##{this and that}\hhh \if \egroup \bgroup .
l.13 \gobblefirst\showthe\aa

?
> {this and that}\hhh \if \egroup \bgroup .
l.14 \gobblefirst\showthe\aa

?
> \hhh \if \egroup \bgroup .
l.15 \gobblefirst\showthe\aa

?
> \if \egroup \bgroup .
l.16 \gobblefirst\showthe\aa

?
> \egroup \bgroup .
l.17 \gobblefirst\showthe\aa

?
> \bgroup .
l.18 \gobblefirst\showthe\aa

?
> .
l.19 \gobblefirst\showthe\aa

I can't see any way of removing from the other end in the same generality, you always have to impose some restrictions a reserved "marker" token that may not appear in the list, or no brace groups or....
gobble last
This version has some restrictions, the main one being that the token \xlast may not be in the list, the other ones I leave as a trap for the unsuspecting user....
\def\xlast#1{%
\ifx\xlast#1%
 \else
 \bb\expandafter{\the\expandafter\bb\the\cc}%
 \cc{#1}%
 \expandafter\ifx\expandafter\xlast\gobble#1\xlast
 \else
 \expandafter\cc\expandafter{\expandafter{\the\cc}}%
 \fi
 \expandafter\xlast
\fi}

\newtoks\bb
\newtoks\cc
\def\gobblelasta{%
\bb{}%
\cc{}%
\expandafter\xlast\the\aa\xlast
\aa\bb}

\aa{a\foo#{this and that}\hhh  \fi \egroup  \bgroup}\showthe\aa
\gobblelasta\showthe\aa
\gobblelasta\showthe\aa
\gobblelasta\showthe\aa
\gobblelasta\showthe\aa
\gobblelasta\showthe\aa
\gobblelasta\showthe\aa
\gobblelasta\showthe\aa
\gobblelasta\showthe\aa

\bye

Produces the following from plain TeX:
> a\foo ##{this and that}\hhh \fi \egroup \bgroup .
l.46 ...hat}\hhh  \fi \egroup  \bgroup}\showthe\aa

?
> a\foo ##{this and that}\hhh \fi \egroup .
l.47 \gobblelasta\showthe\aa

?
> a\foo ##{this and that}\hhh \fi .
l.48 \gobblelasta\showthe\aa

?
> a\foo ##{this and that}\hhh .
l.49 \gobblelasta\showthe\aa

?
> a\foo ##{this and that}.
l.50 \gobblelasta\showthe\aa

?
> a\foo ##.
l.51 \gobblelasta\showthe\aa

?
> a\foo .
l.52 \gobblelasta\showthe\aa

?
> a.
l.53 \gobblelasta\showthe\aa

?
> .
l.54 \gobblelasta\showthe\aa


text:
Q: Azure Functions (Durable) - Type is an interface or abstract class and cannot be instantiated Problem
I have a C# Durable Azure Functions app (v2) containing an orchestration and activity function.
The orchestration calls the activity as follows:
propBag.CE = await context.CallActivityAsync<CEData>(nameof(GetCEByExternalIdActivity), propBag);

The call works ok and the Activity function executes, builds up the content for propBag.CE and returns.
The CE object contains a few other objects, including:
        public List<IParty> Individuals { get; set; }
        public List<IParty> Organisations { get; set; }

These properties are assigned to as follows:
        consPort.Individuals = await GetParties(clientRel.RelatedIndividuals, CEEntityType.Individual);
        consPort.Organisations = await GetParties(clientRel.RelatedOrganisations, CEEntityType.Organisation);

The fact that it contains an Interface seems to give the Durable Functions runtime a problem. When it attempts to deserialize the value returned from the activity function, I get the following error:
Could not create an instance of type Interfaces.Avaloq.Application.Models.CE.IParty. Type is an interface or abstract class and cannot be instantiated
Does anyone know of a good fix for this? Maybe there's a way to configure how the function will attempt to deserialize the json?
Workaround
I worked-around the problem by changing the class to contain lists of the concrete types of IParty as follows:
        public List<Individual> Individuals { get; set; }
        public List<Organisation> Organisations { get; set; }

I then had to ensure that I cast to the concrete type from the IParty before assigning to those properties, as follows:
var myList = (await GetParties(clientRel.RelatedIndividuals, CEEntityType.Individual));
        foreach (var party in myList)
        {
            consPort.Individuals.Add((Individual)party);
        }
        myList = (await GetParties(clientRel.RelatedOrganisations, CEEntityType.Organisation));
        foreach (var party in myList)
        {
            consPort.Organisations.Add((Organisation)party);
        }

Not pretty but gets me around the problem.

A: It looks like you're running into this issue on GitHub. In addition to your workaround, you can customize the serializer settings used by Durable Functions to include type information. There is another StackOverflow post which describes this and has an example.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is cup product of cycle classes on Noetherian regular excellent scheme compatible with intersection Let $\mathcal{X}$ be a Noetherian regular integral excellent scheme. Let $Y$ and $Z$ be algebraic cycles of  codimension $c$ and $d$ on $\mathcal{X}$.
Let $n$ be a positive integer invertible on $\mathcal{X}$. Assume $Y$ intersects $Z$ properly and define $Y\cap Z$ by Serre's Tor formula. Do we have
$$Cl(Y)\smallsmile Cl(Z)= Cl(Y\cap Z)$$
Where $Cl(Y)$ is the cycle class of $Y$ in $H^{2c}_{|Y|}(\mathcal{X},\mathbb{Z}/n(c))$
 (By Gabber's purity theorem, it can be defined as chapter 4 2.2.10 in SGA 4 1/2).
By  Remark  2.3.9 chapter 4, in Deligne's SGA 4 1/2, the claim holds for smooth varieties over algebraic closed fields. I think by localization, it should work for cycles whose supports are locally complete intersection closed subscheme.


text:
Q: Multi-select between parentheses Let's say I am looking to have the following highlighted in vim:

That is, I would like to add the word "END" to the end of each json key, for example:
"Accept-END"
"Accept-Encoding-END"
...etc

What would be the best way to do this? If it were the same length I could do a visual control-select on down, but here the dictionary key is of varying length, so how would I select or quickly modify all. Here's the text:
    get_headers = {
        "Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "Accept-Encoding" : "gzip, deflate, sdch",
        "Accept-Language" : "en-US,en;q=0.8,pt;q=0.6",
        "Cache-Control" : "max-age=0",
        "Connection" : "keep-alive",
        "Upgrade-Insecure-Requests": "1",
        "User-Agent": "Mozilla/5.1 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36"
    }

A: You can highlight the text, then use a regex:
'<,'>s/\%V" *:/-END&

Explanation:

*

*'<,'> applies the following substitution command to the last highlighted text only.

*s/foo/bar is the substitution command format replacing pattern foo with bar.

*\%V limits the substitution pattern to match the highlighted region only.

*" *: matches the delimiter substrings between keys and values. You could make this more complex if needed.

*-END& is the replacement and & references the match.

You could also use a macro, although for 7 lines both solutions might be no faster than typing one line in and using ..

A: let's say you are on the first line i.e. 'get_headers', to use macro do following:

*

*j to go to next line

*qq to start recording macro at 'q' register

*^ to go to first non blank character

*f" to find the next quotation mark

*i to get to insert mode

*-END

*press ESC let to get to normal mode

*j to go to next line

*q to stop recoding macro

*@q to replay macro or 6@q to replay it 6 times

A: Here is a macro you could use to do that, shown with keypresses here: https://gyazo.com/e02051850977973579adf64147d35edc.
In summary:

*

*[START] qa to start a new macro ("a")

*f" to go to the end of the dict key

*i then -END to insert that suffix.

*^j to go back to the start of the line and down a line

*[END] q to end the macro

*6@a to run that macro 6 times, one for each line below it.


text:
Q: Output device changed but not getting sound output I am using macOS Mojave v10.14.5. After I plugged in my headphones (while the MacBook is not plugged into power and opening KMPlayer to listen music on speakers), I was unable to get the sound output my headphone. Still the actual sound came out from MacBook Pro speakers instead of headphones.
Any idea on this issue?

A: Are you sure KMPlayer is not overriding the default speaker setup? Have you tried going to Main Controls > Audio > Audio Renderer and setting your device as default?


text:
Q: jQuery Uncaught RangeError: Maximum call stack size exceeded when using setTimeout I'm trying to create a realtime notification script where every time a certain text is found in my file, it'll play a sound. This is what I've tried:
<script type="text/javascript" src="jquery-2.1.3.min.js"></script>
<script type="text/javascript">
    function getTextfile() {
        $.get('myfile.txt', { cache:false }, function(data) {
            if (data.indexOf("Hello World") > -1) {
                document.write("Hello World is found");
                var audio = new Audio('wb.wav');
                audio.play();
            } else {
                document.write("It's NOT found");
                var audio = new Audio('wn.wav');
                audio.play();
            }
            setTimeout(getTextfile, 1000);
        },'text');
    }
    getTextfile();
</script>

And myfile.txt looks like this:
Line one
line two
Hello World
line four

But on my chrome browser I get this error:

Uncaught RangeError: Maximum call stack size exceeded`

myfile.txt changes dynamically so it should play a different sound every time it finds the text I'm looking for or doesn't find it without me having to refresh the browser. How can I solve this ?

A: I found what's causing the problem, it's document.write() that's causing it. After I got rid of document.write() everything works perfectly. Thank you


text:
Q: am having issues launching my rails server using terminal. I have attached a screen shot of my issue! hope someone can help! Thanks when i try to run rails server i get the following error! would be GREAT if someone could help!
Below is a screenshot of my code and error

A: As your error log is saying 'Webpacker configuration file is not found', you need to run rails webpacker:install as given in error logs suggestion and try starting your server again.
Refer this answer


text:
Q: Custom DatePicker I have two queries...
I am about to write a custom DatePicker where in could control the number of components as well. Like Date and Month only and no Year.
Q1) Do you have any custom code already available which takes care of leap year logic?
Q2) I thought of writing separate arrays of days... but writing numbers from 1 to 31 and then then repeating it for different months is annoying. Any better solution here?

A: Do yourself a favor and don't write your own date algorithms. NSCalendar and NSDateComponents can probably do everything you need. And using the APIs provided by the system also ensures that your code works in many different locale settings.
For example, to retrieve the number of days in a month, call [myCalendar rangeOfUnit:NSDayCalendarUnit inUnit:NSMonthCalendarUnit forDate:myDate].


text:
Q: How do I get the value of for loop into another variable I have the following code:
public static void main(String args[])
{
    Scanner user = new Scanner(System.in);

    System.out.println("Enter a number");
    int x = user.nextInt();

    for(int i= 1; i <= x; x--)
        System.out.println(x + "/" +x + "=" + x/x);
}

What I need to do is divde the userinput by the number less than it for example the user enters 9 the program will ouptut:
9/9 = 1, 9/8 = 1.125, and so on up top 9/1;
How would I do that if the same variable is used for the userinput and the loop?

A: int x = user.nextInt();

for(int i = x; i >=1; i--)
    System.out.println(x + "/" +i + "=" + x/(float)i);

for the question in the comment:
for(int i = x; i >=1; i--){
    if(x%i==0)System.out.println(x + " is divisible by "+i);
}

ofcourse this will not print it the way you want it ,but it gives you the idea of what you need to do


text:
Q: Applet not initialized in applet viewer I need to write an applet for a computer science course. I need to have five song titles scroll on to the screen from the top and off the right side, one at a time on a loop. I wrote my code and it compiles but when I try to run it in the appletviewer I get a blank window that says applet not initialized. I'm assuming that it's not a problem with the main code and that it's probably something in the start() method.
Here's the code:
import java.awt.*;
public class SongTitles extends java.applet.Applet implements Runnable
{
String song[] = {"Watch The Corners","Where Is My Mind","Different World","Seven Nation Army","Nowhere Man"};
int[] y = new int[] {0,0,0,0,0};
int[] x = new int[] {200,200,200,200,200};
boolean[] cycle = new boolean[5];
Thread runner;

public void start()
{
    if (runner == null)
    {
        runner = new Thread(this);
        runner.start();
    }
}

public void paint (Graphics g)
{
for(int i = 0; i < 5; i++)
{
        g.drawString(song[i], x[i], y[i]);
}
}

public void run()
{
cycle[0] = true;

for(int c = 0; c < 5; c++)
{

        while(cycle[c] = true)
        {
        if (y[c] < 200)
        {
                y[c] += 2;
                repaint();
                try
                {
                runner.sleep(50);
                }
                catch (InterruptedException e) { }
    }

        if (y[c] == 200 && x[c] < 400)
        {
                x[c] += 2;
                repaint();
                try
                {
                    runner.sleep(50);
                }
                catch (InterruptedException e) { }
            }

        if (x[c] == 400)
        {
                x[c] = 200;
            y[c] = 0;
                repaint();
        cycle[c] = false;
        cycle[(c + 1)] = true;
                try
                {
                    runner.sleep(50);
                }
                catch (InterruptedException e) { }
            }

    }

    if(c < 5)
    {
        c++;
    }

    if(c == 5)
    {
        c = 0;
    }
    }
  }
}

And here's the html file to run it:
<html>
<body>
<applet code = "SongTitles.class" width=400 height=400>
</applet>
</body>
</html>


text:
Q: How do I detect "ERROR:SCHEMA-INDEX-MISMATCH" in Solr? How do I find documents in my index that have a SCHEMA-INDEX-MISMATCH?  I have a number of these that I am finding them by trial-and-error.  I want to query for them.
The results that I get have "ERROR:SCHEMA-INDEX-MISMATCH" in a field.  An example:
<?xml version="1.0" encoding="UTF-8"?>
<response>
    <result name="response" numFound="1" start="0" maxScore="12.993319">
        <doc>
            <float name="score">12.993319</float>
            <str name="articleId">ERROR:SCHEMA-INDEX-MISMATCH,stringValue=555</str>
            <str name="articleType">Knowledge Base</str>
            <str name="description">Moving to another drive Question: How can I ....</str>
            <str name="id">article:555</str>
            <str name="title">Moving to another drive</str>
            <str name="type">article</str>
        </doc>
    </result>
</response>

If it matters, my query is along the lines of http://server/solr/select?q=id:%22article:555%22

A: What is the "type" of articleId?
I had issues with a date field and due to a defect in indexing program, I had 'ERROR:SCHEMA-INDEX-MISMATCH".  Since these are values out side the bounds of a normal date, I was able to find them by the query - "Not myDateFieldType:[0001-01-01T00:00:00Z NOW]" .
If you are able to craft this type of query, depending on your data type, you should be able to find these values.


text:
Q: How to edit datasource credentials of imported PBIX file - Power BI API? I have problem with credentials of datasource. I use .NET library PowerBI.API, I´m importing PBIX file, which has connection to Excel file. I have installed On-Premises Data Gateway. When file is imported, I can´t refresh dataset because the credentials are invalid.
When I click on Edit credentials, it show this.
I click on Sign in and refreshing works fine. But I need make it by API. I tried many ways, but nothing works.
I will be happy for any advice.


text:
Q: CCK Field, minimum number of values I have created a module which implements a CCK field. When adding the field to a content type, I have set the number of values to unlimited, and set the field to be required.
Is there a way to set the number of values required? I need the user to enter 5 or more values.
Thank you in advance.

A: The answer lies within hook_form_alter() -- http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_form_alter/6
You'll need to do 2 things, as I see it:

*

*Alter the form item to include 5
entries on form load (instead of the
usual 2 with an "add more" button).

*Add a $form['#validate'] =
    'my_form_validate' entry to the form
    to check that at least 5 were set.
1 may be a bit of a challenge; I'm not sure how the form loads multiple items the first time around. If you do a vardump on the $form it may be obvious, though.
For 2 it should be straightforward --
function my_form_validate($form, &$form_state) {
  $i=0;
  foreach ($form_state['field_my_field_name']...) {
    if (isset(...)) { $i++; }
  }
  if ($i < 5) {
    form_set_error($form_state['field_my_field_name'], 'You must enter 5 foobars');
  }
}


text:
Q: How to delete user-defined build settings in Xcode 4.3.1 I have created several user-defined build settings in Xcode 4.3.1. I no longer need these settings and want to delete them, but there doesn't seem to be a way to delete them!
I am aware that these are stored in the project settings (project.pbxproj) file located within the xcodeproj file. But I don't want to edit these in a text editor as there are all sorts of repetitions and guids which I don't understand.
Any suggestions on how I can do this within Xcode? (or have they forgotten to add a "delete" button)

A: Follow the steps below:

*

*Select Project

*Tap on the Info tab

*Select Configurations

*Select Configuration to remove

*Press the Delete button on the keyboard

A: Just figured this out myself: you need to make sure you're at the right scope to be able to delete the setting. If you defined the setting at the project scope, no amount of key-bashing will remove it if you're looking at the target-scope. Remember, targets inherit settings from project scope. That last bit is what I tripped over :)

A: Try selecting a user-defined setting that you created then hit "Delete" button on your keyboard. That works for me when I encountered the same problem.

A: On Xcode 6:
Select the row and hit Fn + Delete.

A: Removing User-Defined build settings depends on where those settings have been created.
Lets assume that you've created one already and named it as PROJECT_SETTING. In order to check your PROJECT related User-Defined settings, you have to select your project first on the project and targets list, then you should see something like this:

Here you can see only PROJECT related settings, and here you have the
  only ability edit/delete PROJECT_SETTING.

Besides that if you set up a TARGET, so can add new User-Defined settings there, that only affects that TARGET scope.

You can edit/delete TARGET_SETTING_1 and TARGET_SETTING_2 here, but
  PROJECT_SETTING is read-only, as it is inherited from your
  PROJECT settings.

Here you will notice that your TARGET contains your PROJECT User-Defined settings and also your TARGET related User-Defined settings marked as bold letters. This helps you to know which setting can be edited on this level.
You won't be able to delete your settings here if that was created under PROJECT scope, and also editing a PROJECT related User-Defined settings will result a newly created settings that affects only the selected TARGET.
Also if you prefer more visibility on Build Settings, you can select Levels view instead of Combined view, so you should see it more separated:

A: Select one of them and press keyboard's delete button.

A: There's a caveat to these answers: If you're using a Build Configuration File (.xcconfig) it doesn't seem possible to delete the user-defined settings generated from these files directly on either the project or target level in the "Build Settings" GUI.  You'll have to delete the flag and its value from the configuration file and rebuild the project.  If you're using multiple build configuration files that use the same flag, you'll have to delete them from each file.
Although settings that come from these configuration files are displayed in the User Defined build settings section (just like any other user-defined flag that one would create from the GUI), they are not written to the .xcodeproj file like the settings that one adds from the GUI are (which probably prevents them from being able to be deleted from the GUI).  They are also not displayed in bold text like these GUI-added settings are.


text:
Q: Issues using wireless network interface after attempting to use it as an access point for hotspotting I was following random tutorials attempting to create a private Wifi network on my laptop that would forward my ethernet internet connection on my laptop to other devices on my private network. Clearly I didn't know what I was doing and after some really poor attempts I attempted to undo all my changes and at the moment I'm still suffering from the issue of trying to get my wireless interface to connect to my wifi again. For now I can only use USB/Ethernet tethering to connect to the internet.

However the network interface is still listed and recognizable.
lshw -C network
    *-network
       description: Ethernet interface
       product: Ethernet Connection I218-LM
       vendor: Intel Corporation
       physical id: 19
       bus info: pci@0000:00:19.0
       logical name: eno1
       version: 04
       serial: f0:1f:af:4e:4a:b8
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k duplex=full firmware=0.7-3 ip=10.17.20.118 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:52 memory:f7e00000-f7e1ffff memory:f7e3c000-f7e3cfff ioport:f080(size=32)
  *-network UNCLAIMED
       description: Network controller
       product: Wireless 7260
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:02:00.0
       version: 73
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress cap_list
       configuration: latency=0
       resources: memory:f7d00000-f7d01fff
  *-network
       description: Ethernet interface
       physical id: 2
       logical name: docker0
       serial: 02:42:07:32:b8:da
       capabilities: ethernet physical
       configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=172.17.0.1 link=no multicast=yes

I can attach additional info upon request, can show running services too. Lost links of all tutorials I attempted (sorry) but here's two of them:
https://medium.com/@arnab.k/ubuntu-how-to-setup-a-wi-fi-hotspot-access-point-mode-192cbb2eeb90
https://www.linuxuprising.com/2018/09/how-to-create-wi-fi-hotspot-in-ubuntu.html
Network manager service status
     Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2020-04-07 14:45:39 EDT; 21min ago
       Docs: man:NetworkManager(8)
   Main PID: 1059 (NetworkManager)
      Tasks: 3 (limit: 9368)
     Memory: 14.7M
     CGroup: /system.slice/NetworkManager.service
             └─1059 /usr/sbin/NetworkManager --no-daemon

Apr 07 14:47:33 jab NetworkManager[1059]: <info>  [1586285253.5584] device (usb0): state change: activated -> unmanaged (reason 'removed', sys-iface-state: 'removed')
Apr 07 14:47:33 jab NetworkManager[1059]: <info>  [1586285253.5800] dhcp4 (usb0): canceled DHCP transaction
Apr 07 14:47:33 jab NetworkManager[1059]: <info>  [1586285253.5800] dhcp4 (usb0): state changed bound -> done
Apr 07 14:47:33 jab NetworkManager[1059]: <info>  [1586285253.5895] modem["ttyACM0"]: modem state changed, 'disabled' --> 'enabling' (reason: user preference)
Apr 07 14:47:33 jab NetworkManager[1059]: <info>  [1586285253.5899] manager: (ttyACM0): new Broadband device (/org/freedesktop/NetworkManager/Devices/6)
Apr 07 14:47:33 jab NetworkManager[1059]: <info>  [1586285253.5905] device (ttyACM0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
Apr 07 14:47:33 jab NetworkManager[1059]: <info>  [1586285253.5911] device (ttyACM0): modem state 'enabling'
Apr 07 14:47:33 jab NetworkManager[1059]: <info>  [1586285253.5926] device (ttyACM0): state change: unavailable -> disconnected (reason 'none', sys-iface-state: 'managed')
Apr 07 14:47:34 jab NetworkManager[1059]: <info>  [1586285254.2751] modem["ttyACM0"]: modem state changed, 'enabling' --> 'enabled' (reason: user-requested)
Apr 07 14:47:34 jab NetworkManager[1059]: <info>  [1586285254.3673] modem["ttyACM0"]: modem state changed, 'enabled' --> 'registered' (reason: unknown)

iwconfig
docker0   no wireless extensions.

wlp2s0    IEEE 802.11  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=0 dBm
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on

eno1      no wireless extensions.

lo        no wireless extensions.

Software & Updates

I know this is a software (most likely driver) issue because I dual boot on this computer and on my Windows OS I can still access the internet.
Thanks again!

A: Forgot how I removed the drivers for the Wireless 7260 but afterwards I attempted to install the backport iwlwifi driver. Removed it after following these two posts advice and without updating I was good to go. Sorry I didn't document this better.
https://askubuntu.com/questions/1203808/network-password-rejected-after-installing-backport-iwlwifi-dkms
https://www.reddit.com/r/elementaryos/comments/es4bst/psa_careful_installing_the_backport_iwlwifi_driver/


text:
Q: Saving a file in an internal directory proper to an Android library I'm working on an Android library that's meant to be used by multiple applications. The library needs to save data to a file that can be accessed by any of these applications.
Let's say I have two applications that use this library:

*

*package com.example.app1

*package com.example.app2

And that my library is under

*

*package com.library.sdk

When the library running under app1 tries to save a file to internal storage, it is saved under com.example.app1. So if app2 wants to get access to that file, it needs to look under com.example.app1 using a ContentProvider, for example. The problem is that if app1 is uninstalled, the data saved in the file also vanishes.
Is there no way to let the library save the file to its own internal storage (i.e. under com.library.sdk)? I tried, but seem to get access violations. But shouldn't this be possible given that the library is it's own packaged project/jar?


text:
Q: r - How can I "add" additional information to column names without altering the names themselves? I have a matrix with individual column names (the row names are not important), like this
TestMat<-matrix(1:25,ncol=5,nrow=5)
colnames(TestMat)<-c("A","B","C","D","E")
TestMat

For various reasons, but mostly because a package will later need it, I can't alter the values in the matrix and they all have to be integers.
Now I want to categorize my colum names (e.g. A, B and D into "Group 1" and C and E into "Group 2"). The idea is, that the matrix will get smaller later on, as values in the matrix are randomly diminished. As soon as a column-sum reaches zero, that column will be dropped. Along this process I want to see how the fraction/size of one group changes, compared to the other groups.
I thought the easiest way would be to just name all the corresponding columns identical:
TestMat2<-matrix(1:25,ncol=5,nrow=5)
colnames(TestMat2)<-c("Group1","Group1","Group2","Group1","Group2")
TestMat2

But this gives me error-messages later on in the analysis, as R starts numbering the identical column-names in a way of "Group1" "Group1.1" "Group2" "Group1.2" "Group2.1".
I have tried my luck with "class", "attr" and "factor" commands to my column names, but don't get anywhere.
Is there a trick or command, I've maybe never heard of?

A: as per the comments why not put the grouping in another variable then something like:
> TestMat<-matrix(1:25,ncol=5,nrow=5)
> colnames(TestMat)<-c("A","B","C","D","E")
> F=factor(c("Group1","Group1","Group2","Group1","Group2"))

... do something to your matrix...
> summary(F[colSums(TestMat) >= 40])
Group1 Group2
     1      2

Is that it (subs. 40 for 0)?

A: The Bioconductor package Bioboase defines a class ExpressionSet that allows annotations on rows and columns of a matrix
library(Biobase)
exprs = matrix(1:25,ncol=5,nrow=5, dimnames=list(NULL, LETTERS[1:5]))
df = data.frame(grp=c("Group1","Group1","Group2","Group1","Group2"),
                row.names=colnames(exprs))
eset = ExpressionSet(exprs, AnnotatedDataFrame(df))

You can access columns in the data frame with $, subset with [, and extract with exprs(), e.g.,
> exprs(eset[, eset$grp == "Group1"])
  A  B  D
1 1  6 16
2 2  7 17
3 3  8 18
4 4  9 19
5 5 10 20

or
> eset[,colSums(exprs(eset)) > 40]$grp
[1] Group2 Group1 Group2
Levels: Group1 Group2

The GenomicRanges package defines a similar class SummarizedExperiment when the rows are annotated with genomic ranges.
This coordinated integration of data and annotation on data is a really good thing, reducing the chance for 'clerical' errors when matrix and annotation are independent; I'm surprised so many comments suggest that you separately maintain two structures.

A: Thanks for all the helpful comments. I haven't posted here since my original post, because I first wanted to try all promising approaches and find a final solution to my problem.
I tried the Biobase package with its option for annotations, as well as Stephen's idea of grouping everything via a second variable.
As it turned out, as soon as the matrix diminished in size (as a part of the analysis) the external grouping failed, as column-numbers and grouping didn't match anymore and I couldn't find a way to combine the Bioconductor approach and my code.
I found a (somewhat roundabout) solution, though, if anybody cares:
I already stated, that, if I group my column-names identical for grouping, R later numbers my groups and they are thus not idential any longer.
But I then just searched for the first such-and-such neccessary letters to identify the proper group:
length(colnames(TestMat2)[substr(colnames(TestMat2),1,6) == "Group1"])

This way I can always check the fraction of one group of columns versus the others.
Thanks for your answers and help. I learned a lot and I think Bioconductor will come in handy in the future.
Cheers!


text:
Q: How can I extract files with names more than 260 characters in Windows 7? I am downloading lot of stuff in rar files on Windows. But when I extract them, I get a 260 character limit problem.
I can make the path shorter, but is there any way I can extract the files in such a way that the problem doesn't occur?

A: You can try creating a folder in the root directory of one of your hard drives, naming this new folder with a one-letter name; then, extract into that folder. Hopefully this will make the total file name (including the path) short enough allow you to get access to the files.

A: As shown on the Wikipedia Page for NTFS, the maximum length for a filename (including the path) is 255 characters. Using a different tool will not likely fix the issue you are having. What you will need to do is extract to a very short-named folder on the root of a drive. Depending how the archive is packed, you may need to select some files manually, or rename folders, to get it working properly.
Another method is to use the SUBST command to substitute a long pathname that you are extracting to as a new drive. As an example, you can run SUBST x: C:\Users\MyUsername\Desktop\ExtractedArchive. You will only be able to access the longer files through the new drive, but you can at least extract the files and move them to wherever you may need them to be.

A: I had the same issue. I used 7-zip for extracting and it worked like a charm.


text:
Q: Modify the "exec cwd" path of the process -PM2 I have multiple processes that run on the server.

*

*Each of the processes is placed in it's own directory.

*All of them are controlled by PM2

*Each process is supposed to have config and ecosystem files within their folders

*Root folder is supposed to be empty and not related to any processes.

One process that was set up incorrectly. I had to make it work (without touching things that do) so for this process :

*

*Pm2 show (id) indicated that the exec cwd is running from root so:

*Copy essential folders and files of the root folder

*Config folder, logs, other essentials had to be copied

I would like to redirect the process from root to its own folder.
It seems I can do it simply by modifying the exec cwd but I don't know how to do it.
Please help :)
Cheers

A: Ok well.
It seems it is impossible to modify it like this as this functionality is not implemented.
Therefore:

*

*copy ecosystem and what you need from folder you are in to where you want it to run from

*delete the process completely

*do cd {path to your desired directory}

*pm2 start ecosystem.config.js

//Additional if you want to keep the process old Id

*

*pm2 kill (deletes all processes)

*pm2 resurrect (restores them all with original id's)


text:
Q: Create Pandas TimeSeries from Data, Period-range and aggregation function Context
I'd like to create a time series (with pandas), to count distinct value of an Id if start and end date are within the considered date.
For sake of legibility, this is a simplified version of the problem.
Data
Let's define the Data this way:
df = pd.DataFrame({
    'customerId': [
        '1', '1', '1', '2', '2'
    ],
    'id': [
        '1', '2', '3', '1', '2'
    ],
    'startDate': [
        '2000-01', '2000-01', '2000-04', '2000-05', '2000-06',
    ],
    'endDate': [
        '2000-08', '2000-02', '2000-07', '2000-07', '2000-08',
    ],
})

And the period range this way:
period_range = pd.period_range(start='2000-01', end='2000-07', freq='M')

Objectives
For each customerId, there are several distinct id.
The final aim is to get, for each date of the period-range, for each customerId, the count of distinct id whose start_date and end_date matches the function my_date_predicate.
Simplified definition of my_date_predicate:
unset_date = pd.to_datetime("1900-01")

def my_date_predicate(date, row):
    return row.startDate <= date and \
           (row.endDate.equals(unset_date) or row.endDate > date)

Awaited result
I'd like a time series result like this:
        date customerId customerCount
0   2000-01          1             2
1   2000-01          2             0
2   2000-02          1             1
3   2000-02          2             0
4   2000-03          1             1
5   2000-03          2             0
6   2000-04          1             2
7   2000-04          2             0
8   2000-05          1             2
9   2000-05          2             1
10  2000-06          1             2
11  2000-06          2             2
12  2000-07          1             1
13  2000-07          2             0

Question
How could I use pandas to get such result?

A: Here's a solution:
df.startDate = pd.to_datetime(df.startDate)
df.endDate = pd.to_datetime(df.endDate)
df["month"] = df.apply(lambda row: pd.date_range(row["startDate"], row["endDate"], freq="MS", closed = "left"), axis=1)
df = df.explode("month")

period_range = pd.period_range(start='2000-01', end='2000-07', freq='M')

t = pd.DataFrame(period_range.to_timestamp(), columns=["month"])
customers_df = pd.DataFrame(df.customerId.unique(), columns = ["customerId"])
t = pd.merge(t.assign(dummy=1), customers_df.assign(dummy=1), on = "dummy").drop("dummy", axis=1)
t = pd.merge(t, df, on = ["customerId", "month"], how = "left")
t.groupby(["month", "customerId"]).count()[["id"]].rename(columns={"id": "count"})

The result is:
                       count
month      customerId
2000-01-01 1               2
           2               0
2000-02-01 1               1
           2               0
2000-03-01 1               1
           2               0
2000-04-01 1               2
           2               0
2000-05-01 1               2
           2               1
2000-06-01 1               2
           2               2
2000-07-01 1               1
           2               1

Note:

*

*For unset dates, replace the end date with the very last date you're interested in before you start the calculation.

A: You can do it with 2 pivot_table to get the count of id per customer in column per start date (and end date) in index. reindex each one with the period_date you are interested in. Substract the pivot for end from the pivot for start. Use cumsum to get the cumulative some of id per customer id. Finally use stack and reset_index to bring to the wanted shape.
#convert to period columns like period_date
df['startDate'] = pd.to_datetime(df['startDate']).dt.to_period('M')
df['endDate'] = pd.to_datetime(df['endDate']).dt.to_period('M')

#create the pivots
pvs = (df.pivot_table(index='startDate', columns='customerId', values='id',
                      aggfunc='count', fill_value=0)
         .reindex(period_range, fill_value=0)
      )
pve = (df.pivot_table(index='endDate', columns='customerId', values='id',
                      aggfunc='count', fill_value=0)
         .reindex(period_range, fill_value=0)
      )
print (pvs)
customerId  1  2
2000-01     2  0 #two id for customer 1 that start at this month
2000-02     0  0
2000-03     0  0
2000-04     1  0
2000-05     0  1 #one id for customer 2 that start at this month
2000-06     0  1
2000-07     0  0

Now you can substract one to the other and use cumsum to get the wanted amount per date.
res = (pvs - pve).cumsum().stack().reset_index()
res.columns = ['date', 'customerId','customerCount']
print (res)
       date customerId  customerCount
0   2000-01          1              2
1   2000-01          2              0
2   2000-02          1              1
3   2000-02          2              0
4   2000-03          1              1
5   2000-03          2              0
6   2000-04          1              2
7   2000-04          2              0
8   2000-05          1              2
9   2000-05          2              1
10  2000-06          1              2
11  2000-06          2              2
12  2000-07          1              1
13  2000-07          2              1

Note really sure how to handle the unset_date as I don't see what is used for


text:
Q: Azure Active Directory Getting code 403 with Client Credentials Grant I have an Azure Function that I have secured using Azure Active Directory  (using express settings)
I generated an secret key and was able to get the other bits required (client id, tenant etc).I followed this guide to test the Client Credentials
https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols-oauth-client-creds .
I was able to get an access token but when I try to access the function using the Bearer Token I get error code 403 with 'You do not have permission to view this directory or page.'
How can I fix this? I want to secure my Azure function using a secret key.
Edit ----------
I want to access my Azure function http endpoint.
The requests I have used:
POST https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token/

With body:
client_id:{Application Id in Azure AD}
scope:https://{functionname}.azurewebsites.net/.default // This might be the source of the problem
client_secret:{Key Generated}
grant_type:client_credentials

This returns an access token eyJ0eXAiOiJKV1QiLCJhbGciOiJS.....
Then
Get  http endpoint of my AzureFunction
https://{functionName}.azurewebsites.net/api/endpoint?Params
The Header contains Authorization Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS.....


text:
Q: On a mysterious reference of Grothendieck These days I found a mysterious page on Google books describing a book entitled On the De Rham cohomology of schemes by Grothendieck, Coates, and Jussila.
At once I thought this was an error and Google books had miss-indexed Exposé IX of Dix Exposés sur la Cohomologie de Schémas. However, the references diverge both in their titles:

Crystals and the De Rham Cohomology of Schemes
vs.
On the De Rham cohomology of schemes,

as well as their numbers of pages (53 in Dix Exposés vs. 106 in this reference).
The book is even cited in Cisinski 's Habilitation thesis as

[Gro66]    A. Grothendieck « On the de Rham cohomology of schemes » Publ. Math. IHES 29 (1966), p. 93--103.

Maybe this is "On the de Rham cohomology of algebraic varieties", but again, the references diverge in page number and title.
So, does this book really exists, and, if so, is it available anywhere?

A: I think your hunch is correct  that Google is in error, and that "Crystals and the de Rham cohomology of schemes" refers to the article in Dix Exposés. I doubt there is a book by the same name and author. There is also "On the de Rham cohomology of algebraic varieties" but that's different. The first is a long proposal for crystalline cohomology (which hadn't been developed at that point), and the second is an extract from a letter to Atiyah giving  a proof of the algebraic de Rham theorem. Does that help?

A: As an addendum to Donu's answer, I quote from the Table des matieres of Dix Exposés:

IX GROTHENDIECK (Alexander), Crystals and the De Rham Cohomology of schemes (notes by I. Coates and O. Jussila), IHES Decembre 1966, 54 p.

So it is certainly Dix Exposés. And "I. Coates" is most likely John Coates. According to Wikipedia Coates was born in '45 (so he would've been 21 at the time), and he moved to Paris to study at the ENS after obtaining a Bachelor's degree from ANU.


text:
Q: MS Chart line draw issue I'm trying to draw a line between a clicked DataPoint and the Y-Axis. I'm adding a new series for drawing the line. My X-axis contains dates. The problem is when I add the series to chart, the x-axis becomes blank.
I didn't updated the X-axis by code. I tried to comment the RecalculateAxesScale() but of no use.
Here is my code:
            longTermSeries = new Series("Long Term");

            ChartArea area = chart.ChartAreas["draw"];

            area.RecalculateAxesScale();
            area.AxisX.Minimum = chart.ChartAreas["draw"].AxisX.Minimum;
            area.AxisX.Maximum = chart.ChartAreas["draw"].AxisX.Maximum;
            area.AxisY.Minimum = chart.ChartAreas["draw"].AxisY.Minimum;
            area.AxisY.Maximum = chart.ChartAreas["draw"].AxisY.Maximum;

            chart.Series.Add(longTermSeries);

            longTermSeries.ChartType = SeriesChartType.Line;
            longTermSeries.Color = Color.Blue;

            longTermSeries.Points.Add(selectedDataPoint);
            longTermSeries.Points.Add(new DataPoint(area.AxisX.Maximum, selectedDataPoint.YValues[0]));


text:
Q: forms per PHP into mySQL DB I'm new to PHP and mySQL, and I'm trying to make a simple form that posts into my DB. The connection (via connect.php) works and I can add data manually via PHP.
Here's the code I've written so far (without the basic html, body, etc. tags):

enterinfo.php
<?php
    include "..\htdocs\connect.php";
?>

<form action="datarecord.php" method="post">

    ID
    <input type="integer" name="ID" size="30" />

    Firstname
    <input type="text" name="Firstname" size="30" />

    Lastname
    <input type="text" name="Lastname" size="30" />

    ZIPCODE
    <input type="text" name="ZIPCODE" size="30" />

    <input type="submit" value="Submit" />

datarecorded.php
<?php
    include "..\htdocs\connect.php";

    $id = $_POST['ID'];
    $firstname = $_POST['Firstname'];
    $lastname = $_POST['Lastname'];
    $zip = $_POST['ZIPCODE'];

    $query = "INSERT INTO employees (ID, Firstname, Lastname, ZIPCODE)
                VALUES ($id, $firstname, $lastname, $zip)";

    $result = mysqli_query($myConnection, $query);

    echo $query;
 ?>

I also don't know if I have to include connect.php in both files. The echo in datarecord.php correctly displays what I entered in enterinfo.php - but the data doesn't go into the actual Database.
Any help would be greatly appreciated!


text:
Q: SQL UNION doesn't check for matching column names -- is it up to me? I'm very surprised that UNION simply concatenates the rows without checking if the column names match.
For example,
SELECT
    1 AS bar,
    2 AS foo

UNION ALL

SELECT
    10 AS foo,
    20 AS bar

produces
bar foo
1   2
10  20

whereas I would expect SQL to complain that the first column is not of the same name across two tables.
Is this the intended behavior of SQL? If so, it seems like a huge opportunity for semantic error to me. What are ways I can use to guard against making this mistake? For large UNION with lots of columns, how to ensure that the columns line up in the same order other than manually checking it?

A: For UNION  does not matter what is your your two tables column name.
The UNION operator is used to combine the result-set of two or more SELECT statements.

*

*Each SELECT statement within UNION must have the same number of
columns

*The columns must also have similar data types

*The columns in each SELECT statement must also be in the same order
SELECT 1 AS bar, 2 AS foo   -- here number of column in both table is same and data type also same so its fulfill condition on union
UNION ALL
SELECT  10 AS foo, 20 AS bar

even if if you write below sql it will work fine causes here column data type order and number of column is same
SELECT 1 AS bar, 2 AS foo
UNION ALL
SELECT  10 , 20

so it  does not throw any error

A: Column names of the result are determined by the uppermost part of a union query, thereafter all subsequent column names are ignored..
However, the number of columns returned by all parts of the union must be equal, and each column must also "be of compatible" data types (e.g. decimal and integer in the same column are "compatible").
Like the column names the data type of each column is determined by the uppermost part of a union query. On occasion it can be useful to cast to a wanted data type. e.g.
SELECT 1 AS foo, CAST(2 AS DECIMAL(12,4)) AS bar
UNION ALL
SELECT  10 , 20

or
SELECT 1 AS foo, CAST(NULL AS DECIMAL(12,4)) AS bar
UNION ALL
SELECT  10 , 20


text:
Q: Python GTK Color Chooser Widget - Set Color I am writing a program using Python3 and GTK3 (via gi.repository). I want the color chooser to change its selected color when a RGB value is typed in the entry box and "Convert" is clicked. The "set_rgba()" command (found at http://learngtk.org/tutorials/python_gtk3_tutorial/html/colorchooser.html) is not changing the selected color. No error messages are generated (I executed the Python script from a terminal).

The file contains functions for each button, so I will include the relevant snippets of code.
class ColorWin():
    """Color Dialog"""
    def __init__(self):
        self.ui = Gtk.Builder()
        self.ui.add_from_string(buffer=_GCOLOR)
        global _cc
        global _entry_rgb, _entry_hsi, _entry_hsl
        global _entry_hsv, _entry_cmyk, _entry_yiq
        _cc = self.ui.get_object('cc')
        _entry_rgb = self.ui.get_object('entry_rgb')
        _entry_hsi = self.ui.get_object('entry_hsi')
        _entry_hsl = self.ui.get_object('entry_hsl')
        _entry_hsv = self.ui.get_object('entry_hsv')
        _entry_cmyk = self.ui.get_object('entry_cmyk')
        _entry_yiq = self.ui.get_object('entry_yiq')
        # Match signal to function (handler)
        dic = {
            '_winexit' : Gtk.main_quit,
            '_submit_color': self._submit_color,
            'conv_color': self.conv_color,
            'conv_rgb': self.conv_rgb,
            'conv_hsi': self.conv_hsi,
            'conv_hsl': self.conv_hsl,
            'conv_hsv': self.conv_hsv,
            'conv_cmyk': self.conv_cmyk,
            'conv_yiq': self.conv_yiq,
        }
        self.ui.connect_signals(dic)

The function for the convert button
def conv_rgb(self, _entry_rgb):
    """Convert RGB to *"""
    _rgb = _entry_rgb.get_text()
    _round = 6
    _red = re.sub('\(([0-9.]+), ([0-9.]+), ([0-9.]+)\)', r'\1', _rgb)
    _green = re.sub('\(([0-9.]+), ([0-9.]+), ([0-9.]+)\)', r'\2', _rgb)
    _blue = re.sub('\(([0-9.]+), ([0-9.]+), ([0-9.]+)\)', r'\3', _rgb)
    _red = round(float(_red), _round)
    _green = round(float(_green), _round)
    _blue = round(float(_blue), _round)
    _rgba_gdk = Gdk.RGBA(_red, _green, _blue, 1.000)
    _cc.set_rgba(_rgba_gdk)

I have used print functions to print the value of each variable to the terminal. I have verified that the values and datatypes are correct. The "_rgba_gdk" is an Gdk.RGBA object (as it should be). "_cc" is the color chooser. I can use _cc.get_rgba() to get the currently selected value. However, I want to change it (via _cc.set_rgba(_rgba_gdk)) to the value in the RGB entry box (gotten from _entry_rgb.get_text()). This will allow users to see the color associated with the typed RGB value (the alpha is assumed to be 1 if no alpha is specified).

A: The problem seems to be get/set_rgba() is working with the currently selected color in the widgets "swatch" mode but not the editor mode (show-editor=True). When in editor mode, changing the editor updates the current color as well, but the data binding is not bi-directional. All I can offer is a hack which forces the editor to update after a new color is set:
from gi.repository import Gtk
from gi.repository import Gdk

window = Gtk.Window()
window.connect("destroy", Gtk.main_quit)

box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
window.add(box)

colorchooser = Gtk.ColorChooserWidget(show_editor=True)
box.add(colorchooser)

entry = Gtk.Entry(text='0.5, 0.5, 0.5, 1.0')
box.add(entry)

def on_button_clicked(button):
    values = [float(v) for v in entry.get_text().split(',')]
    colorchooser.set_rgba(Gdk.RGBA(*values))
    colorchooser.set_property("show-editor", True)

button = Gtk.Button(label="Parse RGBA")
button.connect("clicked", on_button_clicked)
box.add(button)

window.show_all()
Gtk.main()

Note colorchooser.set_property("show-editor", True) in the button clicked callback. This may or may not work in all versions of GTK+. I would log this as a bug requesting the color editor mode be updated if set_rgba() is called:
https://bugzilla.gnome.org/enter_bug.cgi?product=gtk%2B


text:
Q: Bootstrap Carousel - random order I'm using this example for a carousel
https://bootsnipp.com/snippets/vvN6a
I would like to randomise the image order. I'm not having much joy. Can anyone help?

A: try adding this::
var randomSlide = Math.floor(Math.random() * $('#myCarousel .carousel-inner li').size());

jQuery(document).ready(function($) {
$('#myCarousel').carousel(randomSlide);
$('#myCarousel').carousel('next');
});


text:
Q: Update field with rownumber in oracle
Possible Duplicate:
Oracle: Updating a table column using ROWNUM in conjunction with ORDER BY clause

I have a query that returns an ordered set of records, and i want to copy the rownumber of each row in the result set into a particular field called Sequence on the record itself.
SELECT ROWNUM, ID
FROM (
    SELECT ID
    FROM MYTABLE
    WHERE PARENT = 1
    ORDER BY SEQUENCE ASC
)

I have the ID of each row, and the rownum I want to put in the SEQUENCE field.  How can I loop through this result set and update the table accordingly?

A: merge into mytable t
using (SELECT ROWNUM rn, ID
       FROM (
         SELECT ID
         FROM MYTABLE
         WHERE PARENT = 1
         ORDER BY SEQUENCE ASC
      )) S
on (t.id=s.id)
when matched then update set
  t.sequence=s.rn

If id is not unique, you can, for sure:
merge into mytable t
using (SELECT ROWNUM rn, rwd
       FROM (
         SELECT rowid rwd
         FROM MYTABLE
         WHERE PARENT = 1
         ORDER BY SEQUENCE ASC
      )) S
on (t.rowid=s.rwd)
when matched then update set
  t.sequence=s.rn

A: Please try:
  merge into EMP_MASTER x
  using (
          SELECT ID, ROW_NUMBER() OVER(ORDER BY SEQUENCE) y
          FROM MYTABLE
          WHERE PARENT = 1
         ) s on (s.ID=x.ID)
         when matched then update set
  x.sequence=s.y;

which works for unique IDs.


text:
Q: Object is NULL after using new I have this small error i can't get my head around. I kept getting the following error:
Warning: Creating default object from empty value

And i figured out it is because $newkey is NULL, What i don't understand is why it is null after i assign it?
$newKey = new AccessKey;
$newkey->_token = $data[0]['token'];
$newKey->_id = $data[0]['id'];
$newKey->_workforceid = $data[0]['workforce'];

The class itself looks like this
class AccessKey
{
    private $_id = -1;
    private $_token = "";
    private $_workforceid = -1;
}

Thanks in advance for any help

A: Issue #1
Check your casing.
You instantiate it as $newKey (capital K) but are using $newkey (small k) later on.
Issue #2
As @JaredFarrish mentioned, you also need to change the properties from private to public if you're going to set the properties outside the class.

A: try this:
$newKey = new AccessKey;
$newKey->_token = $data[0]['token'];
$newKey->_id = $data[0]['id'];
$newKey->_workforceid = $data[0]['workforce'];

instead of this
$newKey = new AccessKey;
$newkey->_token = $data[0]['token'];
$newKey->_id = $data[0]['id'];
$newKey->_workforceid = $data[0]['workforce'];

The problem is $newkey is different to $newKey
After if you want to set property class you need to change private to public if you want to set It out of the class
DEMO


text:
Q: Compute $\sum_{k=1}^{n+1} \binom{n}{k-2} \frac{2^k}{3^{2k-1}}$ Compute $$\sum_{k=1}^{n+1} \binom{n}{k-2} \frac{2^k}{3^{2k-1}}$$
$\sum_{k=1}^{n+1} \binom{n}{k-2} \frac{2^k}{3^{2k-1}}$

$k - 2 = t , k = t + 2$

$$\sum_{t=0}^{n} \binom{n}{t} \frac{2^{t+2}}{3^{2t+1}} - \binom {n}{n} \frac{2^n}{3^{2n}}$$
Let's simplify this:
$$\sum_{t=0}^{n} \binom{n}{t} \frac{2^{t+2}}{3^{2t+1}} =  \frac{4}{3}\sum_{t=0}^{n} \binom{n}{t} \frac{2^t}{3^{2t}}$$
Now let's calculate this: $\sum_{t=0}^{n} \binom{n}{t} \frac{2^t}{3^{2t}}$

$a = 1 , b = 2/9$

$$\sum_{t=0}^{n} \binom{n}{t} \frac{2^t}{3^{2t}} = (1+\frac{2}{9})^n$$
My final answer: $\frac{4}{3}(\frac{11}{9})^n - \frac{2^n}{3^{2n
}}$
Opinions?

A: Let $k-2=u$
$$=3\sum_{u=-1}^{n-1}\binom nu\left(\dfrac2{3^2}\right)^{u+2}=3\left(\dfrac2{3^2}\right)^2\sum_{u=0}^{n-1}\binom nu\left(\dfrac2{3^2}\right)^u$$
Now,
$$\sum_{u=0}^{n-1}\binom nu\left(\dfrac2{3^2}\right)^u=\left(1+\dfrac2{3^2}\right)^n-\binom nn\left(\dfrac2{3^2}\right)^n=?$$


text:
Q: Bounding Boxes appear when exporting to AIX with SVG icons I'm trying to make a series of Park maps and have a Point of Interest layer. I have SVG icons for all of the different POIs within the layer. Whenever I export the map to AIX, the SVG icons end up with a large bounding box around or near them. I cannot figure out where these boxes are coming from and how to turn them off. As a seperate but maybe related issue, the SVGs seem to lose some of their detail when exported.
Any idea what is going on here?


text:
Q: How to 'de-mux' a tri-state pin? I would like to use a single pin (tri-state buffer, 3.3V logic in case this matters) to drive two P-channel MOSFETs as high-side switches. Only one of them will be 'on' at any time. When the pin is in the high-impedance state (hi-Z), I would like both turned off.
The solution I came up with is to pull-up the hi-Z state (to 0.2*Vcc, see comments) and use two comparators (open collector type) to drive the FETs when the pin is in either the Lo or High state:

simulate this circuit – Schematic created using CircuitLab
I wonder: is there a better, easier or more elegant approach to this? Is this solution suitable for fast switching?

A: Hmm, maybe this isn't more elegant per say...
This can be solved by making a PMOS based inverter and an NMOS based inverter. An NMOS based inverter will invert a voltage around the threshold voltage for the NMOS, this voltage will be different for the PMOS based inverter. If both NMOS and PMOS transistors have threshold's that is less than half of VDD, then you will get a voltage range in between where both are inverting. That means in the following cases that neither of the output is on.
Here's one solution that only requires 4 transistors:

Here's the link if you want to interact with it. It's outputs are not two P-mos transistors, but this can be solved by adding a 5th transistor.
The reason for why I decided to share this schematic is that maybe your construction in space-limited, then this might be a good solution.
 The upper graph is the voltage at the gates of the leftmost transistors.  The middle graph is the voltage across the upper load.
 The bottom graph is the voltage across the bottom load.
A schematic, with 5 transistors, that works "ish" as you described would look like this:

Here's the link for this schematic.
 The upper graph is the voltage at the gates of the leftmost transistors.  The middle graph is the voltage across the upper load.
 The bottom graph is the voltage across the bottom load.

Here's the "ish" part from above:
Bleh, just realized that this only works if your output pin is within the output voltage stage VDD. So this design won't work with 12 V since your pin is probably only between 0 and 3.3/5 V. Oh well.

Edit
Here's a schematic... that will do what you want, but honestly, it's just messier than your solution. Unless you make your own custom ASIC with these transistors and internal resistors / current sources.

Here's the link for this schematic that
 The upper graph is the voltage at the gates of the leftmost transistors.  The middle graph is the voltage across the upper load.
 The bottom graph is the voltage across the bottom load.
With this solution, it works with 3.3 V and uses the logic inverters as level shifters as well.
But if I were you, I'd go with the solution you've come up with on your own. But with LM393 instead of LM319 because I'm a cheapskate and LM393 has somewhat smaller footprint (fewer pins).
But if high speed is what you need, then LM319 is the job for you, obviously, or my transistor/resistor solution with 1 kΩ instead of whatever 10k/100k they have now.

A: Inspired by Harry's reply, here's a solution that requires 3 resistors and a BJT transistor (plus the usual two N-channel MOSFETs and pull-ups to drive the P-channel MOSFETS). Input and output voltages are independent, e.g. you can control 12V from a 3.3V MCU or 5V from 5V logic:

simulate this circuit – Schematic created using CircuitLab
Simulation link above won't work, click here instead
Notes:

*

*In the Hi-Z state, R1/R2 pull-up the input voltage and must be adjusted so that "Test" is
(a) sufficiently lower than M1's gate threshold voltage to keep it cut off. For 2N7000, this should be less than 0.8V; and
(b) lower than the pin's maximum VIL to prevent excessive currents in the controller. For ESP8266, this is 0.25*Vcc, or less than 0.825V when running at 3.3V.

*In the HIGH state, the pin's output voltage must be sufficiently higher than M1's gate threshold. For a 2N7000, this should be at least 3V. Slightly lower voltages will probably work as well.

*The switched voltage (here: 12V) must be sufficient to fully turn on M3/M4. For the FQP27P06, you'll need about 8V. Select logic level MOSFETs if you need to switch lower voltages.

*For Q1, pretty much any NPN will do (e.g. 2N3904 or BC547). Pull-ups R3..R5 can be 10K, less if you need to switch at higher frequencies.

For a low side switch, get rid of M3/R3 and M4/R4 and connect your load directly to M1 and M2, probably upgrading them to something more suitable:

simulate this circuit
Simulation link above wont't work, click here instead.


text:
Q: ImportError: DLL load failed: The specified module could not be found. Caffe install I am trying to install caffe on my windows, I have correctly copy caffe lib under my python site-packages folder and installed protobuf. But I still get the error message:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 699, in runfile
    execfile(filename, namespace)
  File "C:\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)
  File "C:/Users/sworr/Desktop/caffe-ssd/examples/ssd/score_ssd_pascal.py", line 2, in <module>
    import caffe
  File "C:\Anaconda2\lib\site-packages\caffe\__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
  File "C:\Anaconda2\lib\site-packages\caffe\pycaffe.py", line 13, in <module>
    from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: DLL load failed: The specified module could not be found.

I am using Anaconda 4.0.0 64-bit. Please kindly help.

A: I solved this probkem by installing caffe using VS 2015 + CUDA 8.0 + Nvidia Titan X (pascal) by following the tutorial given by BLVC.
I think the solution to this issue is building the 'runtest' programs first.
cmake --build . --config %CMAKE_CONFIGURATION% --target install

I am using Anaconda 4.1.12 (64-bit) and windows 7 platform.
There also other matters needs attention:

*

*Remember to add the path of dependencies to your PATH environment.
CAFFE_DEPENDENCIES=%CAFFE_ROOT%\scripts\libraries
PATH=%PATH%;%CAFFE_ROOT%\scripts\libraries;%CAFFE_DEPENDENCIES%\bin;%CAFFE_DEPENDENCIES%\lib;%CAFFE_DEPENDENCIES%\x64\vc14\bin

*Remember to put cudnn library to cuda installation path.

*After build the runtest program, copy the caffe package to the Anaconda's site-package path:
copy %CAFE_ROOT%\python\caffe to %ANACONDA2_ROOT%\Lib\site-packages\

A: I solved this issue.
Please do not add caffe lib to site packages. It does not require. Please follow the BLVC installation guide when building the Caffe. Caffe will automatically download related dependencies and copy them to C:/Users/name/.caffe.
When you run the build_win.cmd, it will use those dependencies and create caffe lib inside the build directory.


text:
Q: Is there any way to write css such that particular style applies to a particular browser? I have external CSS in my project and it contains all the styles for the site, the site works well with FF but gets bad and mad in IE (as-usual).
So, Is there any way to write css such that particular style applies to a particular browser?
If I have a class say:
.col2{ width:237px; }

How can I edit the above class to apply with different width in IE and FF?
NOTE: I DONT NEED JAVASCRIPT TO IDENTIFY THE BROWSER.

A: I think Paul Irish came up with the most elegant solution:
http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/

A: http://www.quirksmode.org/css/condcom.html
Conditional comments are your friend!
If you just need it to work in IE6 you could you the * html 'hack':
define your CSS:
.acol {
width: 100px;
}

then define a style for IE6 to override:
* html .acol {
width: 200px;
}

The second part for IE6 always needs to come AFTER the original declaration

A: The best way is to specify specific css file(s) for IE using conditional comments: http://www.quirksmode.org/css/condcom.html
Another way are CSS hacks but they are messy and usually not welcome (nowadays): http://www.webdevout.net/css-hacks

A: There is a jQuery plugin called the CSS Browser selector.
You basically put tell the CSS which browser it is for, without the need for conditional comments or anything:
.ie .myDiv
{background-color: #f00;}

.webkit .myDiv
{background-color: #00f;}

It's really easy to setup and use :)


text:
Q: Как отправить данные из фрагмента в адаптер? Имеется CheckBox во фрагменте, и с помощью него у меня должен изменяться цвет объекта в адаптере. Как я понял, сделать это можно только через отправку данных в с фрагмента в адаптер. То есть если у CheckBox значение isChecked, то по нажатию на кнопку "Сохранить" в адаптере изменяется цвет объекта.
Код фрагмента:
class Fragment: Fragment() {

private lateinit var mDBViewModel: DBViewModel

override fun onCreateView(
    inflater: LayoutInflater, container: ViewGroup?,
    savedInstanceState: Bundle?
): View? {

    val view = inflater.inflate(R.layout.fragment1, container, false)

   //Это кнопка сохранения записи во фрагменте
    view.add_button.setOnClickListener {
        insertDataToDataBase()
    }

    return view
}

private fun insertDataToDataBase() {
        val Name = addName_ed.text.toString()

        //Проверка на символы в EditText
        if (inputCheck(Name)){

            //Создание записи
            val dB = DB(0, firstName)

            //Добавление записи в БД
            mDViewModel.addDB(db)
            Toast.makeText(requireContext(),"Запись создана!", Toast.LENGTH_LONG).show()

            if (CheckBox.isChecked){
            //Под моим пониманием, именно здесь должна происходить проверка на отправку данных при нажатии на кнопку Сохранить

            }
          findNavController().navigate(R.id.action_Fragment_to_listFragment)
        }
        else{
            Toast.makeText(requireContext(), "Пожалуйста, заполните строку заголовка.", Toast.LENGTH_SHORT).show()
        }
    }
}

Код адаптера:
class ListAdapter(private var mDBViewModel:DBViewModel): RecyclerView.Adapter<ListAdapter.MyViewHolder>() {

    private var dBList = emptyList<DB>()

    class MyViewHolder(itemView: View):RecyclerView.ViewHolder(itemView){

    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
        val viewFr = LayoutInflater.from(parent.context).inflate(R.layout.custom_r, parent, false)
        return MyViewHolder(viewFr)

    }

    override fun getItemCount(): Int {
      return DBList.size
    }

    override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
        val currentItem = DBList[position]

        //Здесь, опять же, под моим пониманием должен происходить прием отправленных данных

        holder.itemView.z_txt.text = currentItem.Name

    }

    fun setData(db: List<DB>){
        this.DBList = db
        notifyDataSetChanged()
    }
}


text:
Q: Creating custom HTML templates with user input I'm currently working on a project where the user needs to fill in a form which will be converted into HTML.
For example the user fills in the next form:
    <form method="POST" action="">
      Edit title: <input type="text" name="title">

      Edit subtitle: <input type="text" name="subtitle">

      Edit image: <input type="file" />
      <input type="submit" value="OK" />
    </form>

And the output has got to be in HTML, something like this:

*Title*

*Subtitle*

Do you guys know a way to easily get this done?
Thanks in advance!
Edit: I forgot to mention that I prefer a client-side solution.

A: Easy way to do is..
Store data in Table MySQL and fetch data in php file
<?php
    //connection to database
    //database query
?>

<?php echo $rs['title']; ?>

<?php echo $rs['subtitle']; ?>

       <img src='<?php echo $rs['image']; ?>' />


text:
Q: If mySQL field is blank, insert value In my mySQL table, I have a 'reportstatus' column.  I have some values in this column already, however I need to update the column so that if any field in the column is empty, the value will be 'Pending'.
I have no clue how to write this script.  Any help would be appreciated.

A: UPDATE `mySQL` SET `reportstatus`='Pending' WHERE `reportstatus` IS NULL OR `reportstatus`=''


text:
Q: Defend Kaer Morhen - Choice outcome? In Kaer Morhen

at the meeting right before the fight against the Wild Hunt

I have to choose if I want potions or traps be made in the laboratory and if the wall or the forge should be repaired.
My questions here:

*

*What will I get if take the potions?

*What will I get if take the traps?

*What will happen / will I get if I repair the wall?

*What will happen / will I get if I repair the forge?

Update:
After I got the first answer I've to add that I need a more specific answer e.g. what sword/recipe would I get and do I have to place the traps by myself, are those usable items like bombs?

A: I went the traps and the wall. Both are automatic and reduce the numbers of battles needed. Used the YRDEN sign to close the portals (simpler than trying to toss bombs around).
You get a sword and potion if you go the other options but unless you've got to the fight without exploring much of the rest of the game they're likely to be useless.

A: If you choose potions you get Superior Swallow, and depending on finishing the side quest "Following the thread" a Fortified Raffard's Decoction.
The traps will kill some enemies in the battle.
Repairing the wall will mean one less wave of enemies attacking.
The forge will result in getting a silver sword.
The general theme is deciding between getting an item or recipe, and directly affecting the battle in some way. Getting the sword and potions might not be a good idea if you're already well equipped.

This information is based on various online guides, they are mostly in agreement but there is also some contradictory information.


text:
Q: Proving the equivalence of two inequalities Let $f:\mathbb{R} \to \mathbb{R}$ be a function that admits primitives on $\mathbb{R}$ and $F:\mathbb{R} \to \mathbb{R}$ one primitive (i.e. $F'(x)=f(x), \forall x \in \mathbb{R}$).
Prove that the following two inequalities are equivalent:
\begin{align}
a)&& (f(x)-f(y))(x-y) &\ge (x-y)^2, && \forall x, y \in \mathbb{R}
\\b)&& F(x)-F(y) &\ge \frac{1}{2}(x-y)^2+f(y)(x-y), &&\forall x, y \in \mathbb{R}
\end{align}
My approach was to prove $b) \implies a)$. It is obvious, because we if $b)$ is true for all pairs $(x, y)$ then it is true for $(y, x)$ by adding the two relations we obtain "$a)$". But I have not found a way to prove the converse statement. My first thought was to use the mean value theorem to get $F$ into the equation, but the mean value theorem implies the existence of a point, which would not satisfy the $\forall$ quantifier.

A: For any primitive $F$, $F(X) - F(Y) = \int_Y^X f(x) dx$. In the case $x>y$, ineq. $a)$ becomes
$$f(x) - f(y) \ge  x-y$$
Let $y \le Y \le  x \le X $. If we integrate this inequality in $x$ from $Y$ to $X$, we get
$$
F(X)-F(Y) - (X-Y)f(y) \ge \frac12(X^2 - Y^2) - y(X-Y) \tag{*}
$$
Making the choice $y=Y$ and $x=X$ we obtain
$$ F(x) -F(y) \ge \frac12(x^2 + y^2) - xy  + (x-y)f(y) = \frac12(x-y)^2 + (x-y)f(y) $$
Which is $b)$.
So we are done with $a)\implies b)$, for when $x>y$. The case $x=y$ is trivial.
For the case $x<y$, ineq. $a)$ instead becomes
$$ f(y)-f(x) \ge y-x$$
Integrating now in $x$ from $X$ to $Y$ (this time $X\le x\le Y\le y$) we get
$$ (Y-X)f(y)-(F(Y)-F(X))\ge y(Y-X) -\frac12(Y^2-X^2)$$
which is exactly inequality $(\text *)$ after rearranging, so setting $y=Y$ and $x=X$ again gives the result.


text:
Q: 2 jars generation from 2 profiles for different OS I am trying to create 2 jars from 2 approaches(Profiles and executiosn)
My target is to create both macJar.jar and windowsJar.jar which should have os specific swt dependency in it.
Is this possible from below appr?
Approach 1: Using profiles
Command: mvn clean install -Pwindows,mac  or mvn clean install -Pmac,windows  or mvn clean install -P windows,mac (space after -P)
Obeservations: In either commands approach only one jar is created with 'windowsJar.jar' .
    <profiles>
      <profile>
            <id>windows</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <jarName>windowsJar</jarName>
                <swt.groupId>org.eclipse.swt.org.eclipse.swt.win32.win32.x86.4.3.swt</swt.groupId>
                <swt.artifactId>org.eclipse.swt.win32.win32.x86</swt.artifactId>
                <swt.version>4.5</swt.version>
            </properties>

            <build>
                <plugins>
                    <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>3.0.0-SNAPSHOT</version>

                        <configuration>
                            <descriptorRefs>
                                <descriptorRef>jar-with-dependencies</descriptorRef>
                            </descriptorRefs>
                            <archive>
                                <manifest>
                                    <mainClass>org.test.test1.Mainclass</mainClass>
                                </manifest>
                            </archive>
                            <finalName>${jarName}</finalName>
                            <appendAssemblyId>false</appendAssemblyId>

                        </configuration>
                        <executions>
                            <execution>
                                <id>make-assembly</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>

                            </execution>
                        </executions>
                    </plugin>
                    </profile>

    <profile>
            <id>mac</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <jarName>macJAR</jarName>
                <swt.groupId>org.eclipse.swt.org.eclipse.swt.cocoa.macosx.x86_64.4.3.swt</swt.groupId>
                <swt.artifactId>org.eclipse.swt.cocoa.macosx.x86_64</swt.artifactId>
                <swt.version>4.5</swt.version>
            </properties>

            <build>
                <plugins>
                    <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>3.0.0-SNAPSHOT</version>

                    <configuration>
                            <descriptorRefs>
                                <descriptorRef>jar-with-dependencies</descriptorRef>
                            </descriptorRefs>
                            <archive>
                                <manifest>
<mainClass>org.test.test1.Mainclass</mainClass>

                                </manifest>
                            </archive>
                            <finalName>${jarName}</finalName>
                            <appendAssemblyId>false</appendAssemblyId>
                        </configuration>
                        <executions>
                            <execution>
                                <id>make-assembly</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
</profiles>

Approach 2: Using executions
Command: mvn clean install
Obeservations: In either commands approach only one jar is created with 'windowsJar.jar' .
              <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.0.0-SNAPSHOT</version>

                    <configuration>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <archive>
                            <manifest>
                                 <mainClass>org.test.test1.Mainclass</mainClass>

                            </manifest>
                        </archive>
                        <appendAssemblyId>false</appendAssemblyId>
                    </configuration>
                    <executions>
                        <execution>
                            <id>mac-make-assembly</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
<configuration>
             <classifier>mac</classifier>
           </configuration>

                        </execution>

                        <execution>
                            <id>windows-make-assembly</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                            <configuration>
             <classifier>windows</classifier>
           </configuration>
                        </execution>
                    </executions>
                </plugin>

A: In a maven build each property can have only one value. Defining a property value a 2nd time ends up overriding the first value, not splitting a project build into two branches. So when you activate two profiles and they both modify property value, one of them overrides the other.
In your case you need to distinguish two concepts: build environment vs. run environment.
Build environment
Your build needs to execute on some environment. It's important to have appropriate dependencies for running tests, etc. Obviously, tests won't run if you supply MacOS lib on Windows.
Run environment
It seems you have a requirement to create a separate distribution for each of the run environments. While tests can only run on a single build environment, you can bundle different jars to create different distributions from a single build.
Environment-specific tests
How important are you tests? Is it possible that some functionality is environment-specific and might break on a different OS? If that is true, you should just have two different builds and each distribution should be compiled, tested and packaged on its environment to ensure the tests are run properly. If that is the case, just keep your build as it is and ensure your CI server has at least one build agent per environment. Configure CI to always run this build once per environment, then simply pick final build results from both builds. This is clearly extra effort, but if your tests are important, it'll pay off in the long run.
No environment-specific tests
The alternative solution is to have one build environment, run any tests you might have only against that environment, but generate multiple distribution packages. I recommend splitting your project into three projects for this:

*

*"core" with the common parts

*"windows" distribution project with the windows-specific parts

*"mac" distribution project with the macos-specific parts

Create those environment projects even if the only difference is those SWT libraries. You CAN keep all of this as one project, but it'll likely be more pain than it's worth.
Subsequently:

*

*In core pom.xml: ensure core project generates proper jar. It'll need some dependency to compile, so you create one profile per build environment (you might have just one build environment, in that case no profile necessary) and in each profile define appropriate dependency with <scope>provided</scope> to ensure it's only used for compilation/testing.

*In windows/macos pom.xml: in each add dependency on both core and environment-specific libs (SWT in this case) with default scope. Your existing assembly plugin configuration will be moved to these two projects.
When you run builds, you only specify profile of the build environment, but you get both distribution packages every time.


text:
Q: I want to use jQuery cookie, but I cant find the cookie method What should I do, which is the best jQuery cookie  plugin?
Thanks.

A: Check out:

*

*Setting cookies with jQuery

*jQuery & Cookies (get/set/delete & a plugin)

A: You can use the jquery-cookie plugin available at Github: https://github.com/carhartl/jquery-cookie
You can set the cookie value by:
$.cookie('cookie_name', 'cookie_value');

And get the value back by:
var cval = $.cookie('cookie_name');

And delete the cookie by:
$.cookie('cookie_name', null);


text:
Q: Retrieving product list form openerp 7 I'm currently working on a mobile app that connects with an openerp 7 instance though XML-RPC.
Although xmlrpc comm between iOS & Openerp 7 works perfectly, I'm puzzled at which objects I need to interact with at the openerp side in order to get the product list with only the items I want and to post a sale.
Any one?
Thanx,
M

A: Working through XML-RPC is pretty much like working directly on the server, only slower.
To get the product list you'll need to interact wit product.product, and to narrow the list (and the data) you'll need to specify a domain such as domain=[('color','=','red'),('style','=','sport')] and fields=['id','name','...'].
Hopefully that's enough to get you going.


text:
Q: how to get initiator information for ajax request in angularjs I am working on a big and messy application in angularjs 1.3.13
somewhere in the middle of application an API is called, unfortunately, i cant
find out what controller or service is calling that API, so I opened networking tab in chrome dev tools to find initiator, but initiator is always set to angularjs
is there any way or tools that I can find out what controller or service is making a call to API?


text:
Q: JavaFx: java.io.FileNotFoundException (Access is denied) I am tring to create a file in C:\Program Files folder using javaFX, but it show me an error of access denied.
This is the code sample.
FileWriter fstream = new FileWriter("C:\\Program Files (x86)\\My Folder\\my_file.txt");
BufferedWriter out = new BufferedWriter(fstream);
out.write("Hello!");

This is the error which I found while running the application.
java.io.FileNotFoundException: C:\Program Files (x86)\My Folder\my_file.txt (Access is denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:104)
    at java.io.FileWriter.<init>(FileWriter.java:63)

I don't know how to allow my application with all the required permission to create files at specified location. Please help me with sufficient codes and information.

A: If you haven't explicitly disabled UAC you will not be able to write to Program Files. The OS will prevent that to protect your system.