Databricks Delta Table from Datalake with Partitioned Folders

Question: I have data on Azure Storage Account in a Container called Staging.
Using the SourceSystem/Dataset hierarchy I also have date based folder per month.

Inside the folder the data is stored in a delta format.

In data bricks I already have the the container mounted.
I want to create a Delta Table whereby I can see ALL the data in the underlying folder printtransaction folder.
DROP TABLE IF EXISTS staging.default.ysoft_printtransaction;

CREATE TABLE staging.default.ysoft_printtransaction
USING delta
OPTIONS ('delta.checkpoint.writeStatsAsJson' 'false', 'delta.checkpoint.writeStatsAsStruct' 'true')
LOCATION 'abfss://firstname.lastname@example.com/ysoft/printtransaction/*/';

SELECT * FROM staging.default.ysoft_printtransaction;

This however does not work as I am getting an issue when reading from the table stating:

Obviously I don't want to create a table per partitioned folder.
What are my options?
Comment: Each folder is already a Delta Lake table. Do you want to combine them all together? Who wrote that tables? It's really not a best design
Comment: I realise they are. I would prefer to not have the underlying deltas under the SourceSystem\Dataset. Each dataset have a dedicated column called _partition which I can use to rather create a single delta table with a partition reference.
Comment: Yep, read each table separately, and output it somewhere else as a single table
Answer: As per information you provided these two folders are separate delta table. I agree with @Alex Ott as he said as these two folders are separate delta tables you need to read them separately then you can merge them and combine it using merge query in the different table.
It will not be able read the data from multiple delta tables in a single table.

Sample code to read each folder separately:
CREATE  TABLE  ysoft_printtransaction1
USING delta
Location  'abfss://email@example.com/sampledb/202113';

CREATE  TABLE  ysoft_printtransaction2
USING delta
Location  'abfss://firstname.lastname@example.com/sampledb/202110';

To merge table, you can use following command.
MERGE  INTO  target  USING  source
  ON  target.key  =  source.key
  WHEN  NOT  MATCHED  THEN  INSERT  *


File icon with a cross, what does it mean?

Question: A file icon shown below has a cross on the lower right corner, what does that mean?
Answer: You don't have read permission for that file.
Answer: Simple self-answering test:

Create an empty file
touch ~/bar

Remove the read permissions
chmod -r ~/bar

Comment: @CaptainGiraffe Numix Circle is the icon theme.
Comment: Neat icons. What are they called?
Answer: You can provide others read access to that file so that it wont display.
sudo chmod o+r <your_filename>
Comment: This does not provide an answer to the question. Once you have sufficient [reputation](https://askubuntu.com/help/whats-reputation) you will be able to [comment on any post](https://askubuntu.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/1282491)


How to remove specific character from string in spark-sql

Question: I want to convert '123,456' to 123456 (string to int) by spark-sql.
I tried like this.
REPLACE('123,456', ',', '')

But it didn't work, because spark-sql don't permit REPLACE()
Comment: is there a cast or convert function?
Comment: yes, there is cast function. but, it didn't work.
Answer: replace works as expected for me (Spark 2.3.0):
spark.sql("select int(replace('123,456', ',', '')) result").collect()
# [Row(result=123456)]

Answer: assuming all data are numeric while stored in varchar convert function should solve your issue
conv(Column num,
          int fromBase,
          int toBase)


Parsing a string to decimal works on Windows 8 but not on windows 7

Question: I have a method that takes a string value and parses it into decimal.  That works perfectly on windows 8.1 but when i test the application on windows 7 it fails.
Windows 7 does have Dot net Framework 4.5 installed.
What could be the problem?
Here's the method:
void Save_Details()
{
     //The customer enters dots instead of commas to specify a decimal place
     string Ammount_Now = textbox1.Text.Replace('.', ',');//value text entered is 123.34
     //The value of Ammount_Now is now 123,34
     decimal value = 0;
     bool Ammount_Good = decimal.TryParse(Ammount_Now, out value);

     if(Ammount_Good)
     {
           //continue with method
           // windows 8 returns true in the decimal.TryParse()
           // windows 7 returns false in the decimal.TryParse()
           // They both use .net framework 4.5
     }
     else
     {
            //failed parsing
     }

}

Comment: Please don't try to "fix" decimals, they are *not* broken. Use the proper culture when parsing. In your case InvariantCulture will work. The OS isn't broken you just tested the code in a different locale.
Comment: Check if decimal separator is the same on both OS? most probably on one  it's a comma, on other it's a dot.
Answer: There's nothing wrong with the OS versions, you tested the code in machines with different locales.
There's also no need to replace decimal marks to "fix" them as long as you use the proper CultureInfo when parsing. If the input text is always expected to use . as the decimal mark, you should use the Decimal.TryParse Method (String, NumberStyles, IFormatProvider, Decimal) overload:
decimal.TryParse(Amount_Now,NumberStyles.Number,CultureInfo.InvariantCulture,out value)


What is wrong with the following solution to a basic combinatorial type probability question?

Question: I am reviewing my probability lecture notes and I decided to try and
do the exercises that were solved in the lecture.
I tried to solve the following problem, but came up with a different
answer than the one given in the lecture, so I suspect I got it wrong.

We draw cards from a deck of cards (with $52$ cards), what is the
  probability that the first king was drawn at the $n-th$ draw ?

My attempt:
The total number of sequences of $n$ cards is $\binom{52}{n}\cdot n!$
.
There are $\binom{4}{1}$ ways to get the king in the $n-th$ draw.
There are $\binom{52-4}{n-1}\cdot(n-1)!$ sequences of $n-1$ cards
with no king in them.
Hence the answer is
$$
\frac{\binom{4}{1}\cdot\binom{48}{n-1}\cdot(n-1)!}{\binom{52}{n}\cdot n!}
$$
Can someone please help me understand my mistake ?
Comment: Are you sure your answer is different, as opposed to just looking different?
Comment: @GerryMyerson - Yes (unless I made another mistake...it is not the same for $n=3$)
Comment: For $n=3$, your formula gives $(4)(48)(47)/(52)(51)(50)$, and Damien's gives $(48/52)(47/51)(4/50)$, which is the same thing. If Damien is right, so are you (at least, for $n=3$).
Comment: @GerryMyerson - I will check this again and post a comment
Comment: Your answer is the same as Damien's: $$\frac{\binom41\cdot\binom{48}{n-1}\cdot(n-1)!}{\binom{52}{n}\cdot n!}=\frac{4\cdot 48^{\underline{n-1}}}{52^{\underline n}}\;,$$ where $x^{\underline n}$ is the [falling factorial](http://en.wikipedia.org/wiki/Pochhammer_symbol).
Comment: @BrianM.Scott - Thanks Brain! I tried to develop both expressions but I wasn't able to see if they are indeed equal. I guess that the lecture gave the more difficult solution, using conditional probability, for pedagogical reasons. If you wish, you can make your comment an answer and I will accept it (the current answer suggest a solution to the problem itself and not my question so I would rather to accept your answer)
Comment: Done!${}{}{}{}$
Answer: To get the first knight at the n-th draw, it means that from draw 1 to draw $n-1$ you are not getting a knight and at the n-th draw it is a knight.
There are 4 knights in $52$ cards, so the probability not to get a night at draw 1 is $48/52$.
Then for the second draw, there is one card less in the deck, so the probability to have no nights both draw 1 and draw 2 is $48/52 \times 47/51$ etc.
And the probability to get specifically a knight at draw $n$ is $4/(52 - n + 1)$.
Multiply everything and you'll get the answer.
Comment: knight? king!${}$
Comment: Yes, I'll go shoot myself :\
Comment: Thank you for your answer, but this does not explain what was my mistake
Answer: Your answer is the same as Damien's:
$$\frac{\binom41\cdot\binom{48}{n-1}\cdot(n-1)!}{\binom{52}n\cdot n!}=\frac{4\cdot 48^{\underline{n-1}}}{52^{\underline n}}\;,$$
where $x^{\underline n}$ is the falling factorial. You just got there by a different route.


Ensuring two metavariables aren't unified to the same result

Question: I'm trying to write a tactic which will automatically pick up inconsistencies in Setoid-based hypotheses.
For instance, If I have the following hypotheses,
  H1 : x == y
  H2 : z == y
  H3 : x =/= z

I would like to be able to solve this with some combination of exfalso, apply, transitivity, and symmetry. When using this tactic:
  match goal with
    [ eq1 : ?X == ?Z |- _ ] =>
    match goal with
      [ eq2 : ?Y == ?Z |- _ ] =>
        match goal with
          [ eq3 : ?X =/= ?Y |- _ ] => exfalso; apply eq3; [...]

        end
    end
  end.

eq1 and eq2 will be bound to the same hypothesis. Is there any way to ensure that ?X and ?Y are unified to distinct variables?
Answer: I believe that the fact that eq1 and eq2 are bound to the same hypothesis is not a problem, because match backtracks when it chooses a failing branch.  Here is a proof that discharges a similar goal, with setoid equality being replaced by Leibniz equality:
Lemma test T (x y z : T) : x = y -> z = y -> x <> z -> False.
Proof.
intros.
match goal with
| eq1 : ?X = ?Y |- _ =>
  match goal with
  | eq2 : ?Z = ?Y |- _ =>
    match goal with
    | eq3 : ?X <> ?Z |- _ => destruct (eq3 (eq_trans eq1 (eq_sym eq2)))
    end
  end
end.
Qed.

Note that this could also have been written in a more compact form:
Lemma test T (x y z : T) : x = y -> z = y -> x <> z -> False.
Proof.
intros.
match goal with
| eq1 : ?X = ?Y,
  eq2 : ?Z = ?Y,
  eq3 : ?X <> ?Z |- _ => destruct (eq3 (eq_trans eq1 (eq_sym eq2)))
end.
Qed.

Edit
If you absolutely want to prevent overlapping matches early, you can also use the fail tactic to force backtracking:
Lemma test T (x y z : T) : x = y -> z = y -> False.
Proof.
intros.
match goal with
| eq1 : ?X = ?Y |- _ =>
  match goal with
  | eq2 : ?Z = Y |- _ =>
    match Z with
    | X => fail 1
    | _ => idtac eq1 eq2
    end
  end
end.
Abort.

If Coq binds eq1 and eq2 to the same hypothesis, the first branch of the third match will activate and call fail 1.  This has the effect of choosing the next branch in the second-closest backtracking point -- in this case, the second match, which binds eq2.  Running this code prints two different hypothesis names in the response buffer.
(If you replace fail 1 by fail 0 (or simply fail), Coq will instead choose the next branch of the closest backtracking point, which is the third match.  Since the next branch accepts all values, it will run idtac eq1 eq2 no matter what, which on my machine ends up printing H0 H0.)
Note that in your example, you could have also matched eq1 and eq2 simultaneously to prevent them from being equal.  For instance, the following snippet, which tries to force this equality, fails:
Lemma test T (x y z : T) : x = y -> z = y -> False.
Proof.
intros.
match goal with
| eq1 : ?X = ?Y,
  eq2 : ?Z = ?Y |- _ =>
    match Z with
    | X => idtac eq1 eq2
    end
end.
Abort.

(* Error: No matching clauses for match. *)

Comment: Oh interesting, I didn't realize that match syntax. Is there no way in general to prevent overlapping unification?
Comment: Awesome! I appreciate that you both solved my particular problem and helped me understand the general case.


Custom Error Page in IIS 7.5 when a service (e.g. ColdFusion) is down

Question: For times when my ColdFusion service is down (which is rare), I need a "pretty" default HTML page that could display. The specific status error when ColdFUsion is down is a 503 error.
Based on this question it appears that it could be difficult to override the default display of a 503 error message. I'm not an ASP/.NET developer, so I'm not sure whether the same circumstances would affect me, since I don't have an active application pool for my site in any case.
I tried adding a custom page and linking it to the 503 error using "Execute URL on this site". That removed the previous error page but did not render the HTML page (I verified that loading the page itself did work).  I tried the "Insert Content from Static File" option, and that led to an error (I tried tracking down the specifics, but wasn't able to find it either in the Event Viewer or the IIS logs).
So, I have two questions:

Absent a .Net application pool being in effect, is it possible to
have a custom error page for handling 503 errors due to a service
being down (I assume other application platforms besides ColdFusion
might have similar behavior)
What is the preferred method for handling the error -- Executing a
URL, including a static file, or performing a 302 redirect?
Comment: I just tested this successfully using IIS 8.0. I created a simple HTML page and placed it in the root of my website.  In IIS Manager I added a new custom error page for 503. I used the "Insert content from static file" option and selected the HTML file I created.  I stopped my ColdFusion instance and then browsed my site.  I see the message from my HTML file. How did you test creating the 503 error response?
Comment: To clear up one of your questions, you do have an application pool in effect with your website. All websites running under IIS have an application pool assigned to them. This is how they are isolated from one another. In the case of a 503 error the "Execute URL on this site" doesn't make sense to me. Executing a URL would need a functioning service no? I would think you need to use the "Insert content from static file" option and just create an HTML file for it. Not sure why this gave you an error. Did you get the error when making the change itself or after you made a request and got a 503?
Comment: I got an error when requesting the page. After choosing the "Insert static file" option for a known HTML file and then re-requesting the main page for the site, I receive the following error: "The page cannot be displayed because an internal server error has occurred."
Comment: I tried again. I got the following error when trying to use the Insert Static Content: "Absolute physical path is not allowed in system.webserver/httperrors section in web.config file. use relative path instead." I then enabled the absolute physical path option in the application config file. But then, when refreshing the site, I got the old "Macromedia" 503 error. It's as if it's ignoring my 503 error page!
Comment: Also, I experience extremely long latency for returning a known HTML file when the ColdFusion service is stopped -- like 15 seconds to download a < 1k HTML file.  Downloading images is instantaneous.
Answer: This may be along time coming but what you need to do is add the error_page= /{any html page} to your isapi_redirect.properties file. See image or link.
isapi_redirect


Why is $\vec{v_1}^T \vec{v_2} = \vec{v_1} \cdot \vec{v_2}$?

Question: If $A$ is a symmetric matrix, and $\vec{v_1}, \vec{v_2}$ are eigenvectors of $A$ with distinct eigenvalues $\lambda_1, \lambda_2$, then
$$\vec{v_1}^T A \vec{v_2} = \vec{v_1}^T (\lambda_2 \vec{v_2}) = \lambda_2 (\vec{v_1}^T \vec{v_2}) = \lambda_2 (\vec{v_1} \cdot \vec{v_2}).$$
I don't understand why $\vec{v_1}^T \vec{v_2} = \vec{v_1} \cdot \vec{v_2}$.
Answer: Let $\vec{v_1} = \begin{bmatrix}\ a_1\\ \vdots\\ a_n\end{bmatrix}$ and $\vec{v_2} = \begin{bmatrix}\ b_1\\ \vdots\\ b_n\end{bmatrix}$, then
$$\vec{v_1}^T\vec{v_2} = [a_1\ \dots\ a_n]\begin{bmatrix}\ b_1\\ \vdots\\ b_n\end{bmatrix} = a_1b_1 + \dots + a_nb_n = \vec{v_1}\cdot\vec{v_2}.$$


D3.js zoom with nested svg breaks viewport in Internet Explorer

Question: I am using d3.js to dynamically set up a nested svg, i.e. an inner svg nested inside an enclosing svg. A d3.behavior.zoom() listens for zoom events on the outer svg and does the transformations needed.
All works fine except for the Internet Explorer (IE 11) which seems to have an issue with transformations involving inner svgs. Both Firefox and Chrome behave as expected clipping the inner svg to the viewport of the outer svg. In Internet Explorer, however, zooming in correctly applies transformations but seems to ignore the dimensions of the enclosing svg. The contents of the inner svg will eventually be displayed outside of the outer svg and above other body elements. The viewport of the outer svg seems to have no clipping effect on the inner svg.
I have set up a JSFiddle demonstrating the behaviour.
var zoom = d3.behavior.zoom()
    .on("zoom", function () {
        container.attr("transform",
            "translate(" + d3.event.translate + ") " +
            "scale(" + d3.event.scale + ")");
    });

var container = d3.select("body")
                    .append("svg")
                      .attr("id", "svgcontainer")
                      .attr("width", 300)
                      .attr("height", 300)
                      .style("background-color", "#aaaaee")
                      .call(zoom)
                    .append("g");

var svg = container.append("svg")
                     .attr("width", 200)
                     .attr("height", 200)
                     .attr("x", 50)
                     .attr("y", 50);

svg.append("svg:circle")
     .style("fill", "none")
     .style("stroke", "red")
     .style("stroke-width", "2px")
     .attr("cx", 100)
     .attr("cy", 100)
     .attr("r", 50);

Am I missing something? Is there any cross-browser workaround?
Answer: I'm sorry this question didn't get enough attention when you first posted it: it's actually a simple fix.  Just set the overflow property on the outer SVG to hidden.
So why does your code work as you intend on the other browsers?
It's because they set this property by default.  The initial value for overflow in CSS is visible, but the SVG specs require that any element that can take a viewBox attribute has overflow:hidden in the browser's default stylesheet, except for the root SVG element.  The other browsers interpret this exception as if it only applied to an <svg> element that is the root of an .svg document.  Internet Explorer also applies treats the top-level inline SVG in an HTML document as if was a root (and therefore had overflow: visible).
The following snippet demonstrates the different behaviors.  It uses a circle inside a nested SVG inside an inline SVG.  The circle is too big for the nested SVG, so if overflow is hidden on the nested SVG (as it is by default in all browsers) the circle will be cropped to a square.  The nested SVG is offset, partly outside the outer SVG.  If overflow is hidden on the outer SVG, the nested SVG will be cropped to a rectangle; if overflow is visible you'll see the square sticking outside of the frame.
The first SVG uses default overflow on the outer SVG (different for IE) while the others explicitly set overflow: hidden or overflow: visible.

svg {
    border: solid gray;
    height: 100px;
    width: 100px;
    margin: 50px;
}
circle {
    fill: royalBlue;
}
<svg>
    <svg x="-50" y="-50" width="100" height="100" >
        <circle r="100" cx="50" cy="50"/>
    </svg>
</svg>
<svg style="overflow: hidden">
    <svg x="-50" y="-50" width="100" height="100" >
        <circle r="100" cx="50" cy="50"/>
    </svg>
</svg>
<svg style="overflow: visible">
    <svg x="-50" y="-50" width="100" height="100" >
        <circle r="100" cx="50" cy="50"/>
    </svg>
</svg>

The overflow behavior should probably be clarified for SVG 2 or in the SVG integration spec.  There is also a discrepancy between Firefox and Blink/Webkit browsers regarding whether or not padding on an inline SVG is considered "overflow" or not.
Comment: I just checked the SVG WG email/meeting minutes archive.  There were commitments made to clean up `overflow` definitions [at the last major meeting](http://www.w3.org/2015/02/12-svg-minutes.html#action14) although it has not been reflected in the draft specs yet.  The IE behavior (inline SVG are `overflow:visible`) has been chosen as the preferred behavior.
Comment: That does the trick! Thank you very much for your explanation. Having read the spec, IE seems to be the only browser to comply to it on this issue. Do you agree?
Comment: Honestly, having read the spec as it is currently written, I would agree with the other browsers, since the spec says "root" element and an inline `` isn't the root of it's document (the `` element is).  However, it really comes down to the fact that the SVG spec wasn't written with inline SVG in mind, so that case wasn't considered.


Random range without duplicates in PHP

Question: I have 60 images but I want to randomly show 20 from 1 to 60.
My code is something like this, it shows 60
<?php
  for( $i = 1; $i < 61; $i++ )
    {
       print '';
    }
?>

I found PHP function RAND(), but unable to implement, any help would be appreciated.
Comment: possible duplicate of [php select X items from set?](http://stackoverflow.com/questions/4495963/php-select-x-items-from-set)
Answer: Try functions range() and array_rand():
<?php
// range generates array with direct sequence from 1 to 60 (inclusive).
// array_rand extracts 20 random keys from it.
$range = array_rand(range(1, 60), 20);

while(count($range)){
    $i = array_shift($range) + 1;

    print '';
}
?>

UPDv1: With for-loop:
<?php
$range = array_rand(range(1, 60), 20);

for($i = 0; $i < 20; $i++){
    $image = $range[$i] + 1;

    print '';
}

unset($range, $i, $image);
?>

UPDv2:
I've misread array_rand()s manual. It returns array keys instead of elements.
Here is multipurpose version (fix with array_flip()):
<?php
header('Content-Type: text/plain');

$buffer = range(1, 60);
$buffer = array_flip($buffer);
$buffer = array_rand($buffer, 20);

foreach($buffer as $value){
    echo $value, PHP_EOL;
}
?>

And a shortcut function (negatives safe, and overall count safe):
<?php
header('Content-Type: text/plain');

function random_range($min, $max, $count){
    $count = abs((int)$count);

    if($min > $max){
        list($min, $max) = array($max, $min);
    }

    $uniques = abs($max - $min);

    if($count > $uniques)$count = $uniques;

    return array_rand(array_flip(range($min, $max)), $count);
}

foreach(random_range(1, 60, 20) as $value){
    echo $value, PHP_EOL;
}
?>

There is another way for those, who needs non-growing random sequence. Use this:
<?php
header('Content-Type: text/plain');

function random_range($min, $max, $count){
    $count = abs((int)$count);

    if($min > $max){
        list($min, $max) = array($max, $min);
    }

    $uniques = abs($max - $min);

    if($count > $uniques)$count = $uniques;

    $result = array();
    $ready  = 0;

    while($ready < $count){
        $buffer = rand($min, $max);

        if(!in_array($buffer, $result)){
            $result[] = $buffer;
            $ready++;
        }
    }

    return $result;
}

foreach(random_range(1, 60, 20) as $value){
    echo $value, PHP_EOL;
}
?>

UPDv3:
Another way, used range() + shuffle() + array_slice():
<?php
header('Content-Type: text/plain');

function random_range($min, $max, $count){
    $count = abs((int)$count);

    if($min > $max){
        list($min, $max) = array($max, $min);
    }

    $uniques = abs($max - $min);

    if($count > $uniques)$count = $uniques;

    $result = range($min, $max);
    shuffle($result);

    return array_slice($result, 0, $count);
}

foreach(random_range(5, 20, 5) as $random){
    echo $random, ' ';
}
?>

Comment: `foreach (array_rand(range(1, 60), 20) as $image) ...` anyone?
Comment: A decent efficient answer. ^^
Comment: I'd loop over the values with a regular loop instead of a `while..count..array_shift`...
Comment: @deceze I'll fix... It makes sense.
Comment: The first one no.. The update, well, that just selects the first 20 images. lol. =P EDIT he fixed the update and the second part now ^^
Comment: No problem - easy mistake to make when trying to put in a different loop than you had been working with, while keeping the same printing line. =]
Comment: @deceze yeah... But it's difficult to understand, explain and show.
Comment: @CORRUPT Well, you don't have to smush it together like that, but `foreach` is a lot easier than `for`.
Comment: @deceze yes. But OP by whatever reason used `for`-loop. I think it's more legitime and obvious for OP. I also marked your comment as useful. With respect.
Comment: @CORRUPT Just because the OP does something doesn't mean that's what he wants. ;-)

Random range without duplicates in PHP


A basic doubt on open set

Question: I see in a book the following is claimed : If $E$ is an uncountable subset of $\Bbb R^n$ and then $S \cap E$ is open where $S$ is open. Why ? The intercept from the book is as follows :
$E$ is an uncountable subset of $\Bbb R^n$. Let $P$ be the set of all condensation points of $E$ (points every neighbourhood of which contains uncountably many elements from $E$). Take $p \in P$. suppose $p$ is not a limit point point $P$. Then there exists a neighbourhood $N_r(p)$ which will contain atmost one element namely $p$ of $P$. Then it is claimed that $N_r(p)^* \cap E$ is open. $N_r(p)^*= N_r(p)-\{p\}$
Answer: Not true - take $S$ to be an open interval and $E$ to be the irrationals.
Comment: Carpetis : Plz see the intercept from the book.
Comment: @Prasenjit: I don't follow the argument - is there more context? Is this part of a proof by contradiction? I'm pretty sure the set of condensation points has no isolated points, so such a $p$ cannot exist.
Comment: yes, this is a proof by contradiction
Answer: $N_r(p)^*\cap E$ is open in the relative (or subspace) topology that $E$ inherits from $\Bbb R^n$, but it is not necessarily open in $\Bbb R^n$ itself; if the book makes that claim, it's simply wrong. The proof that $p$ is a limit point of $P$ should continue as follows.
Let $\mathscr{B}=\{B_n:n\in\Bbb N\}$ be a countable base for $\Bbb R^n$. (I'm assuming that at this point you've already proved that $\Bbb R^n$ has a countable base for its topology.) Let $x\in N_r(p)^*$; then $x\notin P$, so $x$ has an open nbhd $U_x$ such that $U_x\cap E$ is countable. $N_r(p)^*$ is open, so there is an $n(x)\in\Bbb N$ such that $x\in B_{n(x)}\subseteq U_x\cap N_r(p)^*$; clearly $B_{n(x)}\cap E$ is countable.
Next, observe that
$$N_r(p)^*=\bigcup_{x\in N_r(p)^*}B_{n(x)}\;,$$
and hence
$$N_r(p)^*\cap E=\bigcup_{x\in N_r(p)^*}(B_{n(x)}\cap E)\;,\tag{1}$$
$\mathscr{B}$ is countable, so there are only countably many distinct sets $B_{n(x)}$ appearing in the union in $(1)$. The righthand side is therefore the union of countably many countable sets and is therefore itself countable. But then $N_r(p)^*\cap E$ is countable, and hence so is $N_r(p)\cap E$, contradicting the assumption that $p\in P$.

A basic doubt on open set


Recipient View - ID Check Authentication disable

Question: I have been facing this issue in production API, when the user receives the document to sign and when he opens the link it redirects to ID Check.
Please refer the attached screenshot.
In my C# I haven't enabled any authentication method.
<code>Signer signer = new Signer();
signer.Email = recipientEmail;
signer.Name = recipientName;
signer.RecipientId = "1";
signer.RoutingOrder = "1";

signer.Tabs = new Tabs();
signer.Tabs.SignHereTabs = new List<SignHere>();
SignHere signHere = new SignHere();
signHere.DocumentId = "1";
signHere.PageNumber = "1";
signHere.RecipientId = "1";
signHere.XPosition = "110";
signHere.YPosition = "665";
signer.Tabs.SignHereTabs.Add(signHere);

envDef.Recipients = new Recipients();
envDef.Recipients.Signers = new List<Signer>();
envDef.Recipients.Signers.Add(signer);

envDef.Status = "sent";

EnvelopesApi envelopesApi = new EnvelopesApi();

EnvelopeSummary envelopeSummary=envelopesApi.CreateEnvelope(accountId, envDef);
</code>
This is all of my code. Please assist
ID Check screen
Answer: You probably have Authentication Settings turned on at an account level. These settings will apply to all the envelopes sent from the account by Default. You will have change it to a different option incase you do not want to enforce it by default for every envelope.
You can view your existing accountSettings using the listSettings api. Look for the idCheckRequired setting. You can find the definition of these settings here

Changing your account Settings
See the following admin guides to change your Account settings through the Docusign admin console.

New Docusign Sending Experience (Documentation here)

Classic Docusign Sending Experience (Documentation here)

Note: You should have account Admin privileges to modify the Account settings.
Comment: Yes that was the issue. Authentication settings were turned on from account level. Contacted docusign customer support and sorted this out. Since I have purchased the basic API plan, Authentication settings were not visible to me at the account level and only docusign support could disable it. Thank you very much!
Comment: I have the intermediate plan and I've disabled this but it's still showing up for me every time. Not sure why I can't disable it.
Comment: I have the same issue; disabled it entirely on the account (Starter), but still get ID verification screen when you try to sign. Opening a support ticket with DocuSign.
Comment: Have you solved this problem? I have faced with this problem as well.


How close multiple holes can be drill in top double plate?

Question: Have to drill multiple holes in top plate for wiring. how close can be drilled
have total 4 14/2 wires to be run through hole.
hole size- 5/8  to 3/4.
thanks
Comment: Wait top double plate of what?  In a panel you may want to avoid that area as it could contain the main breaker.
Answer: This is not critical. You need 2 holes. If you have the space: 3 inches apart. Feed 2 wires per hole. Keep holes 1.25in from edge of plate.


Django: Check at model level if anything in ManyToMany field before saving

Question: There's a lot of questions worded similarly, but every single one I've seen is somebody trying to get some kind of data through a ManyToMany relationship before saving it. I'm not trying to use the relationship at all before saving, I just want to see if the user put anything there or not.
My model has a ForeignKey field pointing to a parent model, and two ManyToMany fields pointing to other models, but I only want users to be able to use one M2M field or the other, not both. This model is being edited through the admin as an inline on its parent.
models.py
class ProductSpecial(models.Model):
    # name, slug, image, etc

class ProductSpecialAmount(models.Model):
    special = models.ForeignKey(ProductSpecial, related_name='amounts', on_delete=models.CASCADE)
    amount = models.IntegerField()
    brands = models.ManyToManyField(ProductBrand, related_name='specials', blank=True)
    lines = models.ManyToManyField(ProductLine, related_name='specials', blank=True)

admin.py
class ProductSpecialAmountInline(admin.StackedInline):
    model = ProductSpecialAmount
    # fieldsets, etc

@admin.register(ProductSpecial)
class ProductSpecialAdmin(admin.ModelAdmin):
    inlines = [ProductSpecialAmountInline]
    # fieldsets, etc

I only want users to be able to choose from brands or lines, but not both, and I would like to validate this before save and throw a validation error if necessary. My initial attempt was to just do...
class ProductSpecialAmount(models.Model):
    # ...
    def clean(self):
        if self.brands and self.lines:
            raise ValidationError('Please choose either brands or lines, not both', code='invalid')

...but that throws ValueError: "<ProductSpecialAmount: ProductSpecialAmount object (None)>" needs to have a value for field "id" before this many-to-many relationship can be used.
I get that I can't actually query the related ProductBrand or ProductModel objects before this object is saved, but I don't actually want any data from those objects right now, I just want to know if the user left either of the fields blank or not, and am wondering if that's possible to see at the model level.
Answer: Whether you actually want to use the data from a field or just see if it is blank, the problem is caused by referencing the m2m field in any way before saving the object. I had a similar problem which I fixed using a custom form as per: https://stackoverflow.com/a/7986937/19837155
This might be more difficult when you're using inlines, but it may be the easiest way to solve your problem.


Eclipse not having run as java applet application

Question: I setup my eclipse for PROCESSING perfectely..
I am using Eclipse Oxygen and installed PROCESSING 3.3.6
i am trying to run processing program in eclipse and there is no option is run as Applet
My code is below :
package processing01;
    import processing.core.PApplet;

    public class Processing01 extends PApplet{

    public static void main(String[] args) {

    PApplet.main("Processing01");
    }
    public void settings(){
        size(300,300);
    }

    public void setup(){
        fill(120,50,240);
    }

    public void draw(){
        ellipse(width/2,height/2,second(),second());
    }

    }

Comment: don't you see any option called "run as application" or something similar ?
Comment: yes only run as java application
Answer: Processing 3 no longer supports running as an applet. From the Processing 3 change list:

Applet is gone — Java's java.awt.Applet is no longer the base class used by PApplet, so any sketches that make use of Applet-specific methods (or assume that a PApplet is a Java AWT Component object) will need to be rewritten.

The PApplet class no longer extends the Applet class, which means you can't treat Processing sketches as a component anymore, and you can't run them as an applet. You can only run them as an application.
Applets are dead, and shouldn't be used anyway.
Answer: Because having package the code would be
                   //replace
      PApplet.main("Processing01");
                   //with
      PApplet.main("processing01.Processing01");


GraphDB won't use all available memory

Question: I'm running a "big" SAPRQL INSERT WHERE on GraphDB and it doesn't seem to be using all of available physical RAM.
I'm using a 64GB, 4-core CentOS 6.9 server
-bash-4.1$ free -m
             total       used       free     shared    buffers     cached
Mem:         64428      21897      42530          0        107       2877
-/+ buffers/cache:      18912      45515
Swap:         8095          0       8095

I started GraphDB 8.3.0 like this:
graphdb -Xms50g -Xmx50g -d

It's a non-inference repo, if that makes any difference
Here's what the sysinfo page says
application info:
OS: Linux 2.6.32-696.6.3.el6.x86_64
Java: Oracle Corporation 1.8.0_144
Memory used: 5554 MB
Max memory: 50977 MB

JVM arguments
-Xms1g
-Djava.awt.headless=true
-Dfile.encoding=UTF-8
-Djava.net.preferIPv4Stack=true
-XX:+UseParallelGC
-XX:-OmitStackTraceInFastThrow
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/usr/local/graphdb/heapdump.hprof
-XX:OnOutOfMemoryError=kill -9 %p
-Dgraphdb.dist=/usr/local/graphdb
-Xms50g
-Xmx50g

top output:
top - 13:32:23 up 22:37,  1 user,  load average: 1.00, 0.96, 0.76
Tasks: 153 total,   1 running, 152 sleeping,   0 stopped,   0 zombie
Cpu(s): 25.1%us,  0.2%sy,  0.0%ni, 74.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  65974292k total, 22390544k used, 43583748k free,   109900k buffers
Swap:  8290300k total,        0k used,  8290300k free,  2915740k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 4071 sprqlusr  20   0 56.2g  17g  22m S 101.0 28.4  16:53.29 /usr/local/java/bin/java -Xms1g -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -XX:+UseParallelGC -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpO

And here's a screenshot of the memory utilzation page
Comment: Is there a reason you are forcing the JVM to use 50g heap size instead of letting it allocate available memory as needed? I am not saying what you are doing is wrong, just asking. What happens to the memory profile if you just run `graphdb -d`?
Comment: @Nathan ... good question.  next time I take the db offline I'll try that.  I guess it was a sloppy attempt to see IF GraphDB can use all of the allocated RAM.  I've never seen the graphdb process use more than ~30% of the RAM, so it's been bothering me, and I thought this stuck query would be a good case.
Answer: By default, GraphDB will allocate 50% of the available heap for its global page cache, the structure responsible for caching all disk pages and minimizing the I/O time. The value is controlled in conf/graphdb.properties by a line starting with graphdb.page.cache.size. In your scenario, the global cache is set by default to 25GB.
As a rule of thumb, you can calculate that a repository with 1 billion RDF statements will take around 100GB disk space if all indexes are switched on. From the heap memory usage diagram, it looks like that your dataset is just not big enough to fill the cache size.
For setups using fast SSD disks, it makes very little difference to allocate more cache size bigger than 15-30% of the total repository size. Setting a bigger heap size may even hurt the repo's performance because of the longer GC cycles. I highly encourage you to limit your maximum heap size to less than 32GB to benefit from the -XX:+UseCompressedOops, which should be nearly equivalent to the 50GB heap size without the pointer compression. This behavior is consistent with other Java applications managing big heaps sizes.
Comment: I downloaded the dist package (*.zip) and the file is located inside at `/conf` - not sure how this works for `deb`, `rpm` etc
Comment: @MarkMiller The fastest way to locate GraphDB's /conf path when installed as a native application on the various platforms is to click the GraphDB's icon on the task bar and press "Show logs directory". Then browser one directory up.
Comment: Thanks. Just getting around to working through your suggestions. **I don't see a graphdb.properties file in either of my systems**: Windows 10, GraphDB 8.4.1 from easy installer (I searched the whole disk) OR CentOS 6.9, GraphDB 8.3.0, standalone server (I searched my "data" folder that contains subfodlers `refine`, `repoPenaltyBox`, and `repositories`, as well as `/usr/local/graphdb-free-8.3.0/`, which contains `bin`, `conf`, etc.)

GraphDB won't use all available memory


image alignment has when the website is hosted

Question: I have a column where the images are aligned in the center when it is locally seen when I hosted the alignment of the images changed
This is the image when it is locally hosted

and this is the remote host image

This is the code I have tried

Powered By

This is the CSS part of that section
ul.tweet-agile span.fab {
    width: 25px;
    color: pink;
    padding-left: 0;
}
.tweet-agile {
    height: 100px;
    width: 100px;
    margin-bottom: 10px;
    margin-left: 12px;
}
@media (min-width:425px) {
    .tweet-agile {
        margin-left: 63px !important;
    }
}

@media (min-width:375px) and (max-width:425px) {
    .tweet-agile {
        margin-left: 75px !important;
    }
}

Where did I go wrong?
update: it is perfect when I viewed in the desktop all the dimensions as shown below

But when I check in my mobile it is not aligned as shown in image
Comment: Can you share Demo url?
Comment: @vadivela here is the demo url http://test.innovkraft.in/rummyden.com/
Comment: When I check that example URL in Chrome, using the exact same dimensions, it shows exactly like the _first_ image. Your problem does not appear to be reproducible. Sure you're not just getting fooled by the cache? // Check what the browser console has to say anyway, there are several errors in there (JS, 404, 403)
Answer:
Please add these styles under media query, issue is with unwanted margin you were using to style the images to middle.

@media (min-width: 425px){
  .tweet-agile {
    height: 100px;
    width: 100px;
    width: 100%;
    padding: 0;
    margin-left: 0;
   }
  .tweet-agile img {
    margin-left: 0 !important;
   }
}

and remove
@media (min-width:425px) {
    .tweet-agile {
        margin-left: 63px !important;
    }
}

@media (min-width:375px) and (max-width:425px) {
    .tweet-agile {
        margin-left: 75px !important;
    }
}

Comment: I have removed the unwanted code and added your code but it is aligned in the desktop version when I check-in mobile the same issue
Comment: @sanihe Can i checked that online, i am sure you didn't remove under media query
Comment: @sanihe change `@media (max-width: 424px) and (min-width: 375px){.tweet-agile{
            margin-left: 42px;
    }}
` to `@media (max-width: 424px){.tweet-agile{
            margin-left: 42px;
    }}`


How can I remote control react-compound-timer?

Question: I'm working on a kiosk system. I have a nodejs server that is pushing the data to be displayed to a react client using server side events. The react client is only used to display stuff and is not interactive. I am using react-compound-timer for a countdown. I want to set the time, start and pause the timer the client is showing using events generated by the server but I am having trouble finding the right approach to do so.
After some attempts I succeeded in starting and stopping the timer. See function remoteControlTimer. But I am pretty sure that this is not the intended way of doing it since I am also getting a warning:
"Warning: Cannot update during an existing state transition (such as within render). Render methods should be a pure function of props and state."
Also, setting the time has proven to be more difficult. See the comment line in the function remoteControlTimer. In my attempt the time is set, but the times is stuck on the set time and does not count backwards anymore.
I also tried setting a dfferent time in the initialisation block based on what is set in the props, but that does not work, the value is ignored.
function remoteControlTimer(start, stop, data, setTime) {
    // setTime(data.value)
    if (data.state == StopWatchState.PLAY) {
        console.debug('play')
        start()
    } else {
        console.debug('stop')
        stop()
    }
}

function Stopwatch(props) {
    return (
        <Timer
            initialTime={props.data.value}
            direction="backward"
            startImmediately={false}
            timeToUpdate='10' >
            {({start, resume, pause, stop, reset, getTimerState, getTime, setTime}) => (
                <React.Fragment>

                        <Timer.Minutes />:
                        <Timer.Seconds />:
                        <Timer.Milliseconds />

                    {remoteControlTimer(start, stop, props.data, setTime)}
                </React.Fragment>
            )}
        </Timer>
    )
}

As you can guess, I am pretty new to nodejs as well as react. Any help is very much appreciated.
Answer: based on your example and the documentation on react-compound-timer, I believe there are two mistakes that may help you move forward.
The first is the arguments to the function inside the Timer component.  According to the documentation you can see from the Controls example, the props they use are: start, resume, pause, stop, reset, timerState.  Instead of timerState, you have: getTimerState, getTime, and setTime.  I'm not familiar with the timer component you are using, so I could be mistaken.
The second thing I see is the call to remoteControlTimer.  This function doesn't return anything, so there you don't need to put it in curly brackets.  Instead, you can convert the implicit-return arrow function into function-body arrow function, where the first line makes the function call for you and the second would return the JSX you would like to render.
I'm not fully clear on what you're trying to achieve, so this is the best I can do with what you've provided.  Hope this helps!
e.g.
function Stopwatch(props) {
    return (
        <Timer
            initialTime={props.data.value}
            direction="backward"
            startImmediately={false}
            timeToUpdate='10' >
            {({start, resume, pause, stop, reset, timerState}) => {
              remoteControlTimer(start, stop, props.data)
              return (

                        <Timer.Minutes />:
                        <Timer.Seconds />:
                        <Timer.Milliseconds />

            )}}
        </Timer>
    )
}

Comment: Thank you very much for your input. After I posted the question I spend another 6 hours of tinkering before I decided to move away from react-compound-timer. I have now written it myself.
Now i am unsure of what to do with this post and your answer.
Answer: Here is the approch I took, using React Hook.
You can use useRef() to call them on your own functions
example:
import React, { useRef, useEffect, useState } from 'react'
import Timer from "react-compound-timer";

const TestTimer = () => {

  const startTimeFunc = useRef()

  function handleStartTime() {
    startTimeFunc.current.start()
  }

return (<Timer
        initialTime={1500000}
        direction="backward"
        startImmediately={false}
        onStart={() => console.log("call back on start")}
      >
        // assign control to startTimeFunc
        {(control) => {
          startTimeFunc.current = control

          return (
            <React.Fragment>

                  {' Study time: '}
                  <Timer.Minutes /> minutes {' '}
                  <Timer.Seconds /> seconds

                <button className="studyButton" onClick={handleStartTime}>Start studying</button> {' '}

            </React.Fragment>
          )
        }}
        </Timer>
      )}


Trouble justifying why the $S$-matrix of $\mathcal{C}(G,q)$ is $(b(g,h))_{g,h\in G}$

Question: Let $G$ be a finite abelian group and $q: G \to k^\times$ be a quadratic form with $k$ a field of characteristic $0$.
i.e. $(G,q)$ is a pre-metric group.
It is known that such pre-metric groups correspond to braided equivalence classes of pointed braided fusion categories (see e.g. EGNO Tensor Categories, Section 8.4).
Let $\mathcal{C}(G,q)$ denote such a category corresponding to $(G,q)$.
$\mathcal{C}(G,q)$ has a twist $\theta\in \operatorname{Aut}(\operatorname{id}_\mathcal{C})$ defined by $\theta_X = q(g)\operatorname{id}_X$, where $X$ is a simple object belonging to the isomorphism class corresponding $g\in G$.
It is also known that in this setup, $\theta$ is a ribbon structure, i.e.
$$\theta_{X\otimes Y} = (\theta_X\otimes \theta_Y)\circ c_{Y,X}\circ c_{X,Y}.$$
I came across the fact that the $S$-matrix of $\mathcal{C}(G,q)$ is $S_{gh} = (b(g,h))_{g,h\in G}$, where
$$b(g,h) = \frac{q(gh)}{q(g)q(h)}$$
is the symmetric bilinear form associated to $q$.
For example, in EGNO pg. 224, or On Braided Fusion Categories I Exhibit 2.11.5 by Drinfeld, Gelaki, Nikshych, and Ostrik.
Why is this?
The $S$-matrix is defined to be $S = (\operatorname{Tr}(c_{Y,X}c_{X,Y}))_{X,Y\in \mathcal{O}(\mathcal{C})}$ the matrix of traces of doing braidings twice.
Here, $\mathcal{O}(\mathcal{C})$ is the collection of simple objects of $\mathcal{C}$.
Specifically, why is $\operatorname{Tr}(c_{Y,X}c_{X,Y}) = b(g,h)$?
Answer: I made a very silly oversight in the very reference I provided, but I will answer for closure anyway. We know $X \otimes Y \cong Y \otimes X$ is a simple object in this category since they are labelled by the group elements. The fact that the twist satisfies the ribbon condition means that
$$ q(gh) = q(g)q(h) c_{Y,X}c_{X,Y}$$
where we abuse notation and write $c_{X,Y}$ for the scalar in $k^\times$ picked up by applying the (simple object!) endomorphism $c_{X,Y}$. This concludes.


Change Checkbox id in Repeater

Question: i have repeater to retrieve image from data base and i need check box for any image to select and delete from database , how can i get the check box id to tell my button event to delete image from database ?
i need check box id to tell my query delete which image .
my repeater :
<asp:Repeater ID="RepeaterPersonnel" runat="server">
    <ItemTemplate>
         <img src="../Handler/GalleryPhoto.ashx?id=<%# DataBinder.Eval(Container, "DataItem.PhotoId")%>&size=178" alt="" class="img-border" />
        <input type="checkbox" id= '<%# DataBinder.Eval(Container, "DataItem.PhotoId") %>'/>

    </ItemTemplate>
</asp:Repeater>

Or is there any way to delete my image with java script ?
Comment: on asp button on click you can find checked checkboxes inside repeater control using findcontrol , have you tried that ?
Comment: SaB, your question title is "Change Checkbox id in Repeater" but your question actually appears to be about how to delete the image using JavaScript. You should update your title to accurately reflect the question so you don't have an [XY Problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem).
Comment: @mason , my answer reflect the same
Comment: @vishalsharm No, you're manipulating Hidden Fields and your answer assumes a postback.
Comment: @mason  No i want java script as my plane B !! but i prefer use other solution .
Comment: @vishalsharma thank you for tracking , i found some solution to use java script but its Not my favorite .
Answer: You can add a data-id attribute to your checkbox containing the actual id of the photo:
<input type="checkbox" data-id= '<%# DataBinder.Eval(Container, "DataItem.PhotoId") %>'/>

and in your javascript:
function collectPhotos(context) {
    var photos = [];
    context.each(function() {
        photos[photos.length] = $(this).data("id");
    });
    return photos;
}

where context is a selector for your checkboxes and at the end you will get an array containing the IDs.
You post this array to the server and you should call a method, which should execute a delete which has a filter like
where id in (<your comma separated list>)

Naturally, beware sql injections.
EDIT:
As for Mason's suggestion, I add some additional information which might help:

How to remove an item from the DOM:
$(yourSelector).remove();
Display a message:
alert("Checkboxes were removed");
Post the array to the server using AJAX:
$.ajax({
    type: "POST",
    url: yourPage,
    data: {photoIDs: collectPhotos($("#" + parentID + " checkbox"))},
    success: function(response) {
        $(yourSelector).remove();
        alert("Checkboxes were removed");
    }
});

Comment: One final step you might include is removing the image from the DOM and/or displaying a "successful deletion" confirmation message. You might also mention how to post the array to the server, such as using AJAX combined with Web API.
Comment: @mason im not  familiar with Ajax to much.
Comment: @SaB Time to learn, as you'll have a faster, more efficient, and easier to maintain site.
Comment: @mason can you offer me some document ?
Comment: Edited my answer with some details.
Answer:

Id	Image	Delete?

<asp:Repeater ID="RepeaterPersonnel" runat="server">
    <ItemTemplate>
       <tr class="PersonnelRow" data-photoid='<%# (Container.DataItem as WebApplication1.PhotoInfo).PhotoId %>'>

               <%# (Container.DataItem as WebApplication1.PhotoInfo).PhotoId %>

               <img src="../Handler/GalleryPhoto.ashx?id=<%# DataBinder.Eval(Container, "DataItem.PhotoId")%>&size=178" alt="" class="img-border" />

               <input type="checkbox" data-photoid='<%# (Container.DataItem as WebApplication1.PhotoInfo).PhotoId %>' class="DeletionCheckbox" />

    </ItemTemplate>
</asp:Repeater>

<button type="button" onclick="ApplyChanges()">Apply Changes</button>

Notice I made a few changes. I moved all of your elements into separate td's, and each repeated item now gets its own tr. I also added a td for showing the photo ID, and sprinkled in the strongly typed photo id using data- attributes. Since it's now strongly typed and not relying on DataBinder.Eval(), if you change any of the property names they'll automatically be updated. Less chance of something breaking at runtime. So far, this should all be fairly straight forward. I've also added a button that will call this ApplyChanges() Javascript. Let's look at that...

So first the script gets all the elements with a class of DeletionCheckbox (but only if they're checked). It iterates through those elements using the jQuery .each() function. We then use jQuery AJAX to call out to a Web API (which I'll get to in a moment), and we pass the photoid via query string. When the AJAX call is successful, we then get the element with the class of PersonnelRow where the data-photoid matches the photoid of the deleted element, and we remove that row (and all it's sub elements) from the DOM so it will no longer display. I did it by calling remove, but a snazzy way to do it would be to fade it out, then remove it. And if the AJAX call fails, we display an alert message.
Side note, I'm using the jQuery library in my JavaScript. If you're not familiar with it, it makes JavaScript a lot simpler. We can do what I've done with "plain" JavaScript, but we'd need a lot more code and it'd be harder to read. There are other frameworks out there that would also make them easy, but jQuery is one of the most popular. It's also "blessed" by Microsoft and included in all their default templates. If you've never used it before, you can add it to your site by placing this script tag before the JavaScript that needs it.
Now the only remaining puzzle piece is how do we process that AJAX request on the server? You'll need to add the Web API library to your application. Then you'll need to configure the routing (I won't go into detail here, but that's covered on Microsoft's site.) Then you'd create a new Web API controller class in your application, using the following code:
[RoutePrefix("api/Photos")]
public class PhotosController : ApiController
    {
    [Route("Delete")]
    public void Delete(string photoid)
        {
        //code to delete photo from database
        }
    }

I assume you know how to perform an SQL delete command to drop the photo from your database, so I leave that implementation detail to you. Notice that I used attribute routing so that we can easily know the URL we should specify in our JavaScript AJAX call.
So this seems like a lot (but really, it's fairly easy concepts), but it has a number of advantages over the other solutions here. Most of the other answers (except Lajos') require a postback to the server. That will post your entire form to the server, run through the page lifecycle, and then require that the server send the entire contents for the page back to the client. That's a lot of stuff just to delete a photo or two. That is very slow for the client, since it requires a lot of data to be sent and received from the server. It's also bad for the server, because it has to do a lot of extra processing to handle building up the page. The user will also see the page refresh, which can be disorienting.
My method (and Lajos') makes a very small HTTP delete request to the server, and basically the only thing it's passing in are the the HTTP headers (which contain the photoid in the URL). That's going to be very small, just a few kilobytes. The server doesn't have to do the page life cycle. It simply handles the delete command, and replies with a very small HTTP response that has a status code of 200 OK. Very little bandwidth used, very little server processing time/memory consumed. And the user won't have the page refresh, they'll just see the checked rows disappear (jQuery has a fadeOut() method if you want to make it look even nicer).
Comment: Thank you for complete explain .
i have another problem with java script , i use script to create table row in asp panel , but when i try to hide and visible panel , my row data is gone ; is there any way to solve this problem ?
Comment: @SaB That sounds like a separate issue. You should create a new question, make sure to include relevant code.
Comment: i ask the question how to generate table row with java script and someone help me , but i Bring up my problem and nobody answer me .
Is it necessary to create a new topic ?
Comment: @SaB Yes, you should only have one question per topic.
Comment: http://stackoverflow.com/questions/27362899/create-row-with-java-script-but-its-gone-on-my-asp-panel
Answer: because you want the solution in javascript
add any class for e.g. chkbox in your checkbox element and then on your save button's click
find the checked boxes using following javascript
document.querySelectorAll('.chkbox:checked')

you can then iterate through checkboxes , get and set values in hiddenfields somewhere and then can get on server side

Change Checkbox id in Repeater


Prevent an aws account from going into using on-demand

Question:
   We have a purchased a fleet of reserved instances in our AWS account which we use for out EMR cluster. Multiple developers create EMR clusters pulling reserved instances out of our AWS account and if it goes over the limit it goes into on-demand mode which makes it very expensive. We want to able to prevent this from happening. Anyway we can query our AWS account to make sure that no on-demand instances are being used?
Comment: Note that RIs aren't physical instances. They're a billing discount applied to the use of on-demand Instances in your account. So, a solution that counts running instances (or triggers on a RunInstances API) and compares the count of currently-running instances to your reservation might work.
Answer: There is no way to 'prevent' usage of non-Reserved Instances.
Reserved Instances are a billing discount calculated when charges are applied. There is no facility to 'block' the use of serves that are not covered by Reserved Instance discounts.
There are some Reserved Instance (RI) Reporting capabilities in the Cost and Usage Report that can indicate whether you are taking advantage of all RIs (eg not using them at night).
I recall hearing that Netflix had written a utility to encourage Amazon EMR users to use an existing cluster or to launch a cluster using "unused RIs". The system would launch the clusters on behalf of users, rather than allowing users to directly launch clusters, so there was an opportunity to check utilization or prompt for confirmation before launching the resources. You could write something similar, that checks for existing EC2 usage and launches the cluster on the user's behalf if there is spare RI capacity.


Create Cron Expression using Quartz .NET

Question: Is it possible using the Quartz .NET assembly to generate a cron expression? I saw that the CronScheduleBuilder class has a private member cronExpression which is essentially what I am looking for. Is there any other way to get the cron expression itself?
Answer: Possible using ICronTrigger.CronExpressionString
CronScheduleBuilder csb = CronScheduleBuilder
    .WeeklyOnDayAndHourAndMinute(DayOfWeek.Monday, 12, 0);

ICronTrigger trigger = (ICronTrigger)TriggerBuilder
    .Create()
    .WithSchedule(csb)
    .Build();

string cronExpression = trigger.CronExpressionString;

Answer: Using Ian answer, I have created a small extension method. Hopefully it will be useful for someone else...
public static class QuartzExtensionMethods
{
    public static string ToCronString(this CronScheduleBuilder cronSchedule)
    {
        ICronTrigger trigger = (ICronTrigger)TriggerBuilder
        .Create()
        .WithSchedule(cronSchedule)
        .Build();

        return trigger.CronExpressionString;
    }
}


How to get users' heads around multiple views on the same dataset

Question: Our product enables our (mostly non computer-savvy) users to gather data in a number of ways. They can they set all kinds of automatic behaviour based on this data.
This data is stored in our database and users can create views on this database. They can choose which columns a certain view has and filter the rows.
Lets say our db looks like this:
<code>name | age | gender | occupation
--------------------------------
john | 28  | M      | Cook
mary | 30  | F      | Lawyer
bob  | 70  | M      | Retired
alice| 68  | F      | Teacher
</code>
Now a user could create for instance these views:
<code>- all columns and all rows (the complete db)
- all columns for all males (exclude certains rows)
- name and age for all rows (exclude certain columns)
- name and occupation for all people over 60 whose occupation is not "retired" (exclude some columns and some rows)
</code>
Since all these are views on the same data changing or deleting data in one view also changes the others.
We have a problem where a large subset of users doesn't come to this conclusion on their own without being told or reading it in the manual. They think of the views more like tabs in an excel file. Which can obviously cause large problems.
We dont want to put lots of text in the UI explaining this. But do need our users to understand how this works. Furthermore a small subset of users can't seem to get their heads around this at all. Even after we explain it to them multiple times. Some will even tell us they understand but their behaviour confirms they dont.
Comment: Dove till with pigeon holes or house with many windows metaphor? Cookie jar with two openings? Anything to show them that manipulating the "stuff" through (one of) their view(s) actually changes the contents and would thus also change the data in another of their own views. Show them a video with two views on the data, change some data through one of the views, ask them to predict what they will see through the other view... Congrats when they get it right, gently correction when they don't.
Comment: If that doesn't work, give them their own copies when they start changing stuff. Sort of a "copy on write" feature, making the original data safe and allowing your users to play at will with "their stuff".
Comment: A common strategy is to have buttons at the top of the table that act as 'toggles' to switch between views. This is a common strategy used in applications like the File Explorer in Windows.
Answer: Having had this problem before, the only solution we found to "educate" our user base (mostly non-technical, 40+ users) was to soft delete the rows then add a global filter to "show recently deleted" items in a special color.
So, for example: Jim would delete contact Rebecca from the global list.  He'd then go to his "contact list" view and be like "where's Rebecca?"  With soft deletes and the "show recently deleted" filter on, he'd immediately see that Rebecca highlighted in a subtle red was recently deleted and be like "oh, ok", I get it.  (We later added an option for "permenant delete" and "undelete".)
Our support calls dropped 90% on this after implementing soft delete.
Answer: To summarize, you have users who don't understand that the copy of data they are viewing is not a personal copy, but rather it belongs to everyone?  If that is your problem, you need to add some constraints to your application restricting who can change or delete data.  If that is not possible, then you need to provide an intermediate confirmation step to inform the users of the potential impacts of their changes.  A system of change control and notifications about changes will also ensure that users understand the structure of the system.
Comment: Not nessesarily between multiple users. Even if there is one user they can still create multiple views into the same table (very much like sql views). Often they create a view "people i should still contact about their registration". And then delete people after they have had contact. But this doesnt delete the person from that view but from the entire database.

We have a system in place so users without the required permissions cant edit or delete the data. This mistake is still being made by people with the required permissions.
Comment: We also give a warning when people do something like this but users tend not to read warnings. Especially if they are somewhat long.
Comment: You could also try changing the warning to require some thought. For example, "Delete this data globally by typing the name of the person you are deleting and click OK."
Comment: If your users can create a view "people I should still contact about their registration", then why would there be a delete action on that view at all? Shouldn't there rather be an action like "hide from view because it doesn't apply to this person" or "set as already contacted". It seems that a general delete action is not appropriate for what the users want to express or annotate. But as you give it to them and as there is only this action available that seems to fit the bill, they use it. It might be necessary to look at what the required views are and the related user actions.
Answer: I think that in this case you have some work ahead of you. Since you've tried changing user behavior but have been unsuccessful you might consider changing the application behavior.
If making these views is a common use case and data being deleted is happening often then here are some suggestions :

Divide administrative privileges even further to percent deletion by users that might not understand the mechanic. Basically, create a role specifically for deletions and only sign it to some. Modification might not be as troublesome so you can assign it to more people.
Go with the flow of user behavior and make these views private to the user so they can edit/delete them without affecting the base data. You can offer a "refresh" option to let users recreate the same view with fresh data. This is harder than 1. Then, if necessary, create a special "base data area" where admins can go for the sole purpose of deleting/creating/modifying the base data. This will probably require less training for users that never got the original concept but users that understood originally will have to be retained.
Spend more time to train users that don't understand the concept and add heavy warnings in the application during delete operations or any other destructive operations.
Let users blame each other. Eventually someone will get mad that someone else deleted "their" record. Then they won't do it again. Make sure to log who deletes what when users come asking about their data so you can pass the hook. Haha.

I prefer 2 given time. 3 and 4 with not so much time. 4 is some fun too just to watch users have a go at each other. Haha. :-)
Answer: When the user goes in to edit an entry in a view, I would suggest displaying that entry within the entire database while editing. This way, the user knows that they are somewhere else, editing something that is not particular to the view they used to get there. If not the database, maybe just show that entry with all its details including the ones not found in that particular view. This sends a message to the user that they are now editing the data for that person, not just the text within the view.


Automated testing WITH human factors to collect software metrics?

Question: reaching out to see if any other UXers have experience collecting automated data for software KPIs (did a quick search for related question, and didn't find anything. Apologies if this has been asked before).
Obviously, user testing is the best way to collect feedback on any product (and we do regularly perform user research). However, because of the time and resources involved in true UX testing, we are looking for other ways to validate the UX of our product in a more efficient, expedited way.
We are wanting to automate some task scripts to collect metrics such as success/failure rate, errors/ error messages triggered, time on task, etc. A huge bonus is being able to implement human factors in the script, such as familiarity with the system, age, accessibility variables, etc. (the exact data for these human factors would be based off a large sampling of our user base).
Does anyone have any tools or tests they have used to collect automated UX KPIs? Can anyone think of a way to embed human factors into these tests?
Thanks in advance for any thoughts!
Comment: Are you seeking to automate detection of website features that may violate human psychological or physiological constraints? Or are you seeking to use artificial intelligence to model novice users and evaluate user experience?
Answer: You can embed Google Analytics into your solution. Some of the analytics will allow you to capture a few things related to human factors and the user experience.
However, Google Analytics will not answer any "why" questions (e.g. why did the user do that?) or qualitative questions (e.g. How do you feel about that form?), so Google Analytics should always be coupled with more traditional usability testing techniques to give you a more complete picture of the user experience.
I can understand the pressure to find a automated solution to gathering human factors KPI's, but it is important to communicate to your team that not everything can be determined programatically, especially when your are looking at KPI's related to human beings and their emotional experiences.
Answer: Try using VWO (Visual Website Optimizer) www.vwo.com. You might find what you are looking for.
Also, for a better understanding of things, you can go for a Machine Learning course by nanodegree (Udacity). Machine Learning is in trend these days. I'm sure this doesn't sound easy. But you can give it a try.


Gitlab CI: save command in variable

Question: I need to run big command in several jobs and save results in dynamically created variables.
My idea - save such command as variable and evaluate it in script sections of all jobs.
For example:
<code>.grep_command: &grep_command
  GREP_COMMAND: dotnet ef migrations list | grep "VERY_LONG_PATTERN_HERE"

job1:
  variables:
    <<: *grep_command
  script:
    # some job specific code
    - echo $GREP_COMMAND
    - VAR=$(${GREP_COMMAND}) # doesn't work

job2:
  variables:
    <<: *grep_command
  script:
    # some job specific code
    - echo $GREP_COMMAND
    - echo "VAR=$(${GREP_COMMAND})" > build.env # also doesn't work
</code>
Answer: I found the right way:
define command as script command and use it in script section, not variables:
<code>.grep-command: &grep-command
  - dotnet ef migrations list | grep "VERY_LONG_PATTERN_HERE"

job1:
  script:
    # some job specific code
    - *grep-command
</code>
(By the way saving command as variable also works, just use it carefully, but I suppose it is not so clear - variables must stay variables, and commands - as commands. I find it bad practice to mix them)

Gitlab CI: save command in variable


How find this arithmetic sequence of $n$

Question: if there exist positive integer sequence $a_{1},a_{2},a_{3},\cdots,a_{n}$,such  that
$$a_{1}a_{2},a_{2}a_{3},a_{3}a_{4},\cdots,a_{n-1}a_{n},a_{n}a_{1}$$ is arithmetic sequence,and the common difference $d=a_{i+1}a_{i+2}-a_{i}a_{i+1}\neq 0,i=1,\cdots,n-1.a_{n+1}=a_{1}$
find the value  $n$
I Think this problem is very nice,Thank you everyone.
my idea: first, we have $n\ge 3$,and
when $n=3$,then
$$2a_{2}a_{3}=a_{1}a_{2}+a_{3}a_{1}$$
$$\Longrightarrow \dfrac{2}{a_{1}}=\dfrac{1}{a_{2}}+\dfrac{1}{a_{3}}$$
and
$$\dfrac{2}{5}=\dfrac{1}{3}+\dfrac{1}{15}$$
and when $n=4,5,\cdots,$?
\
\
I think $n=2k-1$ is true,but I can't prove it
Comment: $\frac{2}{5}=\frac{1}{3}+\frac{1}{15}$
Comment: I find this confusing, more with the comments: is it given that $\,a_1=5\,,\,a_2=3\,,\,a_3=15\,$  and because of this you wrote $\,\frac25=\frac13+\frac1{15}\,$ ?
Comment: yes,That's my meaning
Comment: @math110 Please have a look at my most recently edited answer, in which the $n$ even case is shown impossible (same method as before does work for odd $n$).
Answer: If $d=a_{i+1}a_{i+2}-a_{i}a_{i+1}$,
then
$$\sum_{i=1}^{n-1} (a_{i+1}a_{i+2}-a_{i}a_{i+1})
=-a_1a_2+a_na_{n+1}
=-a_1a_2+a_na_1
=a_1(a_n-a_2)
$$
since the sum telescopes.
Also,
$$\sum_{i=1}^{n-1} (a_{i+1}a_{i+2}-a_{i}a_{i+1})
=\sum_{i=1}^{n-1} d
= (n-1)d
$$
Therefore
$(n-1)d = a_1(a_n-a_2)$
or $n = 1+\dfrac{a_1(a_n-a_2)}{d}$.
We now need to determine $a_n$.
Since $d = a_{i+1}a_{i+2}-a_{i}a_{i+1}$,
$a_{i+2}
= a_{i}+\dfrac{d}{a_{i+1}}
$.
So, $a_3=a_1+\dfrac{d}{a_2}$,
$a_4=a_2+\dfrac{d}{a_3}
=a_2+\dfrac{d}{a_1+\dfrac{d}{a_2}}
=a_2+\dfrac{d a_2}{d+a_1 a_2}
$,
$\begin{align}
a_5
&=a_3+\dfrac{d}{a_4}\\
&=a_1+\dfrac{d}{a_2}+\dfrac{d}{a_2+\dfrac{d a_2}{d+a_1 a_2}}\\
&=a_1+\dfrac{d}{a_2}+\dfrac{d(d+a_1 a_2)}{a_2(d+a_1 a_2)+d a_2}\\
&=a_1+\dfrac{d}{a_2}+\dfrac{d(d+a_1 a_2)}{a_2(2d+a_1 a_2)}\\
&=a_1+\dfrac{d(2d+a_1 a_2)+d(d+a_1 a_2)}{a_2(2d+a_1 a_2)}\\
&=a_1+\dfrac{d(3d+2a_1 a_2)}{a_2(2d+a_1 a_2)}\\
\end{align}
$
It's 11pm here, and I am very tired,
so I'll leave it at this
and come back tomorrow to try
to find a general form for
the $a_i$.
If I get that, then I'll put the value
for $a_n$ in the formula for $n$.
Or maybe someone else will do it.
Good night until tomorrow.
Comment: oh,It's good job.+1,Thank you very much, HaHa, in china, Now It's 14:00 am
Comment: I deal with this $d=1$, we have $a_{n}=2\cos{\dfrac{\pi}{2n+1}}$
Comment: can see:http://www.cip.ifi.lmu.de/~grinberg/ComplexCos.pdf
Comment: @math110 With $a_n$ as in your comment, we do not have integers for the $a_n$. Also your $d$ value of $1$ doesn't work since $a_2a_3-a_1a_2=1.29754$. Not only that, it is not an arithmetic progression even with this other $d$, since $a_3a_4-a_2a_3=0.470939.$
Answer: This can be done for any odd $n$. Take $d=n!$ and define $a_1=1\cdot 3 \cdot 5 \cdots$ and $a_2=2 \cdot 4 \cdot 6 \cdots$, in both cases progressing through the odd or even integers up to $n$ until they run out. The sequence of products will be the arithmetic sequence $d,2d,3d,...,nd$ where $nd=n\cdot n!$ The values of the $a_k$ are then determined by the requirement that this be the sequence of products of the adjacent $a_k.$
For example if $n=5$ we put $a_1=1\cdot 3 \cdot 5=15$ and $a_2=2 \cdot 4=8$, obtaining for the sequence of five $a$ values
$$15,\ 8,\ 30,\ 12,\ 40$$
Note that for $n=6$ if we put $a_1=1 \cdot 3 \cdot 5=15$ and $a_2=2 \cdot 4 \cdot 6=48,$ the $a$ are
$$15,\ 48,\ 30,\ 72,\ 40,\ 90,\ 48,$$
but if as required in the OP we use $a_7=a_1=15$ then
$$a_7a_6-a_6a_5=15\cdot 48 - 48 \cdot 90=-3600.$$
It would come out $720$ had we used the
value $105=3\cdot 5 \cdot 7$ for $a_7$, which is closely related to $a_1$, and I believe in the even case if one uses $a_{n+1}=(n+1)a_1$ in the $n$ even case we have a solution to a slightly altered problem than asked by math110.
The relations to compute the $a_k$ come from the requirement that the sequence of products be a progression as stated with common difference $d=n!$. We have in general
$$\frac{a_k}{a_{k-2}}=\frac{k-1}{k-2}.$$
This gives each $a_k$ from the one two index values before, and also explains why they all remain integers, since e.g. for the odd indices $a_1$ starts out with the full sequence of odd factors it needs in order not to give a noninteger for $a_3,a_5,\cdots.$
Impossibility for even $n$ (with $d \neq 0$ as stated in OP).
First assume that $d>0$.
Since the $a_k>0$ we have from $a_{k+1}a_k-a_ka_{k-1}=0$ that $a_{k+1}>a_{k-1}$. Therefore
$a_1<a_3<\cdots a_{n-1},$ so that
$$a_1<a_{n-1}. \tag{1}$$ But then also from
$$a_{n+1}a_{n}-a_na_{n-1}=d$$ from which $a_{n+1}>a_{n-1}$ which contradicts $(1)$.
and since $a_1=a_{n+1}$ this means $a_1>a_{n-1}.$
If instead $d<0$ we can proceed in the same way, with inequalities reversed, and arrive at a similar contradiction.
Note on why it works for $n$ odd: In this case $a_1=1\cdot 3 \cdots n$ with $(n+1)/2$ odd factors, while $a_2=2 \cdot 4 \cdots (n-1)$ with $(n-1)/2$ even factors. In computing $a_{n+1}$ via the recursion, since $n+1$ is even we begin with $a_2$ and apply the recursion $a_{k+2}=a_k \cdot \frac{k+1}{k}$ a total of $(n-1)/2$ times. This gives
$$a_{n+1}=2\cdot 4 \cdots (n-1)\cdot \frac32 \frac54 \cdots \frac{n}{n-1},$$
i.e. $a_{n+1}=3 \cdot 5 \cdots n$, which happens to equal $a_1$ as desired since the first factor of $a_n$ is $1$ and the rest are $3,5,...,n$.
Comment: Note to anyone who read this already: My construction originally given does not work for $n$ even. (I'll try for that.) I have now altered the answer reflecting this, showing for $n=6$ what goes wrong.
Comment: I have now added a proof that there are no solutions for $n$ even with $d \neq 0$ as OP requires. [allowing $d=0$ lets in constant sequences.]


How can I exclude scores that equal 0 in a Solr function query and maintain the actual score?

Question: My goal is to round score to group similar items and then sort by another field (let's use price as an example).
I'm able to accomplish this with the following query:
/select?defType=func&q=rint(product(query({!v=the search term}),100))&fl=score,price&sort=score%20desc,price
However, this query returns every document indexed in Solr.
How can I filter this query so that items with a score of 0 are excluded?
I've tried adding {!frange l=1} to the query which kind of worked...  but it made all of the scores equal to 1.   This obviously isn't good because I need to show the most relevant results first.
Thanks in advance for any help.
Alex
Answer: I spent hours trying to filter out values with a relevance score of 0. I couldn't find any straight forward way to do this. I ended up accomplishing this with a workaround that assigns the query function to a local param. I call this local param in both the query ("q=") and the filter query ("fq=").
Example
Let's say you have a query like:
q={!func}sum(*your arguments*)

First, make the function component its own parameter:
q={!func}$localParam
&localParam={!func}sum(*your arguments*)

Now to only return results with scores between 1 and 10 simply add a filter query on that localParam:
q={!func}$localParam
&localParam={!func}sum(*your arguments*)
&fq={!frange l=1 u=10 inclusive=true}$localParam


Oven burner not lighting normally - strange behavior

Question: I have a 15 year old Capital Performance Series gas range, model number PSGR304. This is a cheap relative of a commercial-style DCS range without any electronic controls, timers, etc.
Lately it has been behaving strangely so I took off the covers to investigate and here is what I found after repeated tests:

When turned on from room temperature with the thermostat set at about 350 it takes the ignitor about 12-14 seconds to begin glowing
The ignitor looks fully bright by 22 seconds (total time)
The burner lights fully at about the 1:24 mark (normal flame)

At 2:14 the burner goes off but the ignitor remains bright

There is a faint smell of gas
After waiting for the 5 minute mark to ensure that nothing happens spontaneously, a finger inserted in front of the gas jet (through the burner air intake) senses a very light cool flow of gas but not nearly enough to light
If said finger is used to briefly tap/bloc the orifice there is a little "whoosh" and the burner ignites but the flame is not at its normal intensity

The oven takes about 40 minutes to reach 350
The thermostat clicks off, the flame goes out, the ignitor stops glowing
Keeping the door open causes the thermostat to click on and heat the ignitor
The gas comes on by itself but the flame is still at the strange low level

Nothing I found online so far addresses this combination of issues, everything assumes a binary failure (shorted safety valve, bad ignitor etc). In my case, the sequence of events seems to rule out a complete failure of all three active components (ignitor, thermostat, safety valve) as well as a blocked orifice or burner holes.
Can anyone please suggest a way to identify the root cause of all this? Thanks!
Comment: **First** thing I'd do is stop turning on the gas and letting it run for 5 minutes _without_ a flame!! That's a great way to fill your house with gas then blow it up. Your neighbors will NOT be amused!
Comment: LOL. The gas was barely bleeding, nowhere near LEL, and I was standing there with an exterior door open right next to the stove. But you are correct that it could be a dangerous situation and extreme caution is advisable.
Answer: Could be a cracked ignitor element, letting through enough current to open the gas valve until it gets even hotter, then the crack widens and the gas valve closes.
Could be a faulty valve, and the valve throat is blocked by debris or broken part (as opposed to valve coil is broken).
You can distinguish between those cases by reading the voltage across the valve terminals while the oven tries to start. A steady rise in voltage with no spikes or dropouts means the ignitor is OK.
Sometimes you can detect a cracked ignitor element by direct inspection -- it will have an obvious hot spot, which often looks like the element is burning.
If you can't see the ignitor or measure the voltage, you could try replacing the ignitor. It's the cheapest part, and any replacement is cheaper than calling a licensed repairman.
Comment: Yep. I had exactly the problem in the first sentence (gradually worsened.) The controls shut off the gas if not enough current flows in the igniter.
Comment: Sorry, got distracted by other things so did not respond to your answer earlier but, dumb question, given that the burner comes on full for a brief period how likely is it that there could be a blockage in the safety valve? And if not so much, what could be causing a constant steady low flow of gas sufficient to cycle the burner on/off via the thermostat? In other words, can the valve actuator be only partially engaged because of the low current draw caused by a faulty actuator?? I thought it was all or nothing?
Answer: While I appreciate the response from A. I. Breveleri, it still left me wondering why exactly the specific behavior I described was happening. I therefore kept digging on the internets until I finally got past all the how-to-fix-it advice to a plausible explanation of how-it-works (and why it doesn't when it doesn't).
The key misconceptions I had were [a] when conductors are heated their resistance to electric current flow increases (this is true for cables and transmission lines) and [b] there are electronic parts involved in opening the gas valve which means that it's either open or not.
First, the ignitor. It typically (but not exclusively) uses silicon carbide [SiC] as a heating element (https://en.wikipedia.org/wiki/Silicon_carbide). This is an exteremly hard and durable ceramic-type material (think harder than exterior grade porcelain tile) about which https://matmatch.com/learn/material/faq-silicon-carbide says "Silicon carbide, in its pure form, behaves as an electrical insulator. However, with the controlled addition of impurities or doping agents, and because SiC has the necessary resistivity, it can express semi-conduction properties [...] electrical ageing, which is the increase in electrical resistivity, could very well affect silicon carbide's electrical conductivity properties. Ageing is said to be related to the oxidation of the material."

So the way the ignitor works is as a variable resistor in series with the main power, thermostat and gas valve. As it heats it simultaneously glows brighter and reduces its resistance to the flow of electric current, thereby pulling that increased current through the gas valve assembly. (https://en.wikipedia.org/wiki/Electrical_resistivity_and_conductivity#Resistivity_and_conductivity_of_various_materials)
Once that flow enters the 3.2 to 3.6 Amp range it is supposed to activate the gas valve. What can go wrong with this arrangement is that, through oxidation ("rusting") or depletion of the additives used to make the SiC conductive (not sure), the conductivity is no nonger as good as it once was and the element no longer draws the required 3.2 Amps. It is not "weakening", it is returning to its "insulator" nature and this also explains why the decay is typically gradual.
Now the gas valve (http://gofarservicesllc.com/xyz_do_it_yourself_guide/oven_stove_range_cooktop_chapter_6 and https://www.appliancerepair.net/gas-oven-repair - neither is likely the original source).

As described in the linked pages, it is a purely mechanical device (electrically assisted but no solenoid/circuit board/etc) in which movement is provided by a bimetal strip. (For anyone who is not familiar with the concept, this is simply a strip of two dissimilar metals permanently bonded/sandwiched together. The metals are selected for their response to heat; both will expand but the rate of expansion of one in response to a given change in temperature is higher than the other, causing the strip to curl away from the side with the greater expansion - they were commonly used in old-style home thermostats with a mercury switch for instance).
To get the strip to curl enough to open the valve, it is heated by a low-resistance coil through which the ignitor ac current is flowing. The amount of heat produced by the coil is dependent on the current flow and it is rigged so that the valve will open at the set 3.2 Amp flow rate. This is such a rugged and low-pressure assembly that it is hard to get a mechanical failure but the coil can burn out. This is why the only thing to really check is that you have continuity through the terminals - if you do it's probably fine.
So now to my situation. The most accurate way to diagnose this is to use a (multi)meter with the capacity to measure in the 10 Amp (ac) range. Remove a clip connector from the terminal on the safety valve closest to you, connect the meter in series between the connector and the terminal and turn on the oven. The current should quickly rise to and remain in the 3.2-3.6 Amp range but in my case it rose slowly and stalled between 3.02/3.03, stubbornly refusing to go higher. Also, as it crossed 2.99 Amps, the gas valve opened and the burner lit but went out when the current stalled.
I still can't quite explain the initial ignition (after repairs I realized it was not actually releasing a full gas flow) but I assume it's some sort of spring/inertia/hysteresis effect where the increase/change in current flow opens the valve but the failure to maintain the increase trips it off(?). Tapping/blocking the jet apparently was just enough to settle the valve at a new equilibrium. Either way, the subsequent partially open behavior is what I would expect for something that is so close to normal operating conditions, just not hot enough to move the strip that last little bit to unblock the valve fully.
Replacement ignitor heated quickly and settled peacefully at 3.48 Amps for a happy ending.
Comment: Perhaps the flow of gas through the valve cools the heater and bimetallic strip.
Comment: @A. I. Breveleri - I did not think of that but it seems like a very plausible explanation to me, particularly since the gas is expanding ever so slightly as it leaves the line, adding to the cooling effect.


How to shield Android 4.0 HOME Key

Question: Does anybody know how to shield the HOME key in Android 4.0?
The code below only works in 2.2 and 2.3, so how would I change this so it can work in 4.0?
<code>/* FIXME:  How does it works within Android 4.0? */
@Override
public void onAttachedToWindow() {
    this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
    super.onAttachedToWindow();
}
</code>
Answer: Try this:
<code>public boolean onKeyDown(int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_HOME)) {
        //do nothing
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
</code>
It's not an edit to your code, but it's an alternative work around for the same purpose.

How to shield Android 4.0 HOME Key


Recommendations for good resources on writing good error messages

Question: Writing good error messages which help users understand how to use the system is difficult.  Often we get bug reports stating "Error message x is confusing" which usually sparks a long debate in the team over how to reword it.
Are there any good resources out there about how to write good error messages.
Im looking for

books
Good blog posts articles
papers
research results

Many design books mention it but only devote a few paragraphs to it.
Comment: Get someone in your organization that didn't develop the software to use (abuse) the software and see what they say.  Also, an error message should tell the user how to fix the problem, not just report a problem.
Answer: Defensive Design for the Web: How to Improve Error Messages, Help, Forms, and Other Crisis Points (2004) by 37signals, while outdated in 2011, does show you various examples of bad error handling, including copy, and explains what's wrong and how to improve. It calls all this "contingency design" (the title of the book is inspired by the concept of defensive driving).  Some of the patterns extracted are still relevant today. Notably Amazon was a leader in this area way back then.
The biggest thing I took away from it when I read it back then was that your site should behave like a salesman in a store: if I'm lost or I can't find an item, the salesman will ask me questions to help me find what I'm looking for whereas most websites will just say "Not found" and that's it. Here's an excerpt from the opening chapter:

This book will show you how to use contingency design to improve your site's usability. You'll learn the following:

What contingency design is and why it's important
40 guidelines that will help you prevent errors and rescue customers when things go wrong
How to make error recovery and prevention part of your long-term design process
How to evaluate your site's contingency design so you can focus on the areas that need help most

Overall the book is useful in designing error handling in your site or app, but there are some good points made specifically about copy as well. From chapter two, "Show the problem: display obvious error messages and alerts":

A good error message lets a customer instantly know:

That an error occurred
What the error is
How to recover

The chapter contains a huge number of examples (from 2003) of sites (many of which no longer exist). Each discussion point includes examples of sites doing things the wrong way and why, and examples of sites doing things well and why.
Comment: Smashing Magazine: [Getting Started With Defensive Web Design](http://uxdesign.smashingmagazine.com/2011/05/27/getting-started-with-defensive-web-design/) cites that book as a resource + [Bulletproof Web Design](http://simplebits.com/publications/bulletproof/), by Dan Cederholm which is about Contingency Design, [3rd edition](http://www.amazon.com/Bulletproof-Web-Design-flexibility-protecting/dp/0321808355/ref=ntt_at_ep_dpt_5) (HTML5 and CSS3) due out end of this year. For further information, this [reviewer](http://www.graphicpush.com/index.php?id=162) rates the second book over the former.
Comment: @Roger Two different (unrelated) kinds of contingency design. Defensive Web Design is about contingency design at a high level; eg. how do you design your app/site to deal with contingencies like "this item is not available". Bulletproof Web Design is about implementation, specifically CSS, and gives you concrete HTML/CSS examples relating to how to design for contingencies like unsupported browsers.
Comment: Will look into this book... How about web sites and or blogs... is there anything out there?
Answer: I was also searching for good resources on writing effective error messages.
The most useful set of resources I've found were from microsoft:

Error Message Guidelines
Error Messages

I've also found that the Microsoft Manual of Style had some interesting parts that could be applied to error messages. It's worth the read if you are interested in creating documentation, but it's a long (and probably boring) read if you are only interested in how to write good error messages.
Since I spend most of my time writing and reviewing error messages, I personally think that a good error message should have 3 parts:

The Problem
The Cause
The Solution

First concentrate on writing these three parts down, and then edit the text to make it smaller and more humane.
I've written a post on how to write error messages, but if you nailed these three parts in your message, you already solved 80% of the problem.


How do I authenticate with the Stack Overflow API

Question: How do I authenticate with Stack Overflow in C# (Windows RT)? I'm not sure how to do this, so any example would be great.
Comment: Yes. I want to make a program for Windows 8 in C # to work with SO
Do not know how to do authentication.
Comment: I can not deal with the API for winRT/C#.
Comment: Is SO StackOverflow site or something else ?
Comment: You question is too broad. Please specify what have you tried so far and what problems or errors are you having.
Comment: Yes. As for C#/WinRT make authorization StackOverflow.
Comment: Found [API](https://github.com/NickLarsen/StacMan) for working with Stack Overflow. I can not understand
Comment: @KovalenkoTaras You will need to ask much more specific question. What don't you understand about the API?
Comment: Which class is responsible for the authorization?
Answer: I think you can use WebAuthenticationBroker to authenticate through OAuth 2. There is a sample here. You might need to get some documentation for the Stack Exchange API from here.
Comment: And there are no ready-made API for working with it?
Comment: I think there isn't much you need after you look at these two links. In fact I will try to do it myself since I was thinking about doing an SO app before.