text:
Q: Proving that all sets of size n have $2^n$ subsets I've tried to construct a proof for this using recursion. My knowledge of recursion and set theory in general is quite limited so I'd appreciate some feedback!
The claim in symbolic logic: $\forall n \in \mathbb N, \exists u \in U, S(u) \wedge |u| = n \Rightarrow \mathcal |P(u)| = 2^n$ where:
$U:$ the set of everything
$S(x):$ x is a set
Initial Value
Assume $n = 0$
Then $\exists u \in U, |u| = 0$
Then $ u = \varnothing $
Then $ |\mathcal P(u)| = | \{ \varnothing \} | = 1 = 2^0 $
Prove: $\forall n \in \mathbb N, \exists u, x \in U, [S(u) \wedge (x \notin u) \wedge (|u| = n) \wedge \mathcal |P(u)| = 2^n] \Rightarrow  [(|u \cup \{x\}| = n + 1) \wedge (|\mathcal P(u \cup \{x\})| = 2^{n + 1})]$
Assume $|u| = n$
Then $ |\mathcal P(u)| = 2^n$
Then $ |u \cup \{x\} | = n + 1$ because  $ |\{x\}| = 1$
Then $ \mathcal |P(u \cup \{x\})| = |\mathcal P(u)| * |\mathcal P(\{x\})| = 2^n * 2 = 2^{n+1} $
Is this convincing enough or do I need to add more?
EDIT: Fixed notation

A: Let $h_n$ be an $n$-bit string. i.e. A string consisting of 0's and 1's. Now let $S$ be your ground set with $n$ elements and $H \subseteq S$. If you label the elements of $S$ from 1 to $n$, given a fixed $H$, you can construct an $n$-bit string, say $h_n$ as follows, if $H$ has the 1st element, it has 1 in the first position and 0 otherwise. If $H$ has the second element, it has 1 in the 2nd position and 0 otherwise and so on...
For example if $S$ = {1,2,3,4,5,6} and $H$ = {2,4,6}, then $h_n$ is '010101'.
It is clear that given any subset, you can construct such an $n$-bit string. Conversely, given an $n$-bit string, you can construct a corresponding subset. In other words, there is a bijection from the set of $n$-bit strings to the set of all subsets of $S$. So the number of subsets of $S$ is equal to the number of $n$-bit strings which is $2^n$.
Alternate proof by induction:
Let the statement hold for all $n$ element sets. i.e. if $\vert S \vert = n$ then $S$ has $2^n$ subsets. Now suppose you add one more element $x_{n+1}$ to $S$ and call that set $S'$. Then all the subsets of $S'$ will be subsets of $S$ either with or without the new element $x_{n+1}$. In other words, for every $H \subseteq S$, there will be two subsets $H'$ and $H''$ of $S'$ given by $H' = H$ and $H'' = H \cup \{x_{n+1}\}$. So if $S$ has $2^n$ subsets, $S'$ will have $2 \times 2^n = 2^{n+1}$ subsets.

A: Recursion isn't neded here. If we have set of size $n$, then we can makes subsets of size $0,1,2,3...n$. Because the order of the elements in the set isn't important the number of ways we can choose subsets with size 0 is $\binom{n}{0}$. There are $\binom{n}{1}$ combinations for choosing subsets of size 1.
So the total number of subsets will be:
$$\sum_{k=0}^n \binom{n}{k} = 2^n$$
If you want a proof for this expression, here's one. Not that the sum is actually representing the sum of the numbers in $n^{th}$ row of the Pascal's triangle, where firs row is counted as 0. We know how to generate this triangle and we know that every number of the $n^{th}$ row is calculated twice in the sum of the next row. So the ratio between neighbour rows is $2$. This lead to geometric progresion: $ar^{n-1}$. We know that $a=1$ and $r=2$ so if we let our first row to be denoted as $n=0$, then the formula gets its final look:
$$\sum_{k=0}^n \binom{n}{k} = 2^n$$

A: First, do not use the concept of a "set of all sets."  Such a set cannot exist.  Please read this article for more info.
Second, start by letting $u_0 = \varnothing$ and $u_{i+1}=u_i \cup \{u_i\}$.  Specifically, note that this means that $u_2=\{\varnothing,\{\varnothing\}\}$.  Then you have guaranteed unique elements in $u_i$ for all $i$, and you can build an induction on it.  The powerset of $u_i$ and $u_{i+1}$ will be very easy to build and confirm as having $2^i$ and $2^{i+1}$ elements (respectively).
Finally, I believe that $|\mathcal P(u \cup \{x\})| = |\mathcal P(u)| * |\mathcal P(\{x\})|$ would need to be proven separately.

A: You can represent each subset of a set with $n$ elements by a sequence of $a_1...a_n$ where $a_i$ is either $0$ or $1$. $a_i=0$ means that the $i$th element of the set is not present in the subset. Now the number of all such sequences is $2\times 2\times ...\times 2=2^n$.

A: you have proved it for sets of size 0
now you have to prove:
if a set of  size n has $ 2^n $ different subsets
then a set of size n+1 has $ 2^{n+1} $ different subsets
and then you can use induction


text:
Q: How are Linux work queues working? I'm new to Linux device drivers writing and I'm trying to make a device driver that handles an UART chip. For this I decided to use work ques as my bottom half processing because I have to use some semaphores when handling the data that I get from the UART chip.
A work queue handler that was scheduled earlier in an interrupt now gets executed and during it's execution it will sleep at a semaphore. During this time the interrupt handler is called again and schedules the same work queue handler. Will the work queue handler be executed again before the first execution of it finishes ?
Thanks.

A: The default behavior of work queues is to allow concurrent execution on different CPUs. There is a flag WQ_NON_REENTRANT that changes this behavior. More information can be found in this post http://lwn.net/Articles/403891/
But it seems that in recent kernels work queues are non-reentrant by default - see
http://lwn.net/Articles/511190

redpajama_set_name: RedPajamaStackExchange


text:
Q: SVG icon does not highlight in drop-down menu Wordpress I am trying to achieve the same pink highlight in the accessories' menu option (the one at the bottom). For some reason, the "sock" icon is not highlighted in pink. Any ideas?
Website --> https://pinky.bg/
The SVG code of the properly highlighting icon Example ->
The code below is of the properly highlighting SVG in pink
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14" fill="none">
<path d="M13.8128 2.46322V0H4.15V2.54819L0 12.1176L0.210798 12.3016C0.290257 12.371 2.23431 14 8.99967 14C15.7653 14 17.7097 12.371 17.7892 12.3016L18 12.1176L13.8128 2.46322ZM4.8933 0.760031H13.0695V2.17259H4.8933V0.760031ZM15.5934 12.4793C13.4999 13.108 10.8522 13.24 9 13.24C7.14749 13.24 4.4998 13.108 2.40645 12.4793C1.64001 12.2491 1.16976 12.0173 0.919753 11.8717L4.79641 2.93262H6.50814L5.64566 6.84822L6.37082 7.01524L7.27006 2.93262H10.6928L11.592 7.01524L12.3172 6.84822L11.4547 2.93262H13.2033L17.0802 11.8717C16.8302 12.0173 16.3599 12.2491 15.5934 12.4793Z" fill="currentColor"></path>
</svg>

The SVg that is causing me troubles is
<!-- Generator: Adobe Illustrator 25.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="Layer_1" x="0px" y="0px" width="17px" height="18.9px" viewBox="0 0 17 18.9" enable-background="new 0 0 17 18.9">
<path d="M7.5,18.9c-0.3-0.1-0.6-0.1-0.8-0.2c-1.2-0.4-1.9-1.2-2.3-2.3c0,0,0-0.1-0.1-0.2c-0.1,0-0.2,0-0.3,0c-1.7,0.1-3.2-1-3.8-2.6  c-0.5-1.6,0.2-3.4,1.6-4.2c1.2-0.7,2.4-1.4,3.5-2c0.1-0.1,0.2-0.1,0.2-0.3c0-0.9,0-1.8,0-2.6c0-0.2,0.1-0.3,0.2-0.4  c0.1,0,0.3,0,0.4,0c0.1,0.1,0.2,0.2,0.2,0.3c0,1,0,2,0,3c0,0.2-0.1,0.3-0.3,0.4C5,8.4,4.1,8.9,3.2,9.5C3.1,9.5,3.1,9.5,3,9.6  c1,1.7,2,3.4,3,5.1c0.2-0.1,0.5-0.3,0.7-0.4c0.4-0.2,0.7-0.4,1.1-0.6c0.1-0.1,0.1-0.1,0.1-0.2c-0.4-1.8,0-3.3,1.2-4.6  C9.9,8,10.9,7.6,12,7.5c0,0,0.1,0,0.1,0c0-2.3,0-4.5,0-6.8c-0.3,0-0.6,0-0.9,0c0,0.3,0,0.6,0,0.9c0,0.1,0,0.2,0,0.3  c0,0.2-0.2,0.3-0.4,0.3c-0.2,0-0.3-0.2-0.3-0.4c0-0.3,0-0.6,0-0.9c0-0.1,0-0.1,0-0.2c-0.3,0-0.6,0-0.9,0c0,0.4,0,0.7,0,1.1  c0,0.3-0.3,0.5-0.5,0.4C8.9,2.1,8.8,2,8.8,1.8c0-0.3,0-0.7,0-1.1c-0.3,0-0.6,0-0.9,0c0,0.3,0,0.6,0,0.9c0,0.1,0,0.2,0,0.2  c0,0.2-0.2,0.3-0.4,0.3C7.3,2.2,7.1,2,7.1,1.8c0-0.4,0-0.7,0-1.1c-0.3,0-0.6,0-0.9,0c0,0.1,0,0.2,0,0.3c0,0.2-0.2,0.4-0.4,0.4  c-0.2,0-0.4-0.2-0.4-0.4c0-0.2,0-0.4,0-0.7C5.5,0.1,5.6,0,5.9,0c0.9,0,1.7,0,2.6,0c1.3,0,2.6,0,3.9,0c0.4,0,0.5,0.1,0.5,0.5  c0,0.7,0,1.4,0,2.2c0.1,0,0.1,0,0.2,0c1.2,0,2.3,0,3.5,0c0.3,0,0.5,0.1,0.5,0.5c0,3,0,5.9,0,8.9c0,1.5-0.7,2.6-2,3.3  c-1.7,1-3.4,1.9-5.1,2.9c-0.5,0.3-1.1,0.5-1.7,0.6c0,0,0,0,0,0C8,18.9,7.7,18.9,7.5,18.9z M12.9,3.4c0,0.1,0,0.2,0,0.3  c0,1.9,0,3.8,0,5.6c0,1.4-0.6,2.5-1.9,3.3c-0.8,0.5-1.5,0.9-2.3,1.3c-0.1,0.1-0.3,0.2-0.4,0.2c0.6,1.1,1.2,2.1,1.8,3.1  c0.7-0.4,1.3-0.7,1.9-1.1c-0.4-1.5-0.2-2.8,0.6-4.1c0.9-1.2,2.1-1.9,3.6-2c0-2.3,0-4.5,0-6.8c-0.3,0-0.6,0-0.9,0c0,0.3,0,0.7,0,1  c0,0.1,0,0.2-0.1,0.3c-0.1,0.1-0.2,0.2-0.4,0.1c-0.2-0.1-0.3-0.2-0.3-0.4c0-0.4,0-0.7,0-1.1C14,3.4,13.4,3.4,12.9,3.4z M2.3,9.9  c-1,0.6-1.5,1.4-1.6,2.5c0,1.2,0.5,2.1,1.5,2.7c1,0.5,2,0.5,3-0.1C4.3,13.4,3.3,11.7,2.3,9.9z M12.7,15.8c0,0,0.1,0,0.1-0.1  c0.7-0.4,1.3-0.8,2-1.2c0.4-0.2,0.7-0.5,1-0.9c0.6-0.8,0.5-1.8,0.5-2.7C13.8,11,12,13.5,12.7,15.8z M8.5,13.2  C8.6,13.1,8.6,13.1,8.5,13.2c0.8-0.4,1.5-0.8,2.2-1.2c0.2-0.1,0.3-0.2,0.5-0.4c1-0.9,1-2.1,0.9-3.3C9.8,8.3,7.8,10.6,8.5,13.2z   M7.6,14.6c-0.9,0.5-1.7,1-2.6,1.5c0.5,1.9,2.8,2.7,4.4,1.6C8.8,16.7,8.2,15.6,7.6,14.6z"></path>
<path d="M5.5,2.8c0-0.2,0.2-0.4,0.4-0.4c0.2,0,0.4,0.2,0.4,0.4C6.2,3,6,3.1,5.8,3.1C5.6,3.1,5.5,3,5.5,2.8z"></path>
</svg>


text:
Q: How to get the raw data of solutions of partial differential equation in mathematica I am using NDSolve command of mathematica solving a very complicated partial
differential equation (two independents "t" and "x", three master variable "u",
"v", "w"). Each time I solve it, it takes 10-20 minutes. So, I wish to save
the solution into an independent file.
I used command Export["myfile.m", nSol], where nSol is the output of NDSolve.
But the resulting mayflie.m is 160Mb. It's too large and contains much redundant
data. I wish to save only three two dimensional array u(t,x), v(t,x), w(t,x) on
points NDSolve obtaining the solution. I think that should not be as large as
160Mb.
Could anybody help me solving this problem?

A: Obtaining the computed function values on the grid is accomplished with
Needs["DifferentialEquations`InterpolatingFunctionAnatomy`"]
datau=InterpolatingFunctionValuesOnGrid[solu]
datav=InterpolatingFunctionValuesOnGrid[solv]
dataw=InterpolatingFunctionValuesOnGrid[solw]

where solu, solv, solw are the InterpolatingFunctions produced by NDSolve.  If you need the grid too, use
grid=InterpolatingFunctionCoordinates[solu]


text:
Q: Uncaught TypeError: Cannot read property 'fn' of undefined после использования bootstrap.min.js Не могу понять в чем дело. на странице Списка контактов в joomla 3 не работает bootsrap.min.js (bootstrap-4.0.0) и jquery.min.js 3.3.1, тогда как на остальных страницах все работает. к js обращаются 2 модуля - меню и слайдер, но они есть на любой странице.

Страница конкретного контакта открывается нормально. Использую  только bootsrap.min.js без map, так как  минифицировала bootstrap сама, были изменения.
Использую только это:

ошибки:

все возможные подключения к странице:
<title>Список сотрудников «Кәсіптік және техникалық оқыту» кафедрасы</title>
<link href="/joomla3/index.php/kz/spisok-sotrudnikov-k-siptik-zh-ne-tekhnikaly-o-ytu-kafedrasy?format=feed&type=rss" rel="alternate" type="application/rss+xml" title="RSS 2.0" />
<link href="/joomla3/index.php/kz/spisok-sotrudnikov-k-siptik-zh-ne-tekhnikaly-o-ytu-kafedrasy?format=feed&type=atom" rel="alternate" type="application/atom+xml" title="Atom 1.0" />
<link href="/joomla3/templates/mywkau/css/bootstrap.css?a44c081ffd8a1c5d1ae9cd19bd8f6076" rel="stylesheet" />
<link href="/joomla3/templates/mywkau/css/font-awesome.min.css?a44c081ffd8a1c5d1ae9cd19bd8f6076" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700&subset=cyrillic,cyrillic-ext" rel="stylesheet" />
<link href="/joomla3/templates/mywkau/css/main.css?a44c081ffd8a1c5d1ae9cd19bd8f6076" rel="stylesheet" />
<link href="/joomla3/modules/mod_joomspirit_slider/assets/css/style.css" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" media="all" />
<link href="/joomla3/media/mod_falang/css/template.css" rel="stylesheet" />
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="http://10.10.216.13/joomla3/modules/mod_pixsearch/media/css/mod_pixsearch.css" rel="stylesheet" />
<script type="application/json" class="joomla-script-options new">{"csrf.token":"33ccc4a841b8860f1045a9239365f633","system.paths":{"root":"\/joomla3","base":"\/joomla3"}}</script>
<script src="/joomla3/media/system/js/core.js?a44c081ffd8a1c5d1ae9cd19bd8f6076"></script>
<!--[if lt IE 9]><script src="/joomla3/media/jui/js/html5.js?a44c081ffd8a1c5d1ae9cd19bd8f6076"></script><![endif]-->
<script src="/joomla3/templates/mywkau/js/popper.min.js?a44c081ffd8a1c5d1ae9cd19bd8f6076"></script>
<script src="/joomla3/templates/mywkau/js/bootstrap.min.js?a44c081ffd8a1c5d1ae9cd19bd8f6076"></script>
<script src="/joomla3/templates/mywkau/js/main.js?a44c081ffd8a1c5d1ae9cd19bd8f6076"></script>
<script src="http://10.10.216.13/joomla3/modules/mod_pixsearch/media/js/pixsearch.js"></script>
<script src="http://10.10.216.13/joomla3/modules/mod_pixsearch/media/js/gpixsearch/gpixsearch.nocache.js"></script>
<script>
<link rel="alternate" href="http://10.10.216.13/joomla3/index.php/kz/spisok-sotrudnikov-k-siptik-zh-ne-tekhnikaly-o-ytu-kafedrasy" hreflang="kz" />
<link rel="alternate" href="http://10.10.216.13/joomla3/index.php/kz/spisok-sotrudnikov-k-siptik-zh-ne-tekhnikaly-o-ytu-kafedrasy"  hreflang="x-default" />
<link rel="alternate" href="http://10.10.216.13/joomla3/index.php/en/spisok-sotrudnikov-k-siptik-zh-ne-tekhnikaly-o-ytu-kafedrasy" hreflang="en" />
<link rel="alternate" href="http://10.10.216.13/joomla3/index.php/ru/spisok-sotrudnikov-k-siptik-zh-ne-tekhnikaly-o-ytu-kafedrasy" hreflang="ru" />

собственный код из main.js

 jQuery(document).ready(function(){
 var PrevNext;
    jQuery(window).scroll(function()
 {
  //  alert($('.NotfixedTop').offset().top);
  if (jQuery('section.menues').hasClass('NotfixedTop') )
  {
      if (jQuery(window).scrollTop()>= jQuery('.NotfixedTop').offset().top)
    {
             jQuery('.NotfixedTop').each(function (){
                                              jQuery(this).addClass( "fixed-top");
                                         jQuery(this).removeClass( "NotfixedTop");
                                              });

       }
  }
  if (jQuery('section.menues').hasClass('fixed-top') )
   {
     if ( jQuery(window).scrollTop()<= 18)
         {
       jQuery('.fixed-top').each(function (){
                                         jQuery(this).addClass( "NotfixedTop");
              jQuery(this).removeClass( "fixed-top");
                                             });
      }
   }

 });

 jQuery('#navbarSupportedContent2 .dropdown-toggle').click(function(e) {
  if (jQuery(this).parent().hasClass('dropdown-submenu')) {

  // alert('dropdown-submenu');
  }
  else {
   //alert(jQuery(this).offset().left/jQuery(window).width());
   if (jQuery(this).offset().left/jQuery(window).width()>0.55) {
    jQuery(this).next().css({"left":"-360px"})
   }

  }
 });
});

A: нашла решение
https://forum.joomla.org/viewtopic.php?t=893641
при формировании index.php  была пропущена строка
JHtml::_('jquery.framework');


text:
Q: Inflectional forms of verbs using DBsight lucene? I know dbsight allows synonyms and stop words for searching but does this take care of inflectional forms of a verb too e.g. for 'swim' it should find swim, swims, swimming, swam, and swum
Link on DBSight Wiki : http://wiki.dbsight.com/index.php?title=User_dictionary

A: The behavior you are looking for can be implemented using lemmatization. I am unaware of an existing Lucene analyzer that does this. Basis Tech's Lucene package does lemmatization, but is not free, and I do not know whether it works with dbsight.

A: Lucene comes with a stemmer called "Lucene SnowBall stemmer' (http://lucene.apache.org/java/2_4_0/api/contrib-snowball/index.html). Turns out that DBsight is exposing it as analyzers named SnowBall - [Language] e.g SnowBall - English, SnowBall - French etc..


text:
Q: All texts goes to the top of the screen in Chat UI page i have a Chat UI page where users can text each others,but the problem is for example when user X send a text it goes to the top and when user Y reply the text should be under the text that was send by user X but no it also goes to the top above the text that was send by user X,, dont know why it does that
here is my code
<StackLayout>

<ListView height="90%" margin-bottom="50" padding="5" #list [items]="chats$ | async">

    <ng-template let-item="item">

        <GridLayout columns="*" rows="auto" class="msg">

            <StackLayout [class]="filter(item.from)" orientation="horizontal" [horizontalAlignment]="align(item.from)">

                <Image [visibility]="showImage(item.from)" class="authorimg" stretch="aspectFill" height="30" width="30" verticalAlignment="top" src="~/images/k1.png" col="1"></Image>

                <Label [text]='item.message' class="msg_text" textWrap="true" verticalAlignment="top"></Label>

            </StackLayout>

        </GridLayout>

    </ng-template>

</ListView>

<StackLayout #chatbox height="10%">

    <GridLayout columns="*,auto" style="padding: 10">

        <TextField #textfield class="chatTextField" row="0" col="0" [(ngModel)]="message"></TextField>

        <Button #btn class="chatBtn" row="0" col="1" text="send" (tap)=chat(message)></Button>

    </GridLayout>

</StackLayout>

A: enter image description here
here is the screenshot
note:user X send  'HI' then user y replied 'Hey' and so on

A: Your StackLayout css should be added with below code
<classname> {
    display: block;
}

When you give this there will be no overlapping of messages. And it would occupy the whole parent element's width.


text:
Q: Converting a list to a list of lists I have a list of tuples, the first element of the tuples can be 'a','b','c' . I want to create a list of 3 lists from that tuple list. First list has to have 'a' tuples, second 'b' tuples and third 'c' tuples. Here is the code :
group mylist = group2 mylist [[],[],[]]

group2 mylist xs = if mylist == [] then xs
            else if getFirst (head mylist) == 'a' then group2 (tail mylist) ([head mylist]++[head xs])++ (tail xs)
            else if getFirst (head mylist) == 'b' then group2 (tail mylist) [head xs] ++ ((head mylist):[head (tail xs)]) ++ (tail xs)
            else if getFirst (head mylist) == 'c' then group2 (tail mylist) (init xs) ++ ((head mylist):[last xs])
            else xs

I get this error :

Couldn't match expected type `(Char, t0, t1)'
            with actual type `[a0]'
In the expression: []
In the second argument of `group2', namely `[[], [], []]'
In the expression: group2 mylist [[], [], []] Failed, modules loaded: none.

Sample Input :
[(c,1,2),(a,2,4),(c,5,6),(b,7,8),(a,9,1),(b,3,5),(c,2,5),(a,6,2),(c,1,8),(b,7,3),(a,4,4)]

Output :
[[(a,2,4),(a,9,1),(a,6,2),(a,4,4)],[(b,7,8),(b,3,5),(b,7,3)],[(c,1,2),(c,5,6),(c,2,5),(c,1,8)]]

How can I fix this?

A: You'll find this easier if you use pattern matching:
group :: [(Char, a, b)] -> [[(Char, a, b)]]
group = group' [[],[],[]]

group' :: [[(Char, a, b)]] -> [(Char, a, b)] -> [[(Char, a, b)]]
group' l [] = l
group' [as, bs, cs] (t@('a', _, _):ts) = group' [t:as, bs, cs] ts
group' [as, bs, cs] (t@('b', _, _):ts) = group' [as, t:bs, cs] ts
group' [as, bs, cs] (t@('c', _, _):ts) = group' [as, bs, t:cs] ts
group' l (_:ts) = group' l ts


text:
Q: Web software license for redistribution by our customer I work in a web agency; we developed a web application for a customer.
Once the app was done, the customer asked us the property rights for
our whole app so he can sell it to others.
In this case, how can we handle the lincense?
Can we use a license which allows us to control and make a profit on every
solt copy of our app?

A: Sure you can use such a license. You can use any license terms the other party agrees to (within the limits of your local law). But license agreements are tricky. When they aren't worded by a legal professional, you risk writing one which doesn't actually say what you think it says.
Just to give one example. Let's say you write a clause like "[developer] gets 20% of all profits generated by [customer] from transfering the rights to [application] to a 3rd party". Sounds good, right? But what if the people they transfer it to also transfer it to a 4th party? You only asked for 20% of the profits generated by [customer], not any of [customer's customer], so you would gain nothing on that 2nd transaction. That means [customer] could sell the software for $1 to a subsidiary company (of which you would get 20 cent) and make that subsidiary sell it to others for millions without having to pay you anything. And that's just one example of one mistake you could make.
For that reason you and your customer should hire lawyers which negotiate a licensing contract which says exactly what you want it to say and is free of any obvious loopholes.

By the way: When you do a work-for-hire, you should usually make such a contract before you start working. Who owns the copyright of the resulting work is one of the most important clauses of a work contract.

A: If you have full ownership of all the code in the project, you can use whatever license terms you like.
If you have used 3rd-party components in your project, then their licenses may restrict what license terms you can use.
In any case, if you want to use a different license than a well-known open-source license, you must consult with a lawyer. Licenses are legal documents and should be written by a legal professional if you want to be sure that the terms are enforceable.


text:
Q: Javascript or jquery validating the date of the application for the user to re apply again I'm currently using dynamics CRM and adxstudio and I was wondering if there's some sort of jquery or javascript code I can use to validate the date of the application. So basically applicants can only re-apply within 4 weeks of their current application expiry date. I provided a screenshot of the list.This is the main list
The applicant is only allow to renew within 4 weeks of the Next Recert Date meaning they cant apply earlier nor later. I already have the id all I need to know is the function or an alert to give the user that they cant recertify yet.

A: Did you try Moment.js? It is an awesome JS library for date handling.
EDIT: Within the above link, you have many examples of data manipulation. You could use to parse and manipulate dates, like making sure today's date is within the range of [expiryDate - 4 weeks, expiryDate].
Example: moment(expiryDate).subtract(4, 'weeks').calendar();


text:
Q: Where can I purchase a funnel reflector? I am designing a testing apparatus to contain the light emitted from a 40mm dia. xenon bulb and concentrate it at a 35mm dia. target.
My apparatus consists of a large funnel reflector: large hole dia. ≥ 60mm (added some clearance because, although the bulb is 40mm dia., it drops down 30mm from the top); small hole dia. = 35mm.
Another reflector, in the shape of a flat circle (w| 2 holes cut into it for the bulb's pos. and neg. leads to come through), will cap the funnel's large end (i.e., flat reflector dia. = large hole dia. of funnel).
The flat reflector was easy to find, I am having trouble finding a company who makes funnel shaped reflectors.
I found a patent which is essentially what I need (it is just miniature): https://patents.google.com/patent/US20030108295
The closest thing that I have been able to find are the ellipsoidal reflectors made by Edmund Optics:
https://www.edmundoptics.com/optics/optical-mirrors/focusing-concave-mirrors/150mm-dia-x-360mm-fl-alum.-coated-ellipsoidal-reflector/
I have visited, called, and emailed every company that has turned up from my searching to no avail. Maybe one of you have resolved a search similar to mine and could recommend some companies? Or just as helpful, maybe there is better terminology or keywords I should be using to get better results?
Any help is appreciated!


text:
Q: Conditions under which an arbitrary set $A$ satisfies $\mathscr{P}(\bigcup A) \subseteq A$ I'm working within the axioms of $\mathbf{ZF}$, and we're only considering sets made out of the empty set, $\emptyset$. One could try out simple cases, and see that $  \{\emptyset\}$ and $ \{ \emptyset, \{\emptyset \}\}$ satisfy $\mathscr{P}(\bigcup A) \subseteq A$.
But how could one prove that these are the only cases, and no other sets fulfill the condition?
Addendum: Is there a general method to find special cases of sets which satisfy a certain subset relation, say $\mathscr{P}(A\cup B) \subseteq \mathscr{P}(A) \cup \mathscr{P}(B)$, and prove that no other sets fit the bill? Of course, $\mathscr{P}(A)  \cup \mathscr{P}(B) \subseteq \mathscr{P}(A \cup B)$ in general, but I'm considering only subset relations which don't hold generally.  One could guess and check, but I'm thinking about a systematic procedure to find these sets.


text:
Q: Congruence-What is remainder when $a^2+2b$ is divided 3? Suppose $a\equiv 7 \pmod 9 $, $b\equiv 1\pmod 6$. What is remainder when $a^2+2b$ is divided by 3 ?----- So, since $a=9m+7$, $b=6n+1$, $m,n\in \mathbb{Z}$, $a^2+2b=(9m+7)^2+2(6n+1)$,=$81m^2+12n+177$=$3(27m^2+4n+59)$....I am not sure what I am getting here.. Can I say the remainder is $0$?

A: Yes, the remainder is $0$, since clearly $3 \mid 3(27m^2 + 4n + 59)$, and given $m, n \in \mathbb Z$, the quotient $27m^2 + 4n + 59$ is thereby integer

A: Another solution using the properties of modular arithmetic.
$a \equiv 7 \pmod 9 \Rightarrow a^2 \equiv 49 \equiv 4 \pmod 9$
$b \equiv 1 \pmod 6 \Rightarrow 2b \equiv 2 \pmod 6$
So $a^2 = 9n + 4$ and $2b = 6m + 2$, thus $a^2 + 2b = 9n + 6m + 6 = 3(3n + 2m + 2)$ which is definitely divisible by 3.


text:
Q: Manual grub rescue exit when booting up Community!
Every time I restart my PC, I get in the grub rescue> prompt, just because before that I accidentally deleted a volume with my linux distro, including grub(my PC is dual-bootable). Using some external tools, I restored the partition, and its number changed from 6 to 4.
The problem is that every time I boot my PC, I need manually run such commands as
set prefix=(hd0,4)/boot/grub
set root=(hd0,4)

because as I said, previous number of partition was 4 instead of 6, and PC do not save this information.

A: Try to update grub configuration.
On Ubuntu or similar: update-grub
On Fedora or similar: grub2-mkconfig -o /boot/grub2/grub.cfg


text:
Q: how to return the count of unique documents by using elasticsearch aggregation I encountered a problem that elasticsearch could not return the count of unique documents by just using terms aggregation on a nested field.
Here is an example of our model:
{
    ...,
    "location" : [
        {"city" : "new york", "state" : "ny"},
        {"city" : "woodbury", "state" : "ny"},
        ...
    ],
    ...
}

I want to do aggregation on the state field, but this document will be counted twice in the 'ny' bucket since 'ny' appears twice in the document.
So I'm wondering if where is a way to grab the count of distinct documents.
mapping:
people = {
  :properties => {
    :location => {
      :type => 'nested',
      :properties => {
        :city => {
          :type => 'string',
          :index => 'not_analyzed',
        },
        :state => {
          :type => 'string',
          :index => 'not_analyzed',
        },
      }
    },
    :last_name => {
      :type => 'string',
      :index => 'not_analyzed'
    }
  }
}

the query is pretty simple:
curl -XGET 'http://localhost:9200/people/_search?pretty&search_type=count' -d '{
  "query" : {
    "bool" : {
      "must" : [
        {"term" : {"last_name" : "smith"}}
      ]
    }
  },
  "aggs" : {
    "location" : {
      "nested" : {
        "path" : "location"
      },
      "aggs" : {
        "state" : {
          "terms" : {"field" : "location.state", "size" : 10}
        }
      }
    }
  }
}'

The response:
{
  "took" : 104,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 1248513,
    "max_score" : 0.0,
    "hits" : [ ]
  },
  "aggregations" : {
    "location" : {
      "doc_count" : 2107012,
      "state" : {
        "buckets" : [ {
          "key" : 6,
          "key_as_string" : "6",
          "doc_count" : 214754
        }, {
          "key" : 12,
          "key_as_string" : "12",
          "doc_count" : 168887
        }, {
          "key" : 48,
          "key_as_string" : "48",
          "doc_count" : 101333
        } ]
      }
    }
  }
}

The doc_count is much larger than the total in hit. So there must be duplicates.
Thanks!

A: I think you need a reverse_nested aggregation, because you want aggregation based on a nested value, but actually counting the ROOT documents, not the nested ones
{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "last_name": "smith"
          }
        }
      ]
    }
  },
  "aggs": {
    "location": {
      "nested": {
        "path": "location"
      },
      "aggs": {
        "state": {
          "terms": {
            "field": "location.state",
            "size": 10
          },
          "aggs": {
            "top_reverse_nested": {
              "reverse_nested": {}
            }
          }
        }
      }
    }
  }
}

And, as a result, you would see something like this:
"aggregations": {
      "location": {
         "doc_count": 6,
         "state": {
            "doc_count_error_upper_bound": 0,
            "sum_other_doc_count": 0,
            "buckets": [
               {
                  "key": "ny",
                  "doc_count": 4,
                  "top_reverse_nested": {
                     "doc_count": 2
                  }
               },
               {
                  "key": "ca",
                  "doc_count": 2,
                  "top_reverse_nested": {
                     "doc_count": 2
                  }
               }
            ]
         }
      }
   }

And what you are looking for is under top_reverse_nested part.
One point here: if I'm not mistaking "doc_count": 6 is the NESTED document count, so don't be confused about these numbers thinking you are counting root documents, the count is on the nested ones. So, for a document with three nested ones that match, the count would be 3, not 1.


text:
Q: Elasticsearch: Nest, include match to the search query if variable has value I have a search query that needs to perform search depending on the provided parameters that are cultureName and the user input that will be string called query. But there is one more 'potential' search condition that needs to be satisfied if value to the variable is provided.
_elasticClient.Search<Document>(s => s
                .Size(10)
                .Query(q =>
                    q.Match(m => m.Field(p => p.Culture).Query(cultureName))
                    && q.QueryString(queryDescriptor => queryDescriptor
                        .Query(query)
                        .Fields(fs => fs
                            .Fields(f1 => f1.Content)
                        )
                    )
                )
            );

What do I need to use so I can have elastic search matching by one more rule if value is provided and not including the condition when there is no value?
Let's say the incoming variable is called type and needs to match a property called Type in the Document structure I have just the same way there is Content.


text:
Q: FuzzyQuery and BooleanQuery I work with Hibernate Search 3.1.1.GA.
I am trying my luck at fuzzy queries. This query works (it retrieves records containing Shakespeare):
lastName:shakespere~0.1

But this one does not:
firstName:shakespere~0.1 lastName:shakespere~0.1

I create a BooleanQuery and stuff it with FuzzyQuery instances with Occur.SHOULD. Wrapping the FuzzyQuery instances in BooleanClause does not seem to make a difference. Any hint?
Thanks,
Francois

A: I'm not sure this is what you need, try take a look at [MultiFieldQueryParser][1]
[1]: http://lucene.apache.org/java/2_4_0/api/org/apache/lucene/queryParser/MultiFieldQueryParser.html#MultiFieldQueryParser(java.lang.String[], org.apache.lucene.analysis.Analyzer)


text:
Q: GitHub and VS 2012 synchronization Is it possible to sync my solutions of VS 2012 to directly merge with the repositories in GITHUB?
Like if I made a solution or project in VS 2012 will i be able to directly update it into a repository from VS 2012?Is there a additional plugin  available?

A: I got the solution just surfing on the web.The Link is here.Little details have been given below.
The Only issue is its for CodePlex not for GITHUB

Brian Harry made two major announcements today at the ALM Summit.
   1.Visual Studio will support Git
   2.Team Foundation Server will host Git repositories.   When we added Git to CodePlex back in March of last year a missing piece, for many
  customers, was having great Git tooling within Visual Studio.   With
  the CTP release of Visual Studio 2012 Update 2 plus the CTP of the Git
  VSIX you can now use Git within Visual Studio. The CodePlex team has
  been dogfooding the tools for the last few months and we look forward
  to getting public feedback.   Using VS Git with CodePlex   Since the
  Visual Studio Git client works with any Git remote you can easily
  configure it for your CodePlex Git projects.


text:
Q: change the date format in bigquery I have a date column as dd-mm-yyyy. I would like to convert it to yyyy/mm/dd in bigquery.I have written the following query:
SELECT cast(format(Date, 'yyyy/mm/dd') as string) as Date FROM t1.
The error is : Too many arguments to FORMAT for pattern "23/04/2020"; Expected 1; Got 2.
Can you please assist.

A: First you need to parse date from dd-mm-yyyy string and then format it as yyyy/mm/dd as in below
FORMAT_DATE('%Y/%m/%d', PARSE_DATE('%d-%m-%Y', day))

You can test, play with above using dummy data as in below example
#standardSQL
WITH `project.dataset.table` AS (
  SELECT '15-01-2020' day UNION ALL
  SELECT '05-10-2019'
)
SELECT day, FORMAT_DATE('%Y/%m/%d', PARSE_DATE('%d-%m-%Y', day)) AS formated_day
FROM `project.dataset.table`

with output
Row day         formated_day
1   15-01-2020  2020/01/15
2   05-10-2019  2019/10/05

A: You want FORMAT_DATE, not FORMAT.
SELECT FORMAT_DATE("%Y/%m/%d", DATE "2008-12-25");

The reason you're having trouble with FORMAT is that you gave it a format string that doesn't take any parameters.  Seeing this, the engine barfs-"I don't need any more parameters to render this string."


text:
Q: How to find the $P_2$ when $T_1P_1=T_2P_2$ $T_1$ and $T_2$ are $3 \times 3$ homogenous transform matrices. $P_1$ is the $3 \times 1$ matrix with $x, y$ coordinates of point $P_1$.
What I am trying to do here is trying to get $x, y$ coordinate of point $P$ in coordinate system with transform $T_2$ when I know its $x, y$ in coordinate system with transform $T_1$.
Well in this relation it seems obvious that $P_2=T_2^{-1} \cdot T_1 \cdot P_1$. But this is giving wrong result in a code of mine. I am right now at my wit's end, so posted this question.
Are there any corner cases where this equation can fail? I know of one case when $\det(T_2)=0$.

A: Don't take this answer as an answer. I'm writing here simply because it is easier to edit. Here we go.
Say $\tilde{x}$ is a vector lying in $\mathbb{R}^3$ space(your Euclidean space).
If you only have one transform variable, it only allows you to transfrom in $\mathbb{R}^2$ (sub)space. In order to transform in 3D, you need two angle variables.
Check wiki for the details. In the course of one rotation, you have to rotation about ONE axis, whose coordinate would remain unchanged.
If it is a rotation matrix, in convention it means you rotation the vector COUNTERCLOCKWISELY (wiki is sometimes confusing :D) by angle $\theta$, while the matrix is
$$
 \begin{bmatrix}
       \cos\theta & -\sin\theta          \\
       \sin\theta & \cos\theta
     \end{bmatrix}
$$
so, if
$$
T_{1}(\alpha) =
 \begin{bmatrix}
       \cos\alpha & -\sin\alpha          \\
       \sin\alpha & \cos\alpha
     \end{bmatrix}
$$
$$
T_{2}(\gamma) =
 \begin{bmatrix}
       \cos\gamma & -\sin\gamma          \\
       \sin\gamma & \cos\gamma
     \end{bmatrix}
$$,
then $T_{2}^{-1}T_{1}\vec{x}$ means rotating $\vec{x}$ counterclockwisely by $\alpha$ then clockwisely by $\gamma$.
So actually you can use
$$T_{2}^{-1}T_{1}\vec{x} = \tilde{T} =
 \begin{bmatrix}
       \cos(\alpha-\gamma) & -\sin(\alpha-\gamma)           \\
       \sin(\alpha-\gamma)  & \cos(\alpha-\gamma)
     \end{bmatrix}
$$
Though it is equivalent in mathematics, it simplifies the computation a little bit and it also avoids inverse and matrix multiplication.
I only work in 2D because if the thrid dimension remains the same:
if
$$
T_{2}(\gamma) =
 \begin{bmatrix}
       \cos\gamma & -\sin\gamma   &  0     \\
       \sin\gamma & \cos\gamma & 0 \\
0&0&1
     \end{bmatrix}
$$
the third entry of vector $\vec{x}$ wouldn't be changed.
So actually you can reduce the dimension.
I hope it helps a bit.
And using uppercase only means to grasp some attention and doesn't mean to offend anyone.


text:
Q: How to rollback a Vertica copy from stdin when an upstream error occurs? On Linux, I have files on a remote system that are too big to hold on my local system so I am  using ssh to stream the files to the local system and using Vertica's copy stdin to enter the data.  The problem is, occasionally the streaming fails for some reason and I have incomplete data committed into Vertica.
For demonstration purposes, I prepared the following:
cat ./test.dat | falseCat |
vsql -d SRVVERTICA -c "copy thisTable (a,b,c)
FROM local stdin
delimiter '|'
trailing nullcols
abort on error commit;"

This batches data from my data file, through my falseCat program that passes its input and always returns an error into Vertica.  It is hard to say if this is exactly what I am seeing.  Most recently, I got the error from earlier in the pipe:
  awk: fatal: print to "standard output" failed (Connection reset by peer)

Please note, this is not a Vertica problem.  It is an upstream problem that I am trying to catch in Vertica before it commits.  For example, if I receive only 30 million records when I am supposed to receive 50 million, I want to rollback before committing the incomplete data.  It also would be "helpful" to know if I got incomplete data, something I don't know now without studying the logs.
I just wish I had room to stream the data into a file locally and load the file into Vertica but I can't because of the size of the data.
Thank you for any input.

A: I have something here that works in small cases but I have not tried with big cases, as yet.  Basically what I am doing is creating a named pipe and sending the data to the pipe in one process while reading that data into Vertica in another.  When the data is done being written, I save either "commit" or "rollback" to a file that I will batch into Vertica when it is done.  After Vertica completes the copy, I am running sleep for a few seconds to make sure the other process is done before running the finalVert script.  I were on the ball, I would cause it to wait until the file exists but this is a start.
set -o pipefail
[[ -p dataToVert ]] || mkfifo dataToVert
(
if cat ./test.dat | falseCat > dataToVert
then
    echo "commit;" > finalVert.sql
else
    echo "rollback;" > finalVert.sql"
fi
) &
vsql -d SRVVERTICA -At << EOF
copy thisTable (a,b,c)
FROM local 'dataToVert'
delimiter '|'
trailing nullcols
abort on error no commit;
\o | xargs sleep
select 5;
\o
\i finalVert.sql
\q
EOF

I am transitioning to Vertica from Oracle.  If somebody has a better way of doing this, I would love to hear it.
I should add that for testing purposes, I have been using a script called falseCat:
#!/bin/ksh
cat -
exit 141

This echoes the stdin to stdout and produces the same 141 error code I am getting from ssh.


text:
Q: How does MCTS work with 'precise lines' So I am familiar with more basic tree search algorithms like game search w/ minimax, but I've been trying to learn more about the Monte-Carlo Tree Search algorithm, and was wondering how it deals with 'precise lines.'
In the context of chess, where you might be in a position where you have 30 losing moves but 1 winning line, how would the MTCS Algorithm, more specifically the UCB1 function deal with this? The way I understand UCB1 is that it essentially does a sort of average over its child nodes so the UCB1 value of a line of chess where you have 30 losing moves and one winning one should be deceptively low?
I'm still learning about MCTS but I've always had this question and was hoping someone could explain how MCTS still converges to minimax even if a UCB1 value might be very low.
Any knowledge would be appreciated! Thanks

A: Imran's answer is correct in that, from a theoretical point of view, the UCB1 strategy typically used in the Selection phase of MCTS should eventually be able to handle with the kinds of situations you describe, and that MCTS (assuming we use something like UCB1 for the Selection phase) will eventually converge to minimax evaluations.
However, "eventually" here means "after an infinite number of MCTS iterations". We need an infinite amount of processing time because only the Selection phase of MCTS can adequately handle the types of situations you describe (the Playout phase can't), and the Selection phase is only actually used in a slowly-growing part of the tree around the root node. So, if the situations you describe are "located" relatively close to the root node, then we can expect that strategies like UCB1 can adequately handle them. If they are very deep / far away from the root, so deep that we don't manage to grow the search tree that far in the processing time we have... then MCTS indeed does not tend to handle these situations well.
Note that a similar thing can be said for minimax-based approaches; if they don't manage to search deep enough, they can also result in poor evaluations. The story tends to be much more binary in the case of minimax-like algorithms though; either they manage to search sufficiently deep for good evaluations, or they don't. In the case of MCTS, it will always evaluate these types of situations poorly initially, and might gradually improve as the search tree gradually grows.
In practice, minimax/alpha-beta/related algorithms were believed to outperform MCTS-based methods for about a full decade in games with many "trap" situations, like the situations you describe. This includes chess-like games. During the same period of time, MCTS was much more promising already in games like Go. Only in a recent paper did a combination of MCTS + Deep Reinforcement Learning + ridiculous amounts of hardware beat minimax-based approaches in chess-like games.

A:
The way I understand UCB1 is that it essentially does a sort of
  average over its child nodes so the UCB1 value of a line of chess
  where you have 30 losing moves and one winning one should be
  deceptively low?

From the UCT formula w_i/n_i + c*sqrt(ln(N)/n_i)  we can see that the exploration term is proportional to the inverse of the square root of child visits, n_i. What this means in that the child node with the best win rate will be heavily favored and therefore will have far more visits. So the UCT score of the parent will be an average heavily weighted toward the win rate of best child node.
This effect will propagate back up the tree, leading to the best line having the most visits and an accurate win rate at each node. In this way MCTS converges to the minimax result as the number of simulations increases.
For a more theoretical discussion, see the main result of Bandit based Monte-Carlo Planning:

Theorem 6 Consider a finite-horizon MDP with rewards scaled to lie in
  the [0, 1] interval. Let the horizon of the MDP be D, and the number
  of actions per state be K. Consider algorithm UCT such that the bias
  terms of UCB1 are multiplied by D. Then the bias of the estimated
  expected payoff, Xn, is O(log(n)/n). Further, the failure probability
  at the root converges to zero at a polynomial rate as the number of
  episodes grows to infinity.


text:
Q: Apex.Message in Iframe What am I doing wrong? I hope this is just a simple mistake and me writing it out will even help spur some thought.
I have a VFP embedded in a related list on the Lead object.
When a user clicks a button, an error message should appear. I have in the code the apex error message logic and on the VFP the  tag. I can tell with my debugs that the apex error is setting correctly, so my thought was that I had to rerender the VFP to see the error displayed, but this does not render the error either. Is there something with iFrames and error messages?
APEX
global class EquifaxCreditPullController {

//I am returning an custom error dependent on error code returned from service
@RemoteAction
global static String pullCred(String leadId, String contactId, String creditReviewId) {
    String status;
    ApexPages.Message msg;

    String jsonBody = '{"LeadId" : "' + leadId + '" }';
    EquifaxCreditPull__c post = EquifaxCreditPull__c.getInstance();
    String endpoint = post.Endpoint__c;
    HttpRequest req = new HttpRequest();
    req.setEndpoint(endpoint);
    req.setMethod('POST');
    req.setBody(jsonBody);
    req.setHeader('Content-Type', 'application/json');
    string d = getAuth();
    string e = 'token ';
    string f = e + d;
    req.setheader('Authorization', f);
    try {
        Http h = new Http();
        HttpResponse res = h.send(req);
        Consumer_Credit_Summary__c c = new Consumer_Credit_Summary__c(FirstName__c = 'test1', Lead__c = leadId, FICO__c = 123.0);
        insert c;
        JSONParser parser = JSON.createParser(res.getBody());
        while (parser.nextToken() != null) {
            if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) && (parser.getText() == 'ResultStatus')) {
                parser.nextToken();
                status = parser.getText();
            }
        }
        if(status == 'Success'){
            system.debug('got into Success:: ' + status);
        }
        else if(status == 'CriticalError'){
            system.debug('got into CriticalError');
            msg=new ApexPages.Message(ApexPages.Severity.ERROR, 'CriticalError');
            ApexPages.addMessage(msg);
        }
        else if(status == 'NotImplemented'){
            system.debug('got into NotImplemented');
            msg=new ApexPages.Message(ApexPages.Severity.ERROR, 'NotImplemented');
            ApexPages.addMessage(msg);
        }
        else {
            system.debug('something went wrong');
            msg=new ApexPages.Message(ApexPages.Severity.ERROR, 'TBD');
            ApexPages.addMessage(msg);
        }
        return status;
    }
    catch (System.CalloutException z) {
        system.debug('z: ' + z);
        return null;
    }
}

public PageReference errorHandling(){
    Id currentPageId = ApexPages.currentPage().getParameters().get('id');
    pullCred(currentPageId, null, null);
    //refreshing the page to display the newly populated data
    PageReference tempPage = ApexPages.currentPage();
    tempPage.setRedirect(true);
    return tempPage;
}
}

VFP
<apex:page id="EquifaxCreditPullPage" showHeader="true" standardController="Lead" extensions="EquifaxCreditPullController">

    <apex:stylesheet value="{!URLFOR($Resource.SLDS2018, 'styles/salesforce-lightning-design-system.css')}" />
    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" />

<apex:form id="theForm">
<apex:messages/>

Name

Action

    <apex:repeat value="{!leadCCSMap}" var="contactOrLead">

{!contactOrLead.Name}

                <apex:commandButton onClick="pullCredit()" value="Pull Credit"/>

    </apex:repeat>

</apex:form>
</apex:page>

A: You need to have a apex:form and apex:commandbutton then only it will render properly or from the function show hide error div
<apex:page id="EquifaxCreditPullPage" showHeader="true" standardController="Lead" extensions="EquifaxCreditPullController">

<apex:form>
    <apex:pageMessages/>
   <apex:commandbutton />
</apex:form>
</apex:page>

A: Olivia,
Javascript Remoting performs calls to methods written in Apex and processes them asynchronously.
Additionally, JavaScript Remoting directly passes the parameters to the respective Apex method and does not have access to content maintained within the Visualforce Pages's viewstate.
This is specifically done to improve performance and reduce page response times by avoiding the overhead of serializing and deserializing content passed to the server side Apex method.
The below code leverages an  and  to call a server side action and displays the error message using a partial page refresh using AJAX.
Apex Controller
global class EquifaxCreditPullController {

        public ApexPages.StandardController leadStdController {get; set;}

        public EquifaxCreditPullController(ApexPages.StandardController pLeadController){
            this.leadStdController = pLeadController;
        }

        public void doSomething(){
            System.debug('****Call to doSomething()');
            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, 'TBD');
            ApexPages.addMessage(msg);
            System.debug('***msg => ' + msg);
        }

        @RemoteAction
        global static void pullCred(String leadId, String contactId, String creditReviewId) {
            /*ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, 'TBD');
            ApexPages.addMessage(msg);
            System.debug('***msg => ' + msg);*/
        }
}//EquifaxCreditPullController ends

Visualforce Code
<apex:page id="EquifaxCreditPullPage" showHeader="true" standardController="Lead" extensions="EquifaxCreditPullController">

    <apex:form >
        <apex:outputPanel id="msgpanel">
            <apex:pageMessages />
        </apex:outputPanel>

        <apex:commandButton action="{!doSomething}" onclick="pullCredit()" reRender="msgpanel" value="Pull Credit"/>
    </apex:form>

</apex:page>


text:
Q: Opening text file trouble I tried reading a text file from a directory , but it wont open unless i import the text file into the src of my java project which is not what i want
I want to read a text file that is from a certain directory
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.io.*;

import javax.swing.*;
public class A{
    public static void main(String[] args)throws Exception{
        String path="C:/My documents/file.txt";
        File F=new File(path);

          try{
            FileInputStream ips=new FileInputStream(F);//ou InputStream
            InputStreamReader ipsr=new InputStreamReader(ips);//
            BufferedReader br=new BufferedReader(ipsr);//lire les lignes
            String ligne[]=new String[7];

            for (int i=1;i<ligne.length;i++)
            {
                ligne[i]=br.readLine();
                        System.out.println(ligne[i]);
            }

        br.close();

            }
            catch(Exception e1){System.out.println("error");    }

    }
}

A: If its windows, it should be:
  String path="C:\\My documents\\file.txt";


text:
Q: Issue with importing database in pgAdmin (.sql format) I'm trying to reload PostgreSQL database into pgAdmin. The base is in .sql format (db.sql)
When I'm trying to reload it, the following problem appears:

pg_restore: [archiver] input file appears to be a text format dump.
  Please use psql.

I've never imported database before, so I don't know what to do.
How could I use psql? Should I modify db.sql file somehow?
Thank you for the help!


text:
Q: IIS App Pool Crashes with AppPoolIdentity identity, not with NetworkService
OS: Windows Server 2008 R2
IIS: 7.5
No Managed Code

I am trying to nail down the issue here.  I am not sure if it was precipitated by some change from a group policy (I don't have any control over that) or from installing some Windows Update.
All of a sudden after a reboot, none of my sites would work, they all respond with HTTP Error 503. The service is unavailable.  The app pools were stopped and there are 5 warnings (EventID 5009, EventSourceName WAS) and 1 error (EventID 5002, EventSourceName WAS) in the System event logs and 5 errors (EventID 2276, EventSourceName W3SVC-WP) in the Appliation event logs (per app pool).
I switched all my sites to a single app pool and change the identity to NetworkService and they all work.  This however seems like a security/scale issue?
I downloaded DebugDiag 2 and tried to get a dump, however it never seemed to trigger.  I also try to find the process in Process Explorer, but any app pool not using the NetworkService identity doesn't show up.
I don't know how else to look for the root cause.

EDIT @Lex Li
Checked my Debug Tool log and found this

[7/19/2018 3:29:02 PM] New process found:        Process Name -
w3wp.exe             Process ID - 4652   Process Identity - IIS
APPPOOL\Test Pool                    Web application pool name - Test
Pool
[7/19/2018 3:29:02 PM] Attach Debugger:          Process Name -
w3wp.exe             Process ID - 4652   Control Script - C:\Program
Files\DebugDiag\Scripts\CrashRule_WebAppPool_Test Pool.vbs
Script Error
Error Code - 0x80070002
Error Source [DbgSvc.Controller.1]
Error Description []
Line 93, Column 2
[7/19/2018 3:29:03 PM] Process Exited:           Process Name -
w3wp.exe             Process ID - 4652   Web application pool name -
Test Pool

However that only shows up once, and can't reproduce it.


text:
Q: Status code 500 Paperclip amazon s3 connection refused - (Connection refused - connect(2) for "bucket.s3.amazonaws.com" port 443 Paperclip can't seem to connect to my amazon s3 bucket instance  it gives this error -
*** Exception Errno::ECONNREFUSED in Rack application object (Connection refused - connect(2) for "bucket-images-test.s3.amazonaws.com" port 443)

My production.rb looks like this:
config.paperclip_defaults = {
      :storage => :s3,
      :s3_credentials => {
          :bucket => 'bucket-images',
          :access_key_id => 'accesskey',
          :secret_access_key => 'seceretkey',
           :host_name => 's3-website-us-east-1'
      },
      :default_url => "/missing.png",
      :path => "/:attachment/:id/:style/:filename",
      :url => "/:attachment/:id/:style/:filename"
  }

I'm using:

*

*paperclip version 4.2.0

*aws-sdk version 1.63

*aws-sdk-resources version 2

A: The problem was with the gems and also the iptables
Gemfile
gem 'paperclip', '~> 4.2.0'
gem 'aws-sdk', '~> 1.5.8'
gem 'aws-sdk-resources '~> 2'

also i was blocking port 443 so i had to change the iptables:
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:http

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http


text:
Q: How to identify fast movement I want my Android application to be notified when the user is moving fast.
(lets say faster then 5 meter/second)
It must be battery efficient - so I can not use GPS for example, but can use a sensor.
Latency is not very important - it can be up to 30 seconds after reaching a fast speed.
I am only interested in continues movement. fast tilting the device can be ignored.
How can this be done ?


text:
Q: ACCEPT FROM SYSIN in subprogram Let's say I EXEC a COBOL program from JCL, using a SYSIN DD to provide data.
If that program then CALLs a COBOL subprogram, and some data is still available from the input, will the subprogram be able to read them using an ACCEPT statement?
Or is the SYSIN only accessible from the main program of the run unit invoked from the JCL?
Edit: I reckon this would be a bad coding practice. I do not intend to use it, nor am I in need of better alternatives, of which I am aware (such as reading the input device data from the main data and passing it to subprogram(s) through their LINKAGE).
Actually I am not writing COBOL code, but studying / processing it, so I'm interested in "corner case" behavior to refine my understanding of COBOL semantics.

A: You just can to use the ACCEPT on the main program. If you want to send information, you should use a copy.


text:
Q: Check if Column exceeding specific value and replace I use the long list of codes similar to below codes, to check data frame with multiple columns
I need to check if the column has any values greater than Eg. 1000. If >1000 its error value, so make it '0'
b=1000
a = np.array(df['E8'].values.tolist()); df['E8'] = np.where(a > b, 0, a).tolist()
a = np.array(df['E9'].values.tolist()); df['E9'] = np.where(a > b, 0, a).tolist()
a = np.array(df['E10'].values.tolist()); df['E10'] = np.where(a > b, 0, a).tolist()
a = np.array(df['E11'].values.tolist()); df['E11'] = np.where(a > b, 0, a).tolist()
a = np.array(df['E12'].values.tolist()); df['E12'] = np.where(a > b, 0, a).tolist()
a = np.array(df['E13'].values.tolist()); df['E13'] = np.where(a > b, 0, a).tolist()
a = np.array(df['E20'].values.tolist()); df['E20'] = np.where(a > b, 0, a).tolist()
a = np.array(df['E21'].values.tolist()); df['E21'] = np.where(a > b, 0, a).tolist()
a = np.array(df['E29'].values.tolist()); df['E29'] = np.where(a > b, 0, a).tolist()
a = np.array(df['E28'].values.tolist()); df['E28'] = np.where(a > b, 0, a).tolist()
a = np.array(df['E30'].values.tolist()); df['E30'] = np.where(a > b, 0, a).tolist()
a = np.array(df['E31'].values.tolist()); df['E31'] = np.where(a > b, 0, a).tolist()
a = np.array(df['E32'].values.tolist()); df['E32'] = np.where(a > b, 0, a).tolist()
a = np.array(df['E36'].values.tolist()); df['E36'] = np.where(a > b, 0, a).tolist()
a = np.array(df['E37'].values.tolist()); df['E37'] = np.where(a > b, 0, a).tolist()

Is there a simple and efficient way to do it.

A: You can simplify your solution with list of columns names:
np.random.seed(2021)

cols = ['E8','E9','E10', 'E37']
df = pd.DataFrame(np.random.randint(0, 2000, size=(10, 4)), columns=cols)

b = 1000
df[cols] = np.where(df[cols] > b, 0, df[cols])

print (df)
    E8   E9  E10  E37
0    0    0   57    0
1  621    0   44    0
2  830  669    0  349
3  152    0  502  198
4    0   70  545  613
5    0  257    0    0
6    0    0  410    0
7  944    0   63    0
8  656    0  822  379
9    0    0  632    0

A: You can use df.mask here.
b = 1000
cols = ['E8','E9','E10', ..., 'E37']
df[cols] = df[cols].mask(df[cols].gt(b), 0)

If you want to do this on entire df
df = df.mask(df.gt(b), 0)


text:
Q: How do you define a function during dynamic Python type creation (This is in Python 3 btw)
Okay so say we use type() as a class constructor:
X = type('X', (), {})
What I'm trying to find is how would type() accept a function as an argument and allow it to be callable?
I'm looking for an example of how this could be accomplished. Something along the lines of:
>>> X = type('X', (), {'name':'World', 'greet':print("Hello {0}!".format(name))}
>>> X.greet()
Hello World!

A: You need to pass the function.  In your code, you call the function, and pass the result.
Try:
def print_hello(self):
    print("Hello {0}!".format(self.name))

X = type('X', (), {'name':'World', 'greet': print_hello})


text:
Q: Bandwidth of laser pulses I am working on a practice test for my optics class.  The professor does not provide the solutions for the test.  I was just wondering if someone could tell me if I am doing this correctly because it seems kind of simple but I am unsure.

A laser emits short pulses of duration 14.0 ps separated in time by
  1.0 ns at a wavelength of 1 um.  From one pulse to the next, the timing of field oscillations is kept perfectly  coherent and phase
  stable using sophisticated feedback control.
What is the bandwidth of the source (in Hertz)?

I think the answer to this would be 1/t which is 1 /14 ps = 71 Ghz
I think it is just that simple but I want to know if I am wrong so I do not make that mistake on the actual test.  Also just to clarify the bandwidth of the pulse is the range of frequencies in that pulse of light right?

A: About 30 GHz,
according to this.
Check "Bandwidth-limited Pulses".
Because of Fourier transform, the product of the temporal duration and spectral width is ≈ 0.44 for Gaussian-shaped pulses. See also this.


text: Q: Create "virtual files" in android. Possible? I want to add a functionality to my app to treat a user's uploaded images online as if they were files on their phone, so all their existing apps can find their images without needing to download them all. Basically tricking the phone into thinking its local instead of online. Any thoughts and how to go about this?


text:
Q: How do I convert an image to PDF using IText 7 and keep the height and width the same in the PDF? I've been trying to create a method that converts an image such as a BMP into a PDF and have the created PDF maintain the same dimentions.  For example If I look at the height and width of my BMP file in ms paint it is 0.87" Wide and 0.92" High. Unfortunately when looked at in adobe acrobat the height of the converted file is 1.15"Wide and 1.22" High.
I'm new to iText and have struggled with many of the examples being for older incompatible versions.
Here is the code that I used to convert the image to PDF:
public static byte[] convertImageBytesToPdfBytes(byte[] imgBytes) {
    ByteArrayOutputStream returnSM = new ByteArrayOutputStream();
    try {
        PdfWriter writer = new PdfWriter(returnSM);
        // Creating a PdfDocument
        PdfDocument pdfDoc = new PdfDocument(writer);
        //PdfDocument doc = new PdfDocument(new PdfReader(src), new PdfWriter(returnSM));
        // Creating an ImageData object
        ImageData data = ImageDataFactory.create(imgBytes);
        // Creating an Image object
        Image img = new Image(data);
        img.setBorder(Border.NO_BORDER);
        float imgWidth = img.getImageWidth();
        float imgHeight = img.getImageHeight();
        img.setFixedPosition(0, 0);
        Rectangle rect = new Rectangle(imgWidth, imgHeight);
        PageSize pagesize = new PageSize(rect);
        pdfDoc.setDefaultPageSize(pagesize);
        // Creating a Document Document
        Document document = new Document(pdfDoc, pagesize);
        document.setMargins(0, 0, 0, 0);
        // Adding image to the document
        document.add(img);
        // Closing the document
        document.close();
        writer.close();
    }
    catch (Exception e) {
        e.printStackTrace();
    }

    return returnSM.toByteArray();
}


text:
Q: Cannot get aurelia-interactjs plugin to work using Aurelia CLI I'm trying out the aurelia-interactjs plugin to see if it meets my needs. I installed it into a new aurelia cli project by following all of the installation steps. I then added code for the Dragging section of the interactjs demo. The browser console displays the following error stating that interact is not a function:
Unhandled rejection TypeError: interact is not a function. (In 'interact(this.element)', 'interact' is undefined)
    attached@http://localhost:9005/node_modules/aurelia-interactjs/dist/amd/interact-draggable.js:18:21

Here's my code:
app.html
<template>

 You can drag one element

 with each pointer

</template>

app.js
export class App {
    constructor() {
        this.interactjsOptions = {
            // enable inertial throwing
            inertia: true,
            // keep the element within the area of it's parent
            restrict: {
                restriction: "parent",
                endOnly: true,
                elementRect: {
                    top: 0,
                    left: 0,
                    bottom: 1,
                    right: 1
                }
            },
            // enable autoScroll
            autoScroll: true,

            // call this function on every dragmove event
            onmove: dragMoveListener,
            // call this function on every dragend event
            onend: function(event) {
                var textEl = event.target.querySelector('p');

                textEl && (textEl.textContent =
                    'moved a distance of ' +
                    (Math.sqrt(event.dx * event.dx +
                        event.dy * event.dy) | 0) + 'px');
            }
        };
    }
}

function dragMoveListener(event) {
    var target = event.target,
        // keep the dragged position in the data-x/data-y attributes
        x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx,
        y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy;

    // translate the element
    target.style.webkitTransform =
        target.style.transform =
        'translate(' + x + 'px, ' + y + 'px)';

    // update the posiion attributes
    target.setAttribute('data-x', x);
    target.setAttribute('data-y', y);
}

A: I am sorry, wrote the above in the bus on my commute to work on my phone didn't read all the code :-)
If you want to have the basic draggable sample (first one from http://interactjs.io/), which allows you to just drag elements around:
app.css
.draggable {
  width: 25%;
  height: 100%;
  min-height: 6.5em;
  margin: 10%;

  background-color: #29e;
  color: white;

  border-radius: 0.75em;
  padding: 4%;

  -webkit-transform: translate(0px, 0px);
          transform: translate(0px, 0px);
}

app.html
<template>
  <require from="app.css"></require>

 You can drag one element

 with each pointer

</template>

app.ts (if you remove the public keyword in the function it will be valid js I think)
export class App {
  public dragMoveListener(event) {
      var target = event.target,
          // keep the dragged position in the data-x/data-y attributes
          x = (parseFloat(target.getAttribute('data-x')) || 0) + event.detail.dx,
          y = (parseFloat(target.getAttribute('data-y')) || 0) + event.detail.dy;

      // translate the element
      target.style.webkitTransform =
          target.style.transform =
          'translate(' + x + 'px, ' + y + 'px)';

      // update the posiion attributes
      target.setAttribute('data-x', x);
      target.setAttribute('data-y', y);
  }

  public dragEnd(event) {
      var textEl = event.target.querySelector('p');

      textEl && (textEl.textContent =
        'moved a distance of '
        + (Math.sqrt(event.detail.dx * event.detail.dx +
                     event.detail.dy * event.detail.dy)|0) + 'px');
    }

  public interactOptions = {
    // enable inertial throwing
    inertia: true,
    // keep the element within the area of it's parent
    restrict: {
      restriction: "parent",
      endOnly: true,
      elementRect: { top: 0, left: 0, bottom: 1, right: 1 }
    },
    // enable autoScroll
    autoScroll: true,
  };
}


text:
Q: Is it possible for a C++ compiler to automatically inline a private member function that is not implemented in a header file? If a private c++ method is implemented inside a .cpp compilation unit (not implemented in the class definition, nor declared as inline), is it possible for the compiler to automatically inline it anyway since it is only used inside the one .cpp compilation unit?
Example:
MyClass.h:
class MyClass
{
    public:
       void foo();

    private:
       void bar();
}

MyClass.cpp:
void MyClass::foo()
{
   bar();  //can the compiler choose to inline this call?
}

void MyClass::bar()
{
   printf("bar called\n");
}


text:
Q: facebook sdk v4.2 shows Error inflating class com.facebook.login.widget.LoginButton I know this is common question, but I have read through all the stack overflow questions without finding an answer.It shows  Error inflating class com.facebook.login.widget.LoginButton. Here my code
<com.facebook.login.widget.LoginButton
        android:id="@+id/login_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginBottom="30dp"
        android:layout_below="@+id/or"
        android:layout_alignLeft="@+id/login_email_tv"
        android:layout_alignRight="@+id/login_email"
        android:layout_marginTop="10dp"
         />

and this is my basic code
public class Login_Activity extends Activity {
// Your Facebook APP ID
    private static String APP_ID = "xxxxxxxxxxxxxxxxxxx";

     CallbackManager callbackManager;

//ImageButton fb_login;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.login_activity);

     FacebookSdk.sdkInitialize(this.getApplicationContext());

        callbackManager = CallbackManager.Factory.create();

        LoginManager.getInstance().registerCallback(callbackManager,
                new FacebookCallback<LoginResult>() {
                    @Override
                    public void onSuccess(LoginResult loginResult) {
                        // App code
                    }

                    @Override
                    public void onCancel() {
                         // App code
                    }

                    @Override
                    public void onError(FacebookException exception) {
                         // App code
                    }
        });

}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    callbackManager.onActivityResult(requestCode, resultCode, data);
}

}
Any one please give me suggestions for this.Am new to android

A: Have you integrated the Facebook SDK into your project? Check your build.gradle
You need to add the facebook module to the dependencies in build.gradle
dependencies {
   compile fileTree(include: ['*.jar'], dir: 'libs')
   compile project(':facebook')
}

As well, the Facebook module should be imported in settings.gradle:
include ':app', ':facebook'

A: Initialize Facebook SDK before SetContentView:
protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 FacebookSdk.sdkInitialize(getApplicationContext());
 setContentView(R.layout.login_activity);

    callbackManager = CallbackManager.Factory.create();

    LoginManager.getInstance().registerCallback(callbackManager,
            new FacebookCallback<LoginResult>() {
                @Override
                public void onSuccess(LoginResult loginResult) {
                    // App code
                }

                @Override
                public void onCancel() {
                     // App code
                }

                @Override
                public void onError(FacebookException exception) {
                     // App code
                }
    });
 }


text:
Q: How to declare function and use it recursively without "called too early to check prototype" I have a generic and recursive function but why it is not authorized in perl
sub pv($) {
    my ($vars) = @_;
    if(ref($vars) eq 'SNMP::Varbind') {
        return $vars->tag() . (defined($vars->iid()) ? '.' . $vars->iid() : '');
    } elsif (ref($vars) eq 'SNMP::VarList') {
        return join(', ', map { pv($_) } @$vars);
    } elsif(ref($vars) eq 'ARRAY') {
        return join('.', @{$vars});
    } else {
        return $vars;
    }
}

This error code "pv() called too early to check prototype" for this line return join(', ', map { pv($_) } @$vars);

A: Simple: forward declaration
sub pv($);
sub pv($) {

A: On Perl 5.16+, you can use the current_sub feature:
use strict;
use warnings;
use feature 'current_sub';

sub pv($) {
  ...
  __SUB__->($_)
  ...
}

This is more useful when using anonymous subs, so that you don't create a memory cycle (as it would close over a reference to itself; this doesn't occur with named subs, since it just looks up the symbol).
Additionally, consider just not using a prototype. It's very likely that you don't need it, unless you know why you do; prototypes are for the parser, not the caller. Without the prototype, calling it with parentheses will be sufficient to delay the symbol lookup.


text:
Q: How to automate Multi-Arch-Docker Image builds I have dockerized a nodejs app on github. My Dockerfile is based on the offical nodejs images. The offical node-repo supports multiple architectures (x86, amd64, arm) seamlessly. This means I can build the exact same Dockerfile on different machines resulting in different images for the respective architecture.
So I am trying to offer the same architectures seamlessly for my app, too. But how?
My goal is automate it as much as possible.
I know I need in theory to create a docker-manifest, which acts as a docker-repo and redirects the end-users-docker-clients to their suitable images.
Docker-Hub itself can monitor a github repo and kick off an automated build. Thats would take care of the amd64 image. But what about the remaining architectures?
There is also the service called 'TravisCI' which I guess could take care of the arm-build with the help of qemu.
Then I think both repos could then be referenced statically by the manifest-repo. But this still leaves a couple architectures unfulfilled.
But using multiple services/ways of building the same app feels wrong. Does anyone know a better and more complete solution to this problem?
It's basically running the same dockerfile through a couple machines and recording them in a manifest.

A: Starting with Docker 18.02 CLI you can create multi-arch manifests and push them to the docker registries if you enabled client-side experimental features.  I was able to use VSTS and create a custom build task for multi-arch tags after the build.  I followed this pattern.
docker manifest create --amend {multi-arch-tag} {os-specific-tag-1} {os-specific-tag-2}
docker manifest annotate {multi-arch-tag} {os-specific-tag-1} --os {os-1} --arch {arch-1}
docker manifest annotate {multi-arch-tag} {os-specific-tag-2} --os {os-2} --arch {arch-2}
docker manifest push --purge {multi-arch-tag}

On a side note, I packaged the 18.02 docker CLI for Windows and Linux in my custom VSTS task so no install of docker was required.  The manifest command does not appear to need the docker daemon to function correctly.


text:
Q: find duplicate with if statement then delete duplicate I have a table (BERTHAGE) that tracks the location of vessels when they are in the port.
When a vessel moves from one location to another location I process the move through a form which is tied into a combo box.
I use one combo box (tied into a query) to give me the current list of vessels in port.
From there I select the vessel that is moving.
Once the vessel is selected I use another combo box to select the new location.
From there I click the Save button and the record is saved in the appropriate table with the vessel now tied into the new location.
The issue I am having is that the prior location record still exists in the same table (BERTHAGE).
So now I have two records for one vessel in the same week, this becomes an issue when it comes to invoicing.
What I'm trying to do is eliminate one of the entries and of course it must be the older entry/former location of the vessel.
Because each entry is assigned an auto-number (primary key) the newest entry, the movement of the vessel from one location to another, will always have the higher auto number.
I have been trying to come up with a way to find the duplicate in the table (BERTHAGE), based on the vessel name and then delete the older entry with the duplicate vessel name.
It seems the only way to go about this is a series of queries (find duplicate, append) and this ends in over writing the entire table each time.  I'm trying to avoid this and stick with the goal of only deleting any duplicates that are occurring that week when a vessel moves from one spot to another.
Though my scripting is average, I can't help but to think that the best way to achieve this goal will be through something akin to an IF statement tied into the save button.  I was hoping Access would have something similar to Excel's .RemoveDuplicates, but to date I have found not found it.
Looking for any pointers people may have.
Private Sub Form_Load()
DoCmd.RunCommand acCmdRecordsGoToLast
End Sub

Private Sub cmd_Clear_Click()
Me.Boat_New_Loc = ""
Me.CrNum.value = ""
Me.CrDockValue.value = ""
Me.CrFloatValue.value = ""
Me.CrOriValue.value = ""
Me.SelectNewLoc.value = ""
Me.cmd_berthed.value = ""
Me.NewFloatValue.value = ""
Me.NewDockValue.value = ""
Me.NewOrieValue.value = ""
End Sub

Private Sub Boat_New_Loc_Change()
Me.CrNum.value = Me.Boat_New_Loc.Column(4)
Me.CrDockValue.value = Me.Boat_New_Loc.Column(5)
Me.CrFloatValue.value = Me.Boat_New_Loc.Column(6)
Me.CrOriValue.value = Me.Boat_New_Loc.Column(7)
End Sub

Private Sub SelectNewLoc_Change()
Me.NewFloatValue.value = Me.SelectNewLoc.Column(1)
Me.NewDockValue.value = Me.SelectNewLoc.Column(2)
Me.NewOrieValue.value = Me.SelectNewLoc.Column(3)
End Sub

Private Sub Save_Code_But_Click()

    DoCmd.RunSQL "UPDATE BERTHAGE SET BERTHAGE.LOCATION=False WHERE LOCATION=" & Me!CrNum _
& " AND LOCATION <>" _
& Me!SelectNewLoc & _
" AND BERTHAGE.LOCATION=True;"

DoCmd.Save acForm, "Change_Boat_Location3"

cmd_Clear_Click
End Sub

A: Rather than deleting the record, I would advise setting a flag in the table to indicate that it is not active. This means that you can recreate historical data if needed.
In my examples, I am going to assume that the table Berthage has a primay key field called ID that is an Autonumber, a field VesselID that is a numeric  foreign key from a Vessel table that gives information about the vessels, and also has BerthageActive, which is a Yes/No field.
If you are able to do the update before saving the new information in the Berthage table, then you can use:
CurrentDb.Execute "UPDATE Berthage SET BerthageActive=False WHERE VesselID=" & Me!VesselID & " AND BerthageActive=True;"

If the new data already exists in the Berthage table, then you can use:
CurrentDb.Execute "UPDATE Berthage SET BerthageActive=False WHERE VesselID=" & Me!VesselID & " AND ID<>" & Me!ID & " AND BerthageActive=True;"

Regards,


text:
Q: How subscriber keys are being added in Marketing cloud? I am not getting this quite easily
If I have a DE, and I have multiple fields in it, and one is mapped as subcribey key ( ID let's say ), and id value is : 00848-454-555585545ds for one of the row, and there is an email field as well
Does that mean if I go to All subscribers and search by this id in the search by subscriber key tab, I am supposed to find the subscriber with the right email address ? right ?
bUT When I do that I find nothing
Example :
My DE properties and subscriber key

Two records :

If I look for this subscriber after a while, nothing is found :

Any detailed explanation on how this works exactly
Any help would be much appreciated

A: Subscriber Key values are set in the following ways:

*

*An import into All Subscribers

*An API call that sends a message (in all channels)

*A send to a Data Extension that has a sendable field mapped

*An integration that includes a Subscriber Key mapping

I may have missed some of them, but in most cases a send has to occur for it to show in All Subscribers -- at least for email.


text:
Q: how to do a NULL check in unpivot in sql I have the below sql query which I am using on sql server.
select distinct  [Value],Label,Id from(
select distinct [Name], Code, I as Id,I + ':' + [Value] as label, [Value]
from [test].[dbo].[emp]
unpivot
(
  [Value]
  for I in (product, model)
) as dataTable) as t

What I want to have is if any [Value] inside unpivot statement is null, it should return 'unknown' to the nested select statement.
How do I achieve it ?
Update--
//this is wrong sql. Just want to show what is required
select distinct  [Value],Label,Id from(
select distinct [Name], Code, coalesce(I as Id,'unknown'),coalesce(I,'unknown') + ':' + [Value] as label, coalesce([Value],'unknown')
from [test].[dbo].[emp]
unpivot
(
  [Value]
  for I in (product, model)
) as dataTable) as t

A: You seem to be looking for coalesce():
from (select distinct [Name], Code, I as Id,
             I + ':' + coalesce([Value], 'unknown') as label,
            [Value]
      from [test].[dbo].[emp]
     ) e

I would suggest writing the query as:
I'm not sure what you really want, but I would suggest writing the query as using apply.
select distinct v.id, (v.id + ':' + coalesce(v.[Value], 'unknown')) as label,
       coalesce(v.[Value], 'unknown') as value
from [test].[dbo].[emp] e cross apply
     (values (e.product, 'product'), (e.model, 'model')
     ) v(value, id);

This seems much simpler and probably performs better too.


text:
Q: Preserving Tab-Space with XSL-FO I did not found an explicit question like the following:
I want to convert XML to PDF preserving tabspace (ASCII 009) in XSL-FO.
My <fo:block /> looks like this:
<fo:block linefeed-treatment="preserve" white-space-collapse="false" white-space-treatment="preserve">
    <xsl:value-of select="orderText" />
</fo:block>

With this configuration I can preserve line breaks and normal spaces but no tab-space. I tried many attributes from this post: Preserving whitespace in PDF after XSL transform
but it still doesn't work. If I put in this:
Forename:       John
Surname:        Smith

I get this:
Forename: John
Surname: Smith

For Information:
In my XSL-FO I use a Layout-Master for formatting the page. Maybe this could be the problem.
This is the complete XSL-File.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:ext="http://exslt.org/common" xmlns:fo="http://www.w3.org/1999/XSL/Format">

  <xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>
  <xsl:preserve-space elements="orderText" />

  <!-- If we see an envelope, we create an FO document -->
  <xsl:template match="/tiff">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
        <fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm"
          margin-top="1.5cm" margin-bottom="2cm" margin-left="2cm" margin-right="2cm">
          <fo:region-body margin-top="10mm" margin-bottom="5mm" />
          <fo:region-before region-name="header" />
          <fo:region-after region-name="footer" />
        </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="simpleA4">
        <fo:flow flow-name="xsl-region-body" text-align="justify" font-size="11pt">
          <!-- This will call generate stream headers (if applicable) -->
        <fo:block font-weight="bold" font-size="12pt" space-after="7mm">
            <xsl:text>Informationen zum Auftraggeber</xsl:text>
        </fo:block>
        <fo:block space-after="7mm">
            <fo:table>
               <fo:table-body>
                  <fo:table-row>
                     <fo:table-cell>
                        <fo:block>Auftragsnummer</fo:block>
                     </fo:table-cell>
                     <fo:table-cell>
                        <fo:block><xsl:value-of select="orderId" /></fo:block>
                     </fo:table-cell>
                  </fo:table-row>
                  <fo:table-row>
                     <fo:table-cell>
                        <fo:block>Erstellt von</fo:block>
                     </fo:table-cell>
                     <fo:table-cell>
                        <fo:block><xsl:value-of select="creator" /></fo:block>
                     </fo:table-cell>
                  </fo:table-row>
                  <fo:table-row>
                     <fo:table-cell>
                        <fo:block>Erstellt am</fo:block>
                     </fo:table-cell>
                     <fo:table-cell>
                        <fo:block><xsl:value-of select="createDate" /></fo:block>
                     </fo:table-cell>
                  </fo:table-row>
                  <fo:table-row>
                     <fo:table-cell>
                        <fo:block>Verwendete mTAN</fo:block>
                     </fo:table-cell>
                     <fo:table-cell>
                        <fo:block><xsl:value-of select="mTAN" /></fo:block>
                     </fo:table-cell>
                  </fo:table-row>
               </fo:table-body>
            </fo:table>
        </fo:block>
        <fo:block font-weight="bold" font-size="12pt" space-after="7mm">
            <xsl:text>Informationen zum Kunden</xsl:text>
        </fo:block>
        <fo:block space-after="7mm">
            <fo:table>
               <fo:table-body>
                  <fo:table-row>
                     <fo:table-cell>
                        <fo:block>ZAD-Kundennummer</fo:block>
                     </fo:table-cell>
                     <fo:table-cell>
                        <fo:block><xsl:value-of select="customerId" /></fo:block>
                     </fo:table-cell>
                  </fo:table-row>
                  <fo:table-row>
                     <fo:table-cell>
                        <fo:block>Name</fo:block>
                     </fo:table-cell>
                     <fo:table-cell>
                        <fo:block><xsl:value-of select="surname" /></fo:block>
                     </fo:table-cell>
                  </fo:table-row>
                  <fo:table-row>
                     <fo:table-cell>
                        <fo:block>Vorname</fo:block>
                     </fo:table-cell>
                     <fo:table-cell>
                        <fo:block><xsl:value-of select="forename" /></fo:block>
                     </fo:table-cell>
                  </fo:table-row>
               </fo:table-body>
            </fo:table>
        </fo:block>
        <fo:block font-weight="bold" font-size="12pt" space-after="7mm">
            <xsl:text>Informationen zum Vertrag</xsl:text>
        </fo:block>
        <fo:block space-after="7mm">
            <fo:table>
               <fo:table-body>
                  <fo:table-row>
                     <fo:table-cell>
                        <fo:block>Versicherungsscheinnummer</fo:block>
                     </fo:table-cell>
                     <fo:table-cell>
                        <fo:block><xsl:value-of select="vsnr" /></fo:block>
                     </fo:table-cell>
                  </fo:table-row>
                  <fo:table-row>
                     <fo:table-cell>
                        <fo:block>Bestandsart</fo:block>
                     </fo:table-cell>
                     <fo:table-cell>
                        <fo:block><xsl:value-of select="ba" /></fo:block>
                     </fo:table-cell>
                  </fo:table-row>
                  <fo:table-row>
                     <fo:table-cell>
                        <fo:block>Konzerngesellschaft</fo:block>
                     </fo:table-cell>
                     <fo:table-cell>
                        <fo:block><xsl:value-of select="kg" /></fo:block>
                     </fo:table-cell>
                  </fo:table-row>
               </fo:table-body>
            </fo:table>
        </fo:block>
        <fo:block font-weight="bold" font-size="12pt" space-after="7mm">
            <xsl:text>Auftragstext</xsl:text>

        </fo:block>
        <fo:block linefeed-treatment="preserve" white-space-collapse="false" white-space-treatment="preserve">
        <xsl:value-of select="orderText" />
        </fo:block>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </xsl:template>
</xsl:stylesheet>

A: XSL-FO does not handle tabs other than being whitespaces.  A tab does not have a specific width, and there are not "tab stops" defined in the blocks.
Positioning in XSL-FO is done through block, and position properties.  It looks like what you want here, is to use an extra column and split the value in 2: the first part in one cell, the second part in the other.


text:
Q: How do you match a string with optional encapsulating tags I basically need to parse some HTML which is oddly formatted.
It might be wrapped in a anchor tag or it might not.
e.g.
capture text ...some other html

or just
capture text ...some other html

How can I construct a pattern than knows to ignore  and the subsequent  afterwards? Ideally being able to capture the "capture text" part as a named group. I've tried just doing an either pattern but it complains about the named group being the same, is there a way around this?
Regex tester with unit tests that show if the regex can match with and without tags to the same group identifier if possible.


text:
Q: Draw line with connector to text using CSS Is it possible to draw this kind of line using CSS only?
         This line
 __________|_____________
|                        |
|                        |

or
|                        |
|                        |
└────────────────────────
            |
         This line

I'm terrible at drawing using simple text but in picture ideally I want this to be like this:

Or like this

It can be dynamic depend on the size of the div that is pointing to.
Just to be clear to my question:
If this is possible to draw the same line as example above using plain CSS or I have to use image then scale them accordingly?
Example of final result that I want:

A: I think the simplest way to do that is using negative margins, but using absolute positioning would work too. There are many ways to achieve this effect.
First the structure the code:
Content before.

    Content inside.

Content after.

I placed the .top.line as the first element and the .bottom.line as the last element because I'm using negative margins. If you used absolute positioning the placement in the HTML code wouldn't matter.
Then you pick a line length. Here I'll pick 20px. Since I wouldn't want my line overlapping with the content before and after the div, I'll add that much of a vertical margin to the .rectangle.
.rectangle {
    margin: 20px 0;
    border: 1px dotted black;
}

The .line will have a right border with the same style, that right border is going to be the actual line. You can control the horizontal position by changing the width of the .line. In this case you want it on the middle, so 50%, if you wanted it to be more to the right, 80% etc.
.line {
    border-right: 1px dotted black;
    width: 50%;
    height: 20px;
}

Finally, in order to put the line out of the div, you use negative margins. The value of each margin must be equal the border-widthplus the padding of the .rectangle. Since this .rectangle has no padding but a border-width of 1, I add 1 to 20 and use a margin of -21px.
.top.line { margin-top: -21px; }
.bottom.line { margin-bottom: -21px; }

Obs.: Obviously you have to use padding-top + border-top-width for the .top.line and the bottom equivalents for the .bottom.line.
You can see the result here: http://jsfiddle.net/QJNHL/
P.S.: I have nothing to do so here is the "set-like" effect posted using the same technique. http://jsfiddle.net/34yHs/

A: Yes you can do so using simple borders on positioned pseudo elements:

No account needed

.bracket {
    position: relative;
    padding-top: 20px;
    text-align: center;
}

.bracket:before, .bracket:after {
    content: '';
    position: absolute;
    display: block;
    width: 100%;
    height: 15px;
    border: 1px dotted gray;
}

.bracket:before {
    bottom: 100%;
    border-width: 0 1px 1px 1px;
}

.bracket:after {
    top: 0;
    left: 50%;
    width: 0;
    border-width: 0 1px 0 0;
}

Demo: http://jsfiddle.net/feeela/BVLx2/3/

A: Here's another version that uses rounded corners: http://jsfiddle.net/jwuB3/1/.
HTML:

No Account Needed

CSS:
.bracket {
    margin-top: 50px;
    position: relative;
    width: 301px;
    text-align: center;
    font: 10px/1 Sans-Serif;
}

.bracket:before {
    content: "";
    position: absolute;
    left: 0;
    top: -22px;
    width: 100%;
    height: 10px;
    border: 1px dotted #aaa;
    border-top-width: 0px;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
}

.bracket:after {
    content: "";
    position: absolute;
    left: 50%;
    top: -12px;
    height: 10px;
    border-left: 1px dotted #aaa;
}


text:
Q: How to define conversions between templates meant to represent 2D coordinates? I have an application where for some reason (well, speed and storage space, basically) I need to work with integer 2D coordinates most of the time.
Some intermediate computations require floating point, though.
I defined a template to implement the same operations on integer- and double-valued coordinates like so:
template <typename T>
struct tTypedPoint {
    T x, y;

    tTypedPoint() {}
    tTypedPoint(T x, T y) : x(x), y(y) {}
    tTypedPoint(const tTypedPoint & p) { *this = p; }
    tTypedPoint operator+ (const tTypedPoint & p) const { return{ x + p.x, y + p.y }; }
    tTypedPoint operator- (const tTypedPoint & p) const { return{ x - p.x, y - p.y }; }
    tTypedPoint operator* (T scalar) const { return{ x * scalar, y * scalar }; }
    tTypedPoint operator/ (T scalar) const { return{ x / scalar, y / scalar }; }
    bool operator== (const tTypedPoint & p) const { return x == p.x && y == p.y; }
    T dot(const tTypedPoint &p) const { return x*p.x + y * p.y; } // dot product
};

typedef short  tCoord;
typedef double tFloatCoord;

typedef tTypedPoint<tCoord     > tPoint;
typedef tTypedPoint<tFloatCoord> tFloatPoint;

As it is, I cannot mix tPoint and tFloatPoint operations without copying tPoints into tFloatPoints explicitely, which is both ugly and inefficient.
Ideally, I would like a tPoint to be converted into a tFloatPoint in a manner similar to base types promotion (like an int is promoted to double, for instance).
Frankly I have no clue how to do this, if that is even possible.
I have looked into the conversion operators but I can't see how I could define them in that case (you would have to specify the type of the converted point somewhere, but I can't see where).
I'm sure I'm missing something obvious there, but my brain simply fails to process this problem.

A: You may add a template constructor:
template <typename T>
struct tTypedPoint {
    T x, y;

    template<typename U>
    tTypedPoint(const tTypedPoint<U>& rhs) : x(rhs.x), y(rhs.y) {}

    // Previous code
};

You may also restrict this constructor with SFINAE or static_assert to make sure that the conversion is what you want to allow.


text:
Q: Error when building a C++ program for the second time After some time I've got this problem with my C++ compiler.
When I write the code and I compile if for the first time, there's no problem and I can execute it normally. But then, after the program is finished in the terminal, if I make any change in the code and try to compile it again, I get this problem:
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot open output file C:\Users\gabri\Codes/test.exe: Permission denied
collect2.exe: error: ld returned 1 exit status
And I get access denied when trying to run the .exe file after that.
I have no idea how to solve it. I try to compile usually in Sublime but even in an IDE like Codeblocks I get the same problem.
I don't know if it might help, but this is an image of my PC's Path, just in case.

A: Seems like you are trying to compile even when the previous process is still running. You must track it from task manager and kill the process before you compile it again.
Looking into your comment,seems like a permission issue may be,check if you are running the command prompt or the IDE with admin privilege or not,if no,try running it with administrator privilege.


text:
Q: Is there a way to directly set fulfillment messages using dialogflow app instance using actions on google client library We've a dialogflow agent that integrates with Actions on Google as well as Dialogflow Phone Gateway. We use webhook fulfillment for handling many intents and generate responses using SSML.
Dialogflow module in AoG client library doesn't currently support the phone gateway integration. Is there a way to access and set the Dialogflow response object's fulfillment messages object with the right information so that the responses work with the phone gateway? The app instance for Dialogflow module (on AoG) only supports conv.ask and conv.close functions which do not permit direct manipulation the underlying JSON object. Phone gateway requires specific values in the fulfillment messages object to activate SSML text to speech.
Any pointers are appreciated.

A: To manipulate the JSON body of a response, you can use conv.serialize. To replace the response, you can use conv.json with the updated payload as the parameter.
This strategy is employed in the Session Entities plugin to the library:
const responseBody = this.conv.serialize() as ResponseBody
const convBody = this.conv.body as GoogleCloudDialogflowV2WebhookRequest
responseBody.sessionEntityTypes = this.entities.map(entity => {
  entity.name = `${convBody.session}/entityTypes/${entity.name}`
  return entity
})
this.conv.json(responseBody)


text:
Q: Select Distinct in Node jS and MongoDB I have a problem where I want to be able to get all data related to the classroom with no duplicate. My code look like this. The problem is that in console data are displayed correctly with no duplicate. But in sites no data display.
This is data display in Console
[ '6 Usaha', '6 bakti' ]

Timetable Schema
var TimetableSchema = new mongoose.Schema ({

    timeslot: {
        required: true,
        'type': Number,

    },

    classroom :{
        type:String,
        required: true,
    },

    subject :{
        type:String,
        required: true,
    },

    teacher :{
        type:String,
        required: true,
    },

    year :{
        type:String,
        //required: true,
    },

    session :{
        type:Number,
        //required:true,
    }

})

var Timetable = mongoose.model('Timetable', TimetableSchema);
module.exports = Timetable;

Route
router.get('/timetable',mid, function(req,res){
  Timetable.distinct("classroom",function(err,timetable){
    if (err) throw err;
    console.log(timetable);
    res.render('admin_content/timetable',{'timetable':timetable});
  });
});

Views

   <% timetable.forEach(function (timetable) { %>

   <%= timetable.classroom %>
   <a class="button" href="/subject/edit/<%= timetable.classroom %>"View

   <% }) %>

A: Change your code like below ,As your array doesn't contains js objects its just primitive values [ '6 Usaha', '6 bakti' ]

   <% timetable.forEach(function (value) { %>

   <%= value %>
   <a class="button" href="/subject/edit/<%= value %>"View

   <% }) %>


text:
Q: select multiple tables sql in vb.net datagrid view - sql &vb.net I am trying to select multiple tables in mysql and then return it to a datagridview to my application. The SQL query downunder, doesn't work. Is the sql wrong? I have two tables called "bruker" & "blodgiver" in mysql
Dim searchQuery As String = "SELECT bruker INNER JOIN blodgiver WHERE CONCAT(bruker_id, fornavn, etternavn, epost, personnummer) like '%" & valueToSeach & "%'"

Dim command As New MySqlCommand(searchQuery, MysqlConn)
Dim adapter As New MySqlDataAdapter(command)
Dim table As New DataTable()

adapter.Fill(table)

DataGridView1.DataSource = table

A: You have to provide on clause.
SELECT * FROM bruker br INNER JOIN blodgiverbd on bd.<link_column1> = db.<link_column2>  WHERE CONCAT(bruker_id, fornavn, etternavn, epost, personnummer) like '%" & valueToSeach & "%'"