text:
Q: Is the liar's paradox the principle of explosion in disguise? Sorry for a high-school-level question, but something is bugging me about the liar's paradox.
The liar's paradox can be formally written as an axiomatic system with an axiom $P \equiv \lnot P$. Due to the equivalence, we must have

*

*$P \iff \lnot P$,

*which is the same as $(P \implies \lnot P) \land (\lnot P \implies P)$

*which is the same as $(\lnot P \land \lnot P) \land (P \land P)$

*which is the same as $\lnot P \land P$
And now, due to the principle of explosion, we can prove any statement. In particular, we can prove $P$, and we can prove $\lnot P$.
What I want to say is that, according to my understanding, the liar's paradox is the paradox in exactly the same sense as an axiomatic system with an axiom False (i.e. a trivially contradictory axiomatic system), where for any statement $P'$, we can prove that $P'$ is true and $P'$ is false.
My understanding of the "philosophical" meaning of the liar's paradox is that it shows an example of a statement $P$ that can't be assigned a "True" or "False" value since it would lead to a contradiction. However, as I show above, the contradiction is already there: it has nothing to do with the value of $P$, in exactly the same sense as in the trivially contradictory axiomatic system, a truth value of any new statement $P'$ doesn't affect the contradiction.
So, the only thing that the liar's paradox achieves is a construction of a contradictory axiomatic system. However, this is already achieved in a less obfuscated manner by the trivially contradictory axiomatic system.
Is the above understanding correct? Or did I do something wrong in the above derivation? Or did I misunderstand the motivation behind the paradox?

A: As blargoner says in the comments, thinking about the liar's paradox this way misses the real heart of it. The liar's paradox is about a statement $P$ which itself asserts that $P$ is false; in your rendition the assertion $P \equiv \neg P$ is made "outside of $P$." Said another way, you can introduce the assertion $P \equiv \neg P$ into an arbitrary set of axioms, but in order to state the liar's paradoxical sentence you need a set of axioms which is powerful enough to discuss its own propositions and their truth values.
What the liar's paradox implies in broad strokes is that there is no such set of axioms; in other words, we do not have an unlimited capacity for self-reference in logic. Other results in logic can be thought of as precise versions of this, most famously the incompleteness theorem but also Tarski's undefinability theorem. The Berry paradox is a similar paradox about the limits of self-reference and a personal favorite of mine.
Edit: To say everything a bit more explicitly, motivated by the discussion in the SEP article, one way to somewhat formalize the liar's paradox is that it implies a formal logic cannot simultaneously have all of the following ingredients:

*

*The law of excluded middle; every proposition is either true or false (not neither, not both).

*The ability to refer to its own propositions; if $P$ is a proposition, write $\ulcorner P \urcorner$ for its "name" in the formal logic.

*A truth predicate $\text{true}(\ulcorner P \urcorner)$ which takes as input the name of a proposition and returns as output its truth value.

*The ability for propositions to refer to themselves.

Given all four ingredients we can construct the liar's paradoxical sentence $P$ which asserts $\neg \text{true}(\ulcorner P \urcorner)$ but which cannot be either true or false. So there are (at least) four different ways to resolve the liar's paradox: throw out LEM, throw out the ability to refer to propositions, throw out the truth predicate, or throw out self-reference specifically. (Although, as the SEP article explains, there are variants of the liar's paradox showing that self-reference specifically is not necessary.)
First-order Peano arithmetic satisfies LEM, is capable of referring to its own propositions and is capable of constructing self-referential propositions (via the diagonal lemma); this is used crucially in the proof of the incompleteness theorem, for example. It resolves the liar's paradox by containing no truth predicate (this is Tarski's undefinability theorem).
Other ways of resolving the liar's paradox throw something else out; for example you could try to throw out LEM. See the SEP article, specifically the section on paracomplete and paraconsistent logics for more. It seems that a lot of work here has been motivated by the desire to not throw out the truth predicate:

Working in classical logic, Tarski (1935) famously concluded from the Liar paradox that a language cannot define its own truth predicate. More generally, he took the lesson of the Liar to be that languages cannot express the full range of semantic concepts that describe their own workings. One of the main goals of the non-classical approaches to the Liar we have surveyed here is to avoid this conclusion, which many have seen as far too drastic. However, how successful these approaches have been in this regard remains a highly contentious issue.


text:
Q: Unable to access JSON object outside of AJAX success I am having trouble using a JSON object outside of the AJAX success scope. I need to access the returned JSON object outside the AJAX success scope. I tried initializing a JS var outside the AJAX scope however and the assigning the JSON to it. However, this approach results in a catalog.item is undefined error. I appreciate any suggestions that will help me fix this problem.
This is what I tried:
This approach works perfectly fine (but not what I need):
            $('.catViewButton').click(function(){
                var overlay = jQuery('

');
                overlay.appendTo(".invoice-body");
                $('.catalog-view-wrapper').show();
                $.ajax({
                    url: "ajax/invoice-get-data.php?loadCatalog=1",
                    dataType: "json",
                    success: function(catalog){
                        alert(catalog.item[0].image);
                         $('.catalog-img-container').attr("src", catalog.item[0].image);
                    }
                });

                        ...more code
                        .....
                        .....

This approach is what I need but results in an error:
        var catalog = [];
        $('.catViewButton').click(function(){
            var overlay = jQuery('

');
            overlay.appendTo(".invoice-body");
            $('.catalog-view-wrapper').show();
            $.ajax({
                url: "ajax/invoice-get-data.php?loadCatalog=1",
                dataType: "json",
                success: function(cat){
                    catalog = cat;
                }
            });
            alert(catalog.item[0].image);
            $('.catalog-img-container').attr("src", catalog.item[0].image);
                    ...more code
                    .....
                    .....

Many thanks in advance!

A: You could use the Deferred Object which deals with asynchronous calls for you. Doing so your code will be executed in the reading order, no matter when the response is sent back. You can add as many callback as you need :
jqxhr = $.ajax({
    url: "ajax/invoice-get-data.php?loadCatalog=1",
    dataType: "json"
});
jqxhr.done(function(catalog) {
    alert(catalog.item[0].image);
    $('.catalog-img-container').attr("src", catalog.item[0].image);
});
jqxhr.done(function(catalog) {
    // use catalog again
});

The documentation is full of examples about all of that : http://api.jquery.com/jQuery.ajax/.

A: This is where the a of ajax is really important.  Asynchronous means the alert and the subsequent .attr() lines are running before your success callback is run.  You really should put these lines inside the success callback.

A: Look at deferred obj and .when(). You do not have to put everything in the success callback.
http://api.jquery.com/category/deferred-object/
http://api.jquery.com/jQuery.when/

A: This is how AJAX works. The results returned to the success: function are local to that function.
If you need to access them outside of the success function, one option is to store them in an element - such as a hidden <input> field, like this:
Supposing a hidden input field like this:
<input type="hidden" id="myHiddenField" />

Revised AJAX
$.ajax({
    url: "ajax/invoice-get-data.php?loadCatalog=1",
    dataType: "json",
    success: function(catalog){
        $('#myHiddenField').val(catalog);
        $('#myHiddenField').trigger('blur');
    }
});

Outside the AJAX function:
$('#myHiddenField').blur(function() {
    var cat = $(this).val();
    //now do something with the data in var cat
});

redpajama_set_name: RedPajamaStackExchange


text:
Q: Fixing permissions for writing cUrl output to a text file I am making a web application that grabs one page from the internet using cUrl and updates another page accordingly. I have been doing this by saving the HTML from cUrl and then parsing it on the other page. The issue is: I can't figure out what permissions I should use for the text file. I don't have it saved in my  /public/ html folder, since I don't want any of the website's users to be able to see it.  I only want them to be able to see the way it's parsed on the site.
Here is the cUrl code:
$perfidlist = "" ;

$sourcefile = "../templates/textfilefromsite.txt";
$trackerfile = "../templates/trackerfile.txt";

//CURL REQUEST 1 OF 2
$ch = curl_init("http://www.website.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
<more cUrl options omitted>
ob_start();
$curl2 = curl_exec($ch);
ob_end_clean();
curl_close($ch);

//WRITING FILES
$out = fopen($sourcefile, "r");
$oldfiletext = fread($out, filesize($sourcefile));
fclose($out);

$runcode = 1  ;

And the part where I save the text file:
/*only writing a file if the site has changed*/

if (strcmp($oldfiletext, $curl2) !==0)
{
    $out = fopen($sourcefile, "w");
    fwrite($out, $curl2);
    fclose($out);

    $tracker = fopen($trackerfile, "a+");
    fwrite($tracker, date('Y/m/d H:i:s')."\n");
    fclose($tracker);

    $runcode = 1 ;
}

I am receiving an error at that last '$out = fopen($sourcefile, "w");' part that says:
Warning: fopen(../templates/textfilefromsite.txt): failed to open stream: Permission denied in /usr/share/nginx/templates/homedir.php on line 72

Any ideas?

A: The issue was with file/folder permissions. I ended up changing the permissions for the file to '666' meaning '-rw-rw-rw-' and it worked.


text:
Q: Onsen UI - reusable HTML fragments without Angular JS? I'm having a play around with Onsen UI and wondering if there's a way to define and include fragments of HTML when Onsen UI is being used without Angular JS?
For example, say I have two pages:
<ons-template id="page1.html">
    <ons-page>
        <ons-toolbar>
            <ons-toolbar-button onclick="menu.toggleMenu()"><ons-icon icon="fa-bars"></ons-icon></ons-toolbar-button>

Page 1

        </ons-toolbar>

Page 1 content

    </ons-page>
</ons-template>

<ons-template id="page2.html">
    <ons-page>
        <ons-toolbar>
            <ons-toolbar-button onclick="menu.toggleMenu()"><ons-icon icon="fa-bars"></ons-icon></ons-toolbar-button>

Page 2

        </ons-toolbar>

Page 2 content

    </ons-page>
</ons-template>

The definition of the <ons-toolbar-button> is duplicated in both pages, so is there a mechanism to define the code fragment and inject it multiple times?
<ons-toolbar-button onclick="menu.toggleMenu()"><ons-icon icon="fa-bars"></ons-icon></ons-toolbar-button>

I know that using Angular this can be done using the ngInclude directive, but wondering if <ons-template> can somehow be used to do this without the need to go Angular?

A: Onsen UI 1.x is based on Angular, so it's hard to perform any action without using it.
What are you looking for is Onsen UI 2, which is based on Web Components. This means that it's totally agnostic (platform independent) and can be used in combination with any other framework. Actually it's in alpha release but it's already quite stable, a beta is expected very soon.
If you want to take a look at Onsen UI 2.0 you can:

*

*Check the latest version on Onsen UI GitHub Repository.

*Following the Quickstart procedure:

Quickstart
$ git clone http://github.com/OnsenUI/onsenui2-quickstart
$ cd onsenui2-quickstart
$ npm install && gulp serve


text:
Q: inftyreader ocrparams coordinates conversion to pdf coordinates I am very impressed with inftyreader about generation of iml and plan to buy personal license in the near future. I am concerned about ocrparams coordinates generated in iml mapped to PDF coordinates.
For Example sample iml:
<p style="Text" newline="1" ocrparam="433,1475,1458,1568,0">
    <mblock>
        <munit cost="1" ocrparam="433,1475,483,1558,0">F</munit><munit cost="85" ocrparam="500,1500,558,1567,0">o</munit>
        <munit entity="1" cost="34" ocrparam="575,1508,607,1568,0">llcorner</munit>
        <munit cost="0" ocrparam="608,1508,625,1559,0">l</munit><munit entity="1" cost="20" ocrparam="642,1508,675,1558,0">ulcorner</munit>
        <munit cost="8" ocrparam="683,1492,717,1567,0">t</munit><munit cost="0" ocrparam="725,1500,783,1567,0">e</munit>
        <munit cost="0" ocrparam="792,1500,850,1567,0">e</munit><munit cost="0" ocrparam="867,1500,917,1558,0">n</munit>
        <munit cost="8" ocrparam="933,1492,967,1567,0">t</munit><munit italic="1" cost="35" ocrparam="975,1475,996,1559,0">l</munit>
        <munit entity="1" cost="8" ocrparam="997,1500,1025,1559,0">neg</munit><munit cost="0" ocrparam="1083,1475,1133,1567,0">E</munit>
        <munit cost="0" ocrparam="1150,1475,1217,1567,0">d</munit><munit cost="20" ocrparam="1233,1483,1242,1558,0">i</munit>
        <munit cost="6" ocrparam="1258,1492,1292,1567,0">t</munit><munit cost="20" ocrparam="1308,1508,1317,1558,0">|</munit>
        <munit cost="0" ocrparam="1333,1500,1392,1567,0">0</munit><munit cost="26" ocrparam="1408,1508,1429,1559,0">l</munit>
        <munit entity="1" cost="14" ocrparam="1430,1500,1458,1559,0">neg</munit>
    </mblock>
    <char ocrparam="1308,1475,1317,1492,0" cost="25">singleendquartation</char>
</p>

Please analyze how to map these ocrparam to pdf coordinates.


text:
Q: Can PHP use a MySQL bookmarked Query? I haven't found anything that matches my situation...
I am using XAMPP, which has MySQL as a backend and PHP in the front (web) end.  in the Administration screen of MySQL (phpMyAdmin) I can create and run SQL requests.  There is also an option of "Bookmark this SQL Query: "
Suppose i save a "Bookmark SQL Query".  Is it possible for PHP to reference this Bookmark SQL Query?  or do I have to create that query in PHP.  It would be easier to reference the Bookmarked query, rather than make the full SQL query
Thanks.
Thanks to those who understood the question.  You are smarter than those to didn't.

A: PHPMyAdmin is simply a PHP application that interfaces with your database. Anything you save on it stays on it.
Your PHP application is completely different from PHPMyAdmin and unless you create such a feature, you cannot use it within your application.
If you create a SQL execution interface within your application, you can also create something like that to be able to re-use the query.
Hope the explanation makes sense and the answer helps.

A: No, I don't think it's possible, the feature you're talking about is a feature in the client application only. You should write the query in PHP. That way you don't have to rely on an external feature/query for the application to work either.


text:
Q: jquery functions executes together even from a diffrent button I have 2 buttons and everytime I execute one of them it ends up executing the two functions together one after the other even though they do diffrent actions.
I can't find a way to seperate the two functions in two diffrent buttons without messing the code. I use a variable called key to use in the action.
I tried wrapping them in a div and give them a specific class name yet I didn't succeed into making it work
The functions are at the end

var storage = firebase.storage();
var database = firebase.database();
database.ref('declaration').once('value', function(snapshot) {
  if (snapshot.exists()) {
    var content = '';
    snapshot.forEach(function(data) {
      var key = data.key;
      var val = data.val();
      var ker = key + "2";
      var k = key + "1";
      $('#ex-table').append("
" +
        val.date +
        "	" +
        val.firstName +
        "	" +
        val.lastName +
        "	" +
        val.cin.replace('@gmail.com', '') +
        "	" +
        val.numTel +
        "	" +
        " My Position " +
        "	" +
        "" +
        "	" +
        val.etat +
        "	<button id='" + key + "'>enoyer equipe</button><button id='" + ker + "'>Delete</button>
");

      // Fonction de changement d'etat

      var storageRef = storage.ref(val.photo);
      storageRef.getDownloadURL().then(function(url) {
        // Or inserted into an  element:
        document.getElementById(k).src = url;
      }).catch(function(error) {
        // Handle any errors
      });

      $(document).on('click', "#" + key, function() {
        var database = firebase.database().ref('declaration')
        var newetat = database.child(key);
        newetat.update({
          "etat": "team sent"
        });
      });
      $(document).on('click', "#" + ker, function() {
        firebase.database().ref('declaration/' + key).remove();
      });
    });
  }
});

      Date
      Nom
      Prénom
      N° CIN
      Tel
      Position
      Photo d'accident
      Etat
      Options

A: Two issues:
1) you reused the id attribute value key (id attributes must be unique in HTML documents)
2) You have bound click events to ids key and ker on elements that are child elements to the
 element that also has a click event bound to it (with the same id).
In order to prevent the "bubbling" of the event up the
 element, add the event reference to the handlers and add:
event.stopPropagation();

inside the handler.
OR
use a different id on each
.


text:
Q: AutoLayout works for UIView but not for UILabel. Why? Desired Scenario: create a custom Alert View via iOS6's AutoLayout vs Frames:
1) Create an empty UIView upon the host view (UIController.view):
alertView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[alertView(==300)]" options:0  metrics:nil views:viewsDict]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[alertView]-|" options:0  metrics:nil views:viewsDict]];

This works:  I see my alert UIView upon (subview) the host view.

However, attempting to add UILabel to the Alert view bombs.

Seeing that the UIView (1) was drawn, I merely substituted the UILabel in its stead to see if I can get something:
- (UILabel *)createLabelWithMessage:(NSString *)message {
    if (!message) return nil;
    UILabel *myLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 0,0)];
    myLabel.text = message;
    [myLabel setFont:[UIFont systemFontOfSize:12.0]];
    [myLabel setAutoresizingMask:UIViewAutoresizingNone];
    myLabel.backgroundColor = [UIColor clearColor];
    return myLabel;
}
...
titleLabel = [self createLabelWithMessage:@"Danger"];
...
// ...replacing 'alertView' (UIView) with 'titleView' (UILabel):
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[titleLabel(==300)]" options:0  metrics:nil views:viewsDict]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[titleLabel]-|" options:0  metrics:nil views:viewsDict]];

Question: Why would the UILabel bomb but the UIView appears to be drawing okay?
Here's the hint from Xcode:

AutoLayoutContraints[3828:11303] Unable to simultaneously satisfy
  constraints.

  Probably at least one of the constraints in the
  following list is one you don't want. Try this:

  (1) look at each
  constraint and try to figure out which you don't expect;

  (2) find the
  code that added the unwanted constraint or constraints and fix it.

  (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you
  don't understand, refer to the documentation for the UIView property
  translatesAutoresizingMaskIntoConstraints)  (
      "",
      "",
      "" )
Will attempt to recover by breaking constraint

  (Names: '|':UIView:0x128727a0 )>

There must be a hidden property within UILabel that's screwing up my 'Visual-Formatting' language.

..I created another subview of "alertView"; and I get the same error.  So apparently I'm only getting a 'good' result when I merely display one (1) UIView (the 'alertView') upon (subview) of the UIController's view; nothing more.

Something hidden is conflicting the simple constraints.  And I don't know what.
BTW: I'm using a NIB as the host UIView, with 'use autoLayout' 'ON'.
     However, I'll be using this within larger code without 'autolayout' (iOS 4.3+), within
     an iOS6-checked routine.

A: Solution: (per my comment) I had missed setting the 'setTranslatesAutoresizingMaskIntoConstraints' flag to 'NO' for the particular subview; albeit I had done it for its super container.

Example:

[testView setTranslatesAutoresizingMaskIntoConstraints:NO];

Don't forget to use 'setTranslatesAutoresizingMaskIntoConstraints' for ALL member UIViews!


text:
Q: Difference between base, core, extra and community packages in arch-linux What is the difference between base, core, extra and community systems when installing the Arch-Linux?
e.g.
pacstrap /mnt base

A: You are confusing a couple different concepts here. base is a package group. It's what many consider to be the "default" package set for an Arch Linux install (and many of the rest of Arch will assume that you have all of the packages in base installed—so this isn't really an incorrect assertion).
On the other hand, core, extra and community are repositories. It is not too surprising that these can be confused with package groups (since repos are just large sets of packages). But package groups are meant to associate particular packages with one another (e.g., the gnome group contains packages related to GNOME). Repositories just store packages.
Generally speaking, core contains packages that are central to the running of a Linux distribution. You should probably expect to have almost all of its packages installed. For example, I have about ⅔ of them installed on my machine.
extra are packages that are widely used in running a Linux machine but will not be absolutely necessary for keeping a stable system. For example, you will find xorg-server in extra (not core) because headless machines do not need X.
community is a bit of a different beast. Where core and extra are maintained by the Arch Developers, community is maintained by the Arch Trusted Users. This group of users maintains the AUR and moves things into community as they (and the community at-large) see fit.
There are other repositories as well (most notably multilib and the testing repositories), but not all users will want them enabled. In addition, you can easily create your own repository (which is one of the best decisions I have ever made) that you can host locally with a tool called repose. Additionally, there are some Unofficial User Repositories.

Some additional reading:

*

*Arch Linux Repositories

*Package Groups


text:
Q: Pywin32 --> COM -->Powerpoint tutorial? Does anyone know where I could find a good list of objects and methods (or a tutorial) for working with powerpoint 2010. I was able to locate this:
http://nbviewer.ipython.org/urls/raw.github.com/sanand0/ipython-notebooks/master/Office.ipynb
but was hoping to find something a little more in depth.
I've also the book "Python Programming on Win32" but this is not PPT specific.

A: The com32 module provides access to all the .com methods of PowerPoint so I would start with the MSDN PowerPoint 2010 API - one important trick is to create the python interfaces to the object libraries:

To do this in Python, run
  Python/Lib/site-packages/win32com/client/makepy.py and pick "Microsoft
  Office 12.0 Object Library" and "Microsoft PowerPoint 12.0 Object
  Library". (If you have a version of Office other than 12.0, pick your
  version.)
  Found here

Then rename the resulting files something sensible.


text:
Q: I have two formulas for calculating 'cosine similarity', what's the difference? I am doing a project about cosine similarity on movie dataset, I'm confused about the formula for calculating cosine similarity.

But I searched online, some articles show that the denominator is something like : sqrt(A1^2+B1^2) * sqrt(A2^2+B2^2) * ... * sqrt(Ai^2+Bi^2)
I'm confused, what's the difference? Which one is correct or they both are correct?

A: The one on your image is correct. In two dimensions, it is derived from the Law of cosines
which relates the length of one side of a triangle to the length of the other two sides, and the angle opposite c, theta:
c^2==a^2+b^2-2*b*c(cos(theta))
You can prove this in many ways, and a good verification is to know that when cos(gamma)==0 (side a and b are orthogonal), you get the Pythagorean Theorem.
To get the formula on the image, you have to translate it into analytical geometry (vectors)
norm(A-B)^2==norm(A)^2+norm(B)^2−2*norm(A)*norm(B)*cos(theta)
and by using that norm(A-B)^2 is by definition (A-B)*(A-B) and expanding
we get
norm(A-B)^2 ==norm(A)^2+norm(B)^2-2*A*B
So equating both expressions, and doing cancellations, yields
norm(A)*norm(B)*cos(theta) = A*B
which is the  (rearranged) formula on your definition (and the norm(v) = sqrt(v*v)).  For n dimensions you can show this works because rotating the euclidean space preserves norm and inner product, and because the 2D plane spanned by the vectors is precisely just a rotation of the xy plane.
A good sanity check is, again that orthogonality yields a cosine of 0, and that the cosine is between 0 and 1 (this is the Cauchy Schwarz theorem)
Update:
In the examples mentioned on your comment, you can see the results from the blog by running
import sklearn.metrics.pairwise as pw
print(pw.cosine_similarity([[4,3]],[[5,5]]))
print(pw.cosine_similarity([[4,3,5]],[[5,5,1]]))

note that if you run:
from sklearn.metrics.pairwise import pairwise_distances
print(pairwise_distances([[4,3,5]],[[5,5,1]],metric='cosine'))

You get 0.208 instead of 0.792, this is because  pairwise_distance using the
cosine metric is given as 1-cos(theta) (see that 0.208 + 0.792 is  1). You do this transformation because when you talk about distances, you want the distance from a point to itself to be 0.


text:
Q: Siege does not send POST data I'm trying to test my site with siege 3.0.1. But it seems that siege does not send POST data. Here is a request I get from web-browser
POST / HTTP/1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Cache-Control: no-cache
Content-Length: 130
Content-Type: application/x-www-form-urlencoded
Host: rsc
Origin: http://rsc
Pragma: no-cache
Referer: http://rsc/
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36
X-Forwarded-For: 127.0.0.1
X-Forwarded-Proto: http
X-Real-Ip: 127.0.0.1

came_from=http%3A%2F%2Frsc%2F&login=***&password=***&form.login=%D0%9E%D1%82%D0%BF%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D1%8C

And here a request from siege
siege -g "http://rsc/ POST came_from=http%3A%2F%2Frsc%2F&login=***&password=***&form.login=%D0%9E%D1%82%D0%BF%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D1%8C"

POST / HTTP/1.0
Accept: */*
Accept-Encoding:
Content-Length: 111
Content-Type: application/x-www-form-urlencoded
Host: rsc
User-Agent: JoeDog/1.00 [en] (X11; I; Siege 3.0.1)
X-Forwarded-For: 127.0.0.1
X-Forwarded-Proto: http
X-Real-Ip: 127.0.0.1

Am I doing something wrong? I checked siege documentation and it says nothing about POST except I should write POST my=params after url.

A: According to the Siege home page, 3.0.1 has a major bug with HTTP POST and the author suggests upgrading to 3.0.2

A: I had a similar problem - siege would not post, however the result was a "200" and then a "General Error". I tried everything, the end result: I rolled back to a previous version of 2.7.2 from 3.0.1 and it mysteriously works. Fyi.


text:
Q: How to use a variable from another Python file in a Brython script How would I be able to get variables from a different python file, and be able to use that in a Brython script?
For example, I have script.py and then I have index.js - How would I import the Python code from script.py to use it in my Brython script in index.js?


text:
Q: Securing the primary Ansible user It seems that there are only two reasonable approaches for the primary Ansible user:

*

*Using root

*Using another user (e.g., ansible) with NOPASSWD sudo access

The first option is a no-go since I cringe at the thought of keeping PermitRootLogin on. So, by default, the 2nd option seems to be the way to go.
I was thinking, at the very least, in /etc/ssh/sshd_config:
Match User ansible
    PasswordAuthentication No

And limiting key usage to the Ansible host by using the from option in authorized_keys:
from="192.168.100/24"

Any other ideas or issues/concerns with my thoughts so far?

A: Those are the measures that I use for clients that have to be managed remotely by ssh (in my case using BackupPC instead of Ansible, but it works the same way).
If you're only using ssh to manage the clients, not for shell access, then it will improve security to add
AllowUsers ansible
PasswordAuthentication no

A: You can have a user account that requires a password for SUDO access and provide that value at run-time via the --ask-sudo-pass flag (-K) for ansible-playbook
ansible-playbook -i inv/production -K playbook.yml

see http://docs.ansible.com/playbooks_intro.html for more details


text:
Q: What does it mean to keep $inject in sync? I'm reading the Angular docs about injecting dependencies, and am trying to figure what 'in sync' means.
As in, what's the difference between keeping things 'in sync' vs keeping things 'in the same order'?  The docs seem to imply that there's some difference between them.
Context:
About inline array notation,
When using this type of annotation, take care to keep the annotation array in sync with the parameters in the function declaration.
About $inject property annotation,
In this scenario the ordering of the values in the $inject array must match the ordering of the parameters in MyController.
Just like with the array annotation, you'll need to take care to keep the $inject in sync with the parameters in the function declaration.

A: 'In sync' and 'in order' mean the same thing in this case.
The order is important in all cases apart from Implicit Annotation (however an implicitly defined function will break during minification/uglification)
As can be seen here:
app = angular.module('myApp', []);
// Inline Array Notation where we are defining the dependencies in the opposite order of what the function is defined as
app.controller('myInlineCtrl', ['$http', '$scope', function ($scope, $http) {
    $scope.testVal = '$scope passed as $scope';
    $http.testVal = '$http passed as $scope';
    // results in `$http passed as $scope`
}]);

// $inject Property Annotation
var myInjectorCtrl = function ($scope, $http) {
    $scope.testVal = '$scope passed as $scope';
    $http.testVal = '$http passed as $scope';
    // results in `$http passed as $scope`
}
// Inject the dependencies in the opposite order
myInjectorCtrl.$inject = ['$http', '$scope'];
app.controller('MyInjectorCtrl', myInjectorCtrl);

The above test demonstrates that we are bound to the order of injection rather than the order of the arguments in the function definition.  This is consistent with being able to define a function with whichever argument names you wish (within reason) such that when it comes around to minification of the app, the function itself can get compressed but is still called with the correct arguments.
An example of that is this:
// Define a controller with your own argument names
app.controller('myMickeyMouseCtrl', ['$http', '$scope', '$timeout', function (mickey, donald, daffy) {
    mickey.testVal = 'mickey passed as $scope';
    donald.testVal = 'donald passed as $scope';
    daffy.testVal = 'daffy passed as $scope';
    // results in `donald passed as $scope`
}]);

Demo of all three http://jsfiddle.net/6qh2oyu6/
It's important to note also that if you define myInjectorCtrl.$inject = ['$timeout']; subsequently to already defining it you will clear the injections stored for that Controller function and in this case it would result with only the angular $timeout function being injected.


text:
Q: Conditional convergence of a series involving $sin n \theta$ I recently stumbled upon the series $$\sum_{n=1}^{\infty}\left(1+\frac{1}{2}+\cdots+\frac{1}{n}\right)\frac{\sin n \theta}{n}.$$ Consider all values of $\theta$ except $k \pi$ where $k$ is an integer.
Is the series conditionally convergent?
I know that $\sum_{n=1}^{\infty} \frac{\sin n \theta}{n}$ is convergent. But what about this?

A: Abel's Test implies that: If $a_n$ is monotonically decreasing and tends to $0$, then series
$$\sum_{n=1}^{\infty}a_n\sin nx$$
is convergent for any $x\in \mathbb{R}$.
Let $a_n=\frac{1}{n}\sum_{k=1}^{n}\frac{1}{k}$, you can get the idea!


text:
Q: Display serious of numbers under same column in excel sheet I want to display a serious of numbers in same column in excel sheet
-30,
-25,
-20,
-15,
-10,
-5,
0,
5,
10,
15,
20,
25,
30,

Excel is throuwing error to create function to do this. The formulas I tried is not working.

A: In A1 enter:
=(ROW()-1)*5-30 & ","

and copy down:


text:
Q: How to make state variable thread safe Suppose I have a class having static member variable.There are two synchronized methods,static and instance, present in that class and both the methods are trying to modify the value of static member variable. First thread is having lock on object of that class , so first thread can access both static synchronized and instance synchronized method. Second thread is having class level lock , so it can access only static synchronized method. In this scenario , how to achieve thread safety.

A: Either add an additional synchronized block to the instance method, that synchronized on the class object, or use an additional lock object. The following listing shows the former:
class Foo {
    private static Set<String> state = new HashSet<>();
    public static synchronized void bar(String item) {
        state.add(item);
    }
    public /* synchronized */ baz(String item) {
        synchronized (Foo.class) {
            state.add(item);
        }
    }
}


text:
Q: Issue on Generating signed apk in Android Studio I want to generate signed apk in android studio of my project but It is giving me error.I am new to android, please help me in this.
Unable to find out whether the issue is with progaurd or build.gradle.
Added my logs in the below section, please check :
Gradle console gives stack trace like this:
Executing tasks: [:app:assembleRelease]

Configuration on demand is an incubating feature.
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
:app:preBuild UP-TO-DATE
:app:extractProguardFiles UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:compileReleaseAidl UP-TO-DATE
:app:compileReleaseRenderscript UP-TO-DATE
:app:checkReleaseManifest UP-TO-DATE
:app:generateReleaseBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources UP-TO-DATE
:app:mergeReleaseResources UP-TO-DATE
:app:createReleaseCompatibleScreenManifests UP-TO-DATE
:app:processReleaseManifest UP-TO-DATE
:app:splitsDiscoveryTaskRelease UP-TO-DATE
:app:processReleaseResources UP-TO-DATE
:app:generateReleaseSources UP-TO-DATE
:app:javaPreCompileRelease UP-TO-DATE
:app:compileReleaseJavaWithJavac UP-TO-DATE
:app:compileReleaseNdk NO-SOURCE
:app:compileReleaseSources UP-TO-DATE
:app:lintVitalRelease
:app:mergeReleaseShaders UP-TO-DATE
:app:compileReleaseShaders UP-TO-DATE
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets UP-TO-DATE
:app:processReleaseJavaRes NO-SOURCE
:app:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:app:transformClassesAndResourcesWithProguardForRelease
ProGuard, version 5.3.3
Reading program jar [C:\Users\R415109\.gradle\caches\transforms-1\files-1.1\design-26.0.0-alpha1.aar\abc0b6e3eb8368bdf2a74658166bb154\jars\classes.jar] (filtered)
Reading program jar [C:\Users\R415109\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.0.0-alpha1.aar\8974eefbe53db7b2eeb5573e0af4a774\jars\classes.jar] (filtered)
Reading program jar [C:\Users\R415109\.gradle\caches\transforms-1\files-1.1\constraint-layout-1.0.2.aar\31ac9e7d606122db6b0e603e8c5f6fd5\jars\classes.jar] (filtered)
Reading program jar [C:\Users\R415109\.gradle\caches\transforms-1\files-1.1\animated-vector-drawable-26.0.0-alpha1.aar\3f5410882f8bf1539817c40d4a0986ca\jars\classes.jar] (filtered)
Reading program jar [C:\Users\R415109\.gradle\caches\transforms-1\files-1.1\support-vector-drawable-26.0.0-alpha1.aar\04e551f6ff90084336c8ae72092ea520\jars\classes.jar] (filtered)
Reading program jar [C:\Users\R415109\.gradle\caches\transforms-1\files-1.1\recyclerview-v7-26.0.0-alpha1.aar\6d50886c4539221b2c415b5e96b0bcbf\jars\classes.jar] (filtered)
Reading program jar [C:\Users\R415109\.gradle\caches\transforms-1\files-1.1\transition-26.0.0-alpha1.aar\55c4deeec5aa27b9de2fda37ed841bfc\jars\classes.jar] (filtered)
Reading program jar [C:\Users\R415109\.gradle\caches\transforms-1\files-1.1\support-v4-26.0.0-alpha1.aar\924d0853d9d9014632b2c3d87c300708\jars\classes.jar] (filtered)
Reading program jar [C:\Users\R415109\.gradle\caches\transforms-1\files-1.1\support-media-compat-26.0.0-alpha1.aar\764ef8dd6589dc8ae4a497744db30039\jars\classes.jar] (filtered)
Reading program jar [C:\Users\R415109\.gradle\caches\transforms-1\files-1.1\support-fragment-26.0.0-alpha1.aar\2692841d224fdbd683c57a4735fde6be\jars\classes.jar] (filtered)
Reading program jar [C:\Users\R415109\.gradle\caches\transforms-1\files-1.1\support-core-utils-26.0.0-alpha1.aar\6146ab7da60dccd21905bfb04e494aba\jars\classes.jar] (filtered)
Reading program jar [C:\Users\R415109\.gradle\caches\transforms-1\files-1.1\support-core-ui-26.0.0-alpha1.aar\34a03cd0a19adf721c7063e1df11e380\jars\classes.jar] (filtered)
Reading program jar [C:\Users\R415109\.gradle\caches\transforms-1\files-1.1\support-compat-26.0.0-alpha1.aar\0e033036815fd7a9d996774eba6bed0f\jars\classes.jar] (filtered)
Reading program jar [C:\Users\R415109\AppData\Local\Android\Sdk\extras\android\m2repository\com\android\support\support-annotations\26.0.0-alpha1\support-annotations-26.0.0-alpha1.jar] (filtered)
Reading program jar [C:\Users\R415109\AppData\Local\Android\Sdk\extras\m2repository\com\android\support\constraint\constraint-layout-solver\1.0.2\constraint-layout-solver-1.0.2.jar] (filtered)
Reading program directory [D:\VCDM\BT_REMCO_APP_DEV\Working\06_Code\Hyundai Sync Working Project\app\build\intermediates\classes\release] (filtered)
Reading program jar [D:\VCDM\BT_REMCO_APP_DEV\Working\06_Code\Hyundai Sync Working Project\app\build\intermediates\transforms\mergeJavaRes\release\0.jar] (filtered)
Reading library jar [C:\Users\R415109\AppData\Local\Android\Sdk\platforms\android-26\android.jar]
Reading library jar [C:\Users\R415109\AppData\Local\Android\Sdk\platforms\android-26\optional\org.apache.http.legacy.jar]
Note: duplicate definition of library class [org.apache.http.params.HttpConnectionParams]
Note: duplicate definition of library class [org.apache.http.params.HttpParams]
Note: duplicate definition of library class [org.apache.http.params.CoreConnectionPNames]
Note: duplicate definition of library class [org.apache.http.conn.ConnectTimeoutException]
Note: duplicate definition of library class [org.apache.http.conn.scheme.HostNameResolver]
Note: duplicate definition of library class [org.apache.http.conn.scheme.SocketFactory]
Note: duplicate definition of library class [org.apache.http.conn.scheme.LayeredSocketFactory]
Note: duplicate definition of library class [android.net.http.SslCertificate$DName]
Note: duplicate definition of library class [android.net.http.SslCertificate]
Note: duplicate definition of library class [android.net.http.HttpResponseCache]
Note: duplicate definition of library class [android.net.http.SslError]

Note: there were 11 duplicate class definitions.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)

Note: android.support.v4.app.NotificationCompatJellybean calls 'Field.getType'

Warning: android.support.v4.app.NotificationCompatApi26: can't find referenced method 'java.lang.String getChannel()' in library class android.app.Notification
Warning: android.support.v4.app.NotificationCompatApi26$Builder: can't find referenced method 'android.app.Notification$Builder setChannel(java.lang.String)' in library class android.app.Notification$Builder
Warning: android.support.v4.media.session.MediaControllerCompatApi26: can't find referenced method 'int getRepeatMode()' in library class android.media.session.MediaController
Warning: android.support.v4.media.session.MediaControllerCompatApi26: can't find referenced method 'boolean isShuffleModeEnabled()' in library class android.media.session.MediaController
Warning: android.support.v4.media.session.MediaControllerCompatApi26$TransportControls: can't find referenced method 'void setRepeatMode(int)' in library class android.media.session.MediaController$TransportControls
Warning: android.support.v4.media.session.MediaControllerCompatApi26$TransportControls: can't find referenced method 'void setShuffleModeEnabled(boolean)' in library class android.media.session.MediaController$TransportControls
Warning: android.support.v4.media.session.MediaSessionCompatApi26: can't find referenced method 'void setRepeatMode(int)' in library class android.media.session.MediaSession
Warning: android.support.v4.media.session.MediaSessionCompatApi26: can't find referenced method 'void setShuffleModeEnabled(boolean)' in library class android.media.session.MediaSession
Warning: android.support.v7.widget.FastScroller: can't find referenced class android.support.v7.widget.FastScroller$State
Warning: android.support.v7.widget.FastScroller: can't find referenced class android.support.v7.widget.FastScroller$DragState
Warning: android.support.v7.widget.FastScroller: can't find referenced class android.support.v7.widget.FastScroller$AnimationState
Warning: android.support.v7.widget.FastScroller: can't find referenced class android.support.v7.widget.FastScroller$State

Note: android.support.v4.media.ParceledListSliceAdapterApi21: can't find dynamically referenced class android.content.pm.ParceledListSlice
Note: android.support.v4.text.ICUCompatApi21: can't find dynamically referenced class libcore.icu.ICU
Note: android.support.v4.text.ICUCompatIcs: can't find dynamically referenced class libcore.icu.ICU
Note: android.support.v7.app.ResourcesFlusher: can't find dynamically referenced class android.content.res.ThemedResourceCache
Note: android.support.v7.widget.DrawableUtils: can't find dynamically referenced class android.graphics.Insets
Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'icon' dynamically
      Maybe this is program field 'android.support.design.R$attr { int icon; }'
      Maybe this is program field 'android.support.design.R$id { int icon; }'
      Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { int icon; }'
      Maybe this is program field 'android.support.v7.appcompat.R$attr { int icon; }'
      Maybe this is program field 'android.support.v7.appcompat.R$id { int icon; }'
      Maybe this is program field 'hyundai.iblue.R$attr { int icon; }'
      Maybe this is program field 'hyundai.iblue.R$id { int icon; }'
      Maybe this is library field 'android.R$attr { int icon; }'
      Maybe this is library field 'android.R$id { int icon; }'
      Maybe this is library field 'android.app.LauncherActivity$ListItem { android.graphics.drawable.Drawable icon; }'
      Maybe this is library field 'android.app.Notification { int icon; }'
      Maybe this is library field 'android.app.Notification$Action { int icon; }'
      Maybe this is library field 'android.appwidget.AppWidgetProviderInfo { int icon; }'
      Maybe this is library field 'android.content.pm.PackageItemInfo { int icon; }'
      Maybe this is library field 'android.content.pm.ResolveInfo { int icon; }'
      Maybe this is library field 'android.inputmethodservice.Keyboard$Key { android.graphics.drawable.Drawable icon; }'
      Maybe this is library field 'android.service.notification.Condition { int icon; }'
      Maybe this is library field 'android.speech.tts.TextToSpeech$EngineInfo { int icon; }'
Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'title' dynamically
      Maybe this is program field 'android.support.design.R$attr { int title; }'
      Maybe this is program field 'android.support.design.R$id { int title; }'
      Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { java.lang.CharSequence title; }'
      Maybe this is program field 'android.support.v7.appcompat.R$attr { int title; }'
      Maybe this is program field 'android.support.v7.appcompat.R$id { int title; }'
      Maybe this is program field 'hyundai.iblue.R$attr { int title; }'
      Maybe this is program field 'hyundai.iblue.R$id { int title; }'
      Maybe this is library field 'android.R$attr { int title; }'
      Maybe this is library field 'android.R$id { int title; }'
      Maybe this is library field 'android.app.Notification$Action { java.lang.CharSequence title; }'
      Maybe this is library field 'android.preference.PreferenceActivity$Header { java.lang.CharSequence title; }'
Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'actionIntent' dynamically
      Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { android.app.PendingIntent actionIntent; }'
      Maybe this is library field 'android.app.Notification$Action { android.app.PendingIntent actionIntent; }'
Note: android.support.v4.app.NotificationManagerCompatKitKat accesses a declared field 'OP_POST_NOTIFICATION' dynamically
      Maybe this is program field 'android.support.v4.app.NotificationManagerCompatKitKat { java.lang.String OP_POST_NOTIFICATION; }'
Note: android.support.v4.text.ICUCompatApi21 accesses a method 'addLikelySubtags(java.util.Locale)' dynamically
      Maybe this is program method 'android.support.v4.text.ICUCompatIcs { java.lang.String addLikelySubtags(java.util.Locale); }'
Note: android.support.v4.text.ICUCompatIcs accesses a method 'addLikelySubtags(java.lang.String)' dynamically
Note: android.support.v7.app.ResourcesFlusher accesses a declared field 'mDrawableCache' dynamically
Note: android.support.v7.app.ResourcesFlusher accesses a declared field 'mUnthemedEntries' dynamically
Note: android.support.v7.widget.ViewUtils accesses a method 'makeOptionalFitsSystemWindows()' dynamically
Note: the configuration keeps the entry point 'android.support.graphics.drawable.VectorDrawableCompat$VPath { void setPathData(android.support.graphics.drawable.PathParser$PathDataNode[]); }', but not the descriptor class 'android.support.graphics.drawable.PathParser$PathDataNode'
Note: there were 1 classes trying to access generic signatures using reflection.
      You should consider keeping the signature attributes
      (using '-keepattributes Signature').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#attributes)
Note: there were 1 unkept descriptor classes in kept class members.
      You should consider explicitly keeping the mentioned classes
      (using '-keep').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)
Note: there were 5 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Note: there were 9 accesses to class members by means of introspection.
      You should consider explicitly keeping the mentioned class members
      (using '-keep' or '-keepclassmembers').
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclassmember)

Warning: there were 4 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 8 unresolved references to library class members.
         You probably need to update the library versions.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)

Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 38s

21 actionable tasks: 2 executed, 19 up-to-date

Please help me out to get signed apk. Trying since a week but unable to find out the exact solution.


text:
Q: after wrap into anonymous function JavaScript code not working i have this code..which wrap in anonymous function
(function() {
  console.log("writting dataaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

window.onMessage1 = function(messageEvent) {
  console.log("writting dataaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
  console.log(messageEvent.data["color"]);
  return $("form#credit-info-form").append(messageEvent.data["color"]);
 };

}).call(this);

Error is 'TypeError: Cannot read property 'data' of undefined'
but when i'm executing above code without anonymous function wrap then it working ..
same error was on function name too i solved that with make 'onMessage1' to 'window.onMessage1' global scope..
any solution how to do with anoymous function ?
Thanks

A: The messageEvent parameter is undefined, which means you're not passing an argument to window.onMessage1 when you call it.
// this is the parameter---------v
window.onMessage1 = function(messageEvent) {
  console.log("writting data");

// you use it here--v
  console.log(messageEvent.data["color"]);

  //---------------------------and here--------v
  return $("form#credit-info-form").append(messageEvent.data["color"]);
};

so when you invoke it, you need to pass an argument that has a data property.
window.onMessage1(my_object);

A: This will work
(function() {
    console.log("writting dataaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
    window.onMessage1 = (function(messageEvent) {
        console.log("writting dataaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
        console.log(messageEvent.data["color"]);
        //return $("form#credit-info-form").append(messageEvent.data["color"]);
    });
})();

Call the function
onMessage1({'data':{'color':'red'}});

But $("form#credit-info-form") seems that a form with id=credit-info-form and you are appending messageEvent.data["color"], is that what you are doing ? Seems wrong to me.
Also, why you are using the anonymous function ? Since you are making the function global using window.onMessage1 = function(){...}.


text:
Q: mpdf - nested divs and positioning I have 2 divs like the following:
jsFiddle
You can they render, one on top of each other, which is fine.
The problem is the positioning within the PDF.
I have tried in the style position:absolute;top:100px etc, but for some reason I cannot move the div when rendering using mPDF. none of the top, left, right or bottom positioning seem to work. Is this a limitation in mDF?
Any ideas?

A: well as its a PDF it doesnt work in pixels its in mm but other than that it should work, have a look through the examples that come with it, theres some really good examples of achienving different stuff in CSS

A: Taken directly from the mpdf site.

Blocks which are defined as position:absolute, position:fixed or
  float:xxx are only partially supported.

http://mpdf.bpm1.com/index.php?page=Limitations


text:
Q: Legacy auth continuation in UWP I have a Windows 8/RT app that I wrote a few years back in which I used Azure Mobile Services and the Live SDK to authenticate the User via the User's Microsoft account.
Now I'm rewriting the UI from scratch as a UWP app and I'm seriously struggling to figure out how to implement authentication, now, in a way that when a User saves data in 1 version of the app, I can show it to them in the other version.
It seems that MS is pushing us to Azure AD, but I can find little to help me and all of the examples I can find are either not supported on UWP or no longer supported by Azure.
Can I please get some direction....where to find examples of currently supported code?

A: According to your description, I have checked the Live SDK and found that the latest version is v5.6.3 and the last updated at Wednesday, July 8, 2015. Also, I have checked this lib could not work in my UWP app (target version: Windows 10.0;Build 10240).
I assumed that you could invoke Microsoft Graph via the Azure AD v2.0 endpoint with Microsoft account for authentication. For more details, you could refer to Get started with Microsoft Graph in a universal Windows 10 app and this git sample.
Or you could migrate your azure mobile service to azure app service and configure the server-side Microsoft Account authentication, then refer to this official tutorial about adding authentication to your Windows app.

A: This was far more difficult than it should've been and that, I think, has everything to do with how fast things are changing and the difficulty of keeping the documentation up-to-date while battling against the search engines that are prone to providing the most viewed information which, in this case, is out-of-date and obsolete and no longer works.
As far as Bruce's answer, I tried.  First of all, it seems that my Mobile Apps have automatically been migrated to App Services in Azure.  Secondly, the Microsoft Graph implementation will authenticate but creates a disconnect as the information returned by the authentication process doesn't match the information returned from the Live SDK which I use for uniquely identifying the User.  Therefore, using the Graph implementation disconnects my Users from all of the data they have asked me to store for them.  Thirdly, the articles linked in the 2nd paragraph (despite being written 6 months ago) are out-of-date, use obsolete tools such as the "Classic" Azure Portal and assume your creating a new app thus allowing a template to do a great deal of the configuration and such that I needed.
I do sincerely appreciate the effort, though, Bruce.
Last year I implemented auth in a UWP app using the OneDrive SDK.  I encountered 2 problems with trying to do that in the new app:

*

*The version I used last year was a full version old (1.15 v 2.0.6)...as are the great majority of tutorials about how to use the SDK that I could find on the internet.  Everything seems to be about the OneDriveClientExtensions class...which no longer exists.  But I didn't particularly want to be stuck with the version from 2015 and never be able to upgrade.  Since the newest version is already 6 months old, I'm kinda scared anyway.

*The newest version requires, for auth purposes, that you also install the Microsoft.OneDriveSDK.Authentication package.  This was last updated 5 months ago, but is dependent on v2 of Microsoft.IdentityModel.Clients.ActiveDirectory which is at version 3.13 (although it appears v2 is still being worked on).  Where this becomes a real pain is that the UWP Community Toolkit Services library requires v3 of that same package so you can't have both the Toolkit Services AND OneDriveSDK Authentication packages installed in the same project.  Fortunately, since I couldn't get the UWP Services library to do what I wanted it to do, I didn't really need it.

So, I removed the UWP Services package from my solution and installed the latest OneDrive SDK packages and rummaged around the internet looking for examples of how to use that version and I finally found this:
var scopes = new string[] { "wl.signin" };
var client = new OnlineIdAuthenticationProvider(scopes);
await client.AuthenticateUserAsync();

Then you can access the client's CurrentAccountSession property to get the UserId.
Now, I'm sure this is a temporary solution as, eventually, the OneDrive SDK will be obsolete and I'll need to use some library that's dependent on v3 of the ActiveDirectory package, but until then, this works.


text:
Q: Using Terraform Provider in aws module I am going through the terraform documentation, and it seems unclear to me. I'm quite new to Terraform so no doubt i'm misunderstanding something here:
https://developer.hashicorp.com/terraform/language/modules/develop/providers
Problem:
My terraform pipeline is returning the following warning:
│
│   on waf-cdn.tf line 9, in module "waf_cdn":
│    9:     aws = aws.useastone
│
│ Module module.waf_cdn does not declare a provider named aws.
│ If you wish to specify a provider configuration for the module, add an entry for aws in the required_providers block within the module.

My root module is calling a child waf module. I understand that i need to configure my provider within my root module. There are 2 files within my root module:
...terraform.tf...
terraform {
  backend "s3" {}
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.33.0"
    }

    random = {
      source  = "hashicorp/random"
      version = "3.1.0"
    }

    local = {
      source  = "hashicorp/local"
      version = "2.1.0"
    }

    kubernetes = {
      source  = "hashicorp/kubernetes"
      version = ">= 2.0.1"
    }
  }
}

...and providers.tf...
provider "aws" {

  region = var.region
  assume_role {
    role_arn = "arn:aws:iam::${var.account_id}:role/${local.role_name}"
  }

}

provider "aws" {

  region = "us-east-1"
  alias  = "useastone"
  assume_role {
    role_arn = "arn:aws:iam::${var.account_id}:role/${local.role_name}"
  }
}

provider "aws" {
  region = var.region
  alias  = "master"
  assume_role {
    role_arn = replace(
      "arn:aws:iam::${var.master_account_id}:role/${local.role_name}",
      local.app_region,
      "master"
    )
  }
}

When calling the child module, the SCOPE attribute of the waf needs to specify the region as us-east-1 for CLOUDFRONT as it is a global service in AWS. Therefore, i need to pass the useastone provider when calling the child waf module as seen below:
module "waf_cdn" {
  source      = "../modules/qa-aws-waf-common"
  name        = "${local.waf_prefix}-cdn"
  logging_arn = aws_kinesis_firehose_delivery_stream.log_stream_cdn.arn
  scope       = "CLOUDFRONT"
  tags        = merge(module.tags.tags, { name = "${local.name_prefix}-qa-waf-cdn" })

  providers = {
    aws = aws.useastone
  }
}

With this code i'm getting the error show above.
I'm banging my head against the documentation here so any help guys would be really appreciated.
Here's hoping, thanks!

A: As per the documentation you linked, here is the passage you are interested in [1]:

Additional provider configurations (those with the alias argument set) are never inherited automatically by child modules, and so must always be passed explicitly using the providers map.

Since that is the case, you need to define the provider(s) on the module level as well:
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.33.0"
      configuration_aliases = [ aws.useastone ]
    }
  }
}

That would probably be an additional providers.tf file in ../modules/qa-aws-waf-common.

[1] https://developer.hashicorp.com/terraform/language/modules/develop/providers#passing-providers-explicitly


text:
Q: UseStartup vs UseStartup(nameof(YourAssembly)) I just read that UseStartup(nameof(YourAssembly)) will use the Startup class, unless you have a specific environment variable set for Environment, and have the corresponding StartupEnvironment class.
If UseStartup(nameof(YourAssembly)) works for both scenarios, whereas UseStartup<Startup> only works for a Startup class, why would you ever use UseStartup<Startup> over UseStartup(nameof(YourAssembly))?

A: In my opinion, we will just have one start up class normally. So there is no need to use UseStartup(nameof(YourAssembly)), since the UseStartup<Startup> could be more readable.
If we just have one startup class, there is no difference between the UseStartup(nameof(YourAssembly)) and UseStartup<Startup>.
If we have multiple startup class, then we will use UseStartup(nameof(YourAssembly)) instead of UseStartup<Startup>.
More details, you could refer to this document.


text:
Q: How do I check which of the 12 Brothersisterpon I've found? In the Central Exchange of the Argentum Trade Guild, the owner of the 12 Brothersisterpon shop asks you to find his 11 brothers and sisters. I think I've found most of them, but I can't figure out who is missing.
Is there any way to check which siblings I've found already?

A: Unfortunately, there is no way to check which siblings you've found already. From the Xenoblade Wiki:

Twelve Brothersisterpon is an informal quest in Xenoblade Chronicles 2. It does not appear in the quest log. It is initiated by speaking to Motata at the 12 Brothersisterpon shop in Argentum. Since it does not appear in the quest log, there is no way to check one's progress.

Your only option is to check every sibling's location to see which ones you missed.


text:
Q: What is the relationship between the volume form and the divergence operator? While researching how to derive the divergence theorem from the generalized Stokes' theorem, I ran into the wikipedia page for the volume form, which claimed that the divergence of a vector field $X$ on a manifold $M$ could be defined as the unique scalar function which solves
$$(\textrm{div}X)\omega = d(X \;\lrcorner\;\omega) \quad (1)$$
where $\omega$ is the volume form of $M$ and $X \;\lrcorner\;\omega$ is the interior product with $X$.
Stokes' theorem then implies that
$$ \int_{M} (\textrm{div}X)\omega = \int_{\partial M}X \;\lrcorner\;\omega \quad (2)$$
This is claimed to be a generalization of the divergence theorem.

*

*Why is $(1)$ a "good" definition for divergence? How does it connect to the usual definition? How should I (intuitively) interpret the relation with the volume form?

*How does $(2)$ restrict to the usual statement of the divergence theorem? I'd assume there's some way to transform $X \;\lrcorner\;\omega$ into $(X\cdot n) \alpha$ where $\alpha$ is the volume form on $\partial M$, but I don't know how to derive it.


text:
Q: How to send large file through ISAPI dll? I have an isapi DLL (made in Delphi) that must return large files (video files). All theses video files are concatenated in one single physical file (data file). So for example if an user request the file #123 then the isapi dll will need to return the bytes in the data file located from offset $xx to offset $yy.
Actually my problem is that it's look like I load in memory all the bytes from offset $xx to offset $yy when i send them via EXTENSION_CONTROL_BLOCK WriteClient
Is their a way to not load in memory all the bytes and return it incrementally as the user client request it ?
actually this is my code :
var Buffer: array[0..8191] of Byte;
AStream.Position := StartOffset;
while AStream.Position < EndOffset do begin
  BytesToSend := AFileStream.Read(Buffer, SizeOf(Buffer));
  MyEXTENSION_CONTROL_BLOCK.WriteClient(ECB.ConnID, @Buffer, DWORD(BytesToSend)
end

A: Please have a look at this and see if it applies to your case. If it does, you may be helped by calling this once at the start of each response:
ecb.ServerSupportFunction(ecb.ConnID,HSE_REQ_SET_FLUSH_FLAG,pointer(true),nil,nil);

(where ecb is a pointer to the Extension Control Block)


text:
Q: Text in left is within container and image is out of container How can I design this part with html and css, when I have design like this image:

Text is within container, but image in the right is out of container

A: This can help you. But you need to work-around for the height. As currently the height comes from the text content.

.parent {
  background-image: url('http://lorempixel.com/output/food-q-c-640-480-3.jpg');
  background-repeat: no-repeat;
  background-position: top right;
  background-size: 50% 100%;
}

.text-bg {
  color: #fff;
  background: navy;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
        dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

A:
You can check this snippet I have tried. Hope it will help :

body,
html {
  margin: 0px;
  padding: 0px;
}

.full-width-bg {
  float: left;
  position: relative;
  background: blue;
  width: 100%;
}

.container {
  max-width: 1170px;
  margin: 0px auto;
  width: 100%;
}

.left,
.right {
  width: 50%;
  float: left;
}

.left {
  padding: 20px 0;
  color: #fff;
}

.right {
  position: absolute;
  right: 0px;
  width: 50%;
  top: 0px;
  bottom: 0px;
}

.right img {
  height: 100%;
  width:100%;
}

Lorem Ipsum

Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello
        123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123 Hello 123


text:
Q: Windows 8.1 keeps detecting old uninstalled graphics card so I can't upgrade to Windows 10 I'm on Windows 8.1, the Windows 10 upgrade tool detected that my old nvidia 7600 was too old to upgrade to Windows 10.
So I installed a newer card, an nvidia 210. I removed nvidia drivers and reinstalled them.
Device manager shows new card correctly. However the Windows 10 upgrade tool shows my old nvidia 7600 and says it can't upgrade. When I click view report, it says it last ran a few weeks ago (I just installed the new card today).
How can I get it to detect my new card?
I've tried manually running scheduled task:
schtasks.exe /Run /TN "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser"

SUCCESS: Attempted to run the scheduled task "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser".


text:
Q: How to compare rows in to separate spreadsheets using SpreadSheetLight and return differences I'm a bit new to C# / ASP.NET - I have 2 excel spreadsheets
sheet1 has 3 columns with values.
sheet2 has 2 columns with valuse.
I'm trying to compare row data in them both. It's working but I'm not sure how to catch if the data in sheet1 is not the same in sheet2?
Any help to what I am missing would be appreciated.
StringBuilder compErroWorkSheet = new StringBuilder();

protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
    var firstdoc = new SLDocument(@"C:\boarding Files for testing\Sample Offboarding Work Area\Kim.Jay\SpreadsheetsFromDC\test.xlsx", "Sheet2");

    var secondoc = new SLDocument(@"C:\boarding Files for testing\Sample Offboarding Work Area\Kim.Jay\ValidatedCSVs\Test1.xlsx", "Sheet2");

    AreSheetsIdentical(firstdoc, secondoc);

    // Error file for Document Services person
    Response.Clear();
    Response.ContentType = "text";

    //TODO: Also save in a safe place first
    Response.AddHeader("Content-Disposition", "attachment;filename=errors.csv");
    Response.Write(compErroWorkSheet.ToString());
    Response.End();
}

private bool AreSheetsIdentical(SLDocument firstdoc, SLDocument secondoc)
{
    SLWorksheetStatistics stats1 = firstdoc.GetWorksheetStatistics();
    SLWorksheetStatistics stats2 = secondoc.GetWorksheetStatistics();

    for (int j = 1; j < stats1.EndRowIndex; j++)
    {
        if (firstdoc.GetCellValueAsString(0, j) != secondoc.GetCellValueAsString(0, j))
            return false;

        compErroWorkSheet.AppendLine("Errors");
    }

    return false;
}

A:
I fixed it....  however I'm still need to write the differences to a NEW csv file or spreadsheet.

private bool AreSheetsIdentical(SLDocument firstdoc, SLDocument secondoc)
        {
            SLWorksheetStatistics stats1 = firstdoc.GetWorksheetStatistics();
            SLWorksheetStatistics stats2 = secondoc.GetWorksheetStatistics();

            for (int j = 1; j


text:
Q: Remove all characters except for certain string in R I'm trying to remove all characters except for a list of specific strings that I have specified from a column in R.
My data:
oldlist <- c("ljwefhwordlsfk", "kjrghewletterweifj", "esjnumbersf", "ggkjherletter", "slrgjwordoggr")

My expected outcome:
desiredlist <- c("word", "letter", "number", "letter", "word")

What I have tried but won't work:
helpvector <- c("word", "letter", "number")

neuenummer <- gsub(paste0("[^", paste(helpvector, collapse=""), "]+"), "", oldlist)

A: We can use str_extract from stringr
library(stringr)
str_extract_all(oldlist, str_c(helpvector, collapse="|"), simplify = TRUE)[,1]
#[1] "word"   "letter" "number" "letter" "word"

Or with gregexpr/regmatches from base R
unlist(regmatches(oldlist, gregexpr(paste0(helpvector, collapse="|"), oldlist)))
#[1] "word"   "letter" "number" "letter" "word"

A: library(stringi)
library(dplyr)
stri_extract_all_regex(oldlist, '(word|letter|number)') %>% unlist()
[1] "word"   "letter" "number" "letter" "word"


text:
Q: Difference of concave functions Suppose that there are two concave functions $f_1(x)$ and $f_2(x)$ defined on $x\geq0$. In addition, the functions are  positive, smooth, bounded ($|f_2|\leq b_2,|f_1|\leq b_1$ such that $b_2 = b_1<\infty$), monotone increasing and $f_1\geq f_2$ where $f_1(0)=f_2(0)=0$. I'm trying to be as much specific as I can because my question is a bit vague:
Is there something general that can be said about the  difference $f_1-f_2$ without the further knowledge of the behavior of their derivatives? Namely, is there something to say about the number of local extrema or stationary points the difference can have?
To elaborate: clearly, $f'_1(0)>f'_2(0)$ but for $x>0$ the derivative of $f_2$ can become greater than that of $f_1$ at least once. In that case there is  one stationary point. Can there be more? What changes if $b_2< b_1<\infty$ or if both functions are unbounded?
Feel free to point me to books, web sites or lecture notes where the answers are. This is not a homework.
EDIT: Loosely speaking, can a difference of two functions satisfying the assumptions above have many ($>1$) humps and dips? If yes provide an example or argument.
What would the two functions have to satisfy for their difference to have just one stationary point (that is one function approaches the other, crosses it and departs)?

A: I think the sufficient condition to have at most two stationary points is to show that the first derivatives itself are strictly convex/concave increasing/decreasing (monotonic convex or monotonic concave).
If for example, we have $f_1'> 0$ and $f_2' >0$ and furthermore, $f_1''' > 0$  and $f_2'''<0$, then $f_1'$ is convex and $-f_2'$ is also convex.
$f_1' - f_2'$ will have at most two zeros (since sum of convex is convex) and hence at most two critical points of $f_1 -f_2$.
The humps and dips will go away in this case.

A: If I understand your question correctly, nothing prevents $f'_2$ from being larger than  $f'_1$ as many times as you like, for example, qualitatively

Here, $f'_2$ and  $f'_1$ are plotted. If you'd like to make $f_1$, $f_2$ bounded, increase $y$-values on this plot by, say, 20 and set $f'_2(x)$ and  $f'_1(x)$ to $0$ for $x \ge 20$
EDIT:
more precisely,
 $f'_1(x) = 21.9 - x$  and
 $f'_2(x) = 21 - x + \sin x$ , for $x \le 20$, and both are $0$ for $x > 20$.


text:
Q: c++ random number from 1 to 8 digits I'm trying to generate a random from 1 - 99,999,999
However, its not ever getting that high. I believe it has something to do with the size of an int.
Here is what I'm trying
(1 + rand() % 99999999)

Thanks

A: your code will not work because value returned by rand have a maximum value RAND_MAX

int rand (void);
Generate random number
Returns a pseudo-random integral number in the range between 0 and
RAND_MAX.

RAND_MAX
Maximum value returned by rand This macro expands to an
integral constant expression whose value is the maximum value returned
by the rand function.
This value is library-dependent, but is guaranteed to be at least
32767 on any standard library implementation.

A: To generate a random number between min and max, and they should be long data type use:
long randamNum = rand()%(max-min + 1) + min;

(Includes max and min)

For more clearity refer Generating random integer from a range


text:
Q: Which positive whole number below 100 has the most number of factors? Is there a mathematical function that can be done without a computer that accurately outputs the number of factors a number has, then solve this problem?
Or is there a direct way to do so?

A: This question adresses the question about a mathematical function which outputs the number of factors. The numbers under 100 with most factors are $60=2^2\cdot3\cdot5$, $84=2^2\cdot3\cdot7$, $96=2^5\cdot3$ and $72=2^3\cdot3^2$, which all have 12 factors.
The numbers which have more factors than any smaller number are called highly composite numbers, more info here


text:
Q: python find a double quoted specific string I have a block of HTML and I want to do the following.
if html.find('pid":"') != -1:
  # do something

and it always returns -1.
BUT 'pid":'  (only one dbl quote works, but finds the wrong tag)

A: It seems that I was looking at the request.content, but searching on the request.text.  And the text I was looking for was eliminated in the request.text version.


text:
Q: objective c singleton return nil I have singleton to use websocket connection, when _srWebSocket = nil, will returned new _srWebSocket, but when _srWebSocket connected, will returned nil
@interface SocketManager : NSObject

@property (nonatomic, weak) SRWebSocket *srWebSocket;

+ (SocketManager *) sharedInstance;

@end

@implementation SocketManager

@synthesize srWebSocket = _srWebSocket;

+ (SocketManager *) sharedInstance {
    static SocketManager *sharedInstance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedInstance = [[SocketManager alloc] init];
    });
    return sharedInstance;
}
- (id)init {
    if (self = [super init]) {
        NSLog(@"In SocketKeeperSingleton init");
    }
    return self;
}
- (SRWebSocket *) srWebSocket {
    if (!_srWebSocket || _srWebSocket.readyState == SR_CLOSED) {
        _srWebSocket = [[SRWebSocket alloc] initWithURL:[NSURL URLWithString:@"wss://...:8000"]];
        [_srWebSocket open];
    }
    return _srWebSocket;
}

@end
Call singleton
srWebSocket = [SocketManager sharedInstance].srWebSocket;

A: because you have write 'static SocketManager *sharedInstance = nil;' in shareInstance Method .
when this method call every time they send nil .
 + (SocketManager *) sharedInstance {
static SocketManager *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
    sharedInstance = [[SocketManager alloc] init];
});
return sharedInstance;

}
write down this line outside shareInstance method "static SocketManager *sharedInstance = nil;"

A: You are missing srWebSocket method call,
First way,
Declare one method in singleton.h file
-(void) doInitialSetupOnLaunch;

Add this method somewhere in your singleton.m file,
-(void) doInitialSetupOnLaunch {
   //Put your initialized code i mean you can call your method from here & define your properties here.

 _srWebSocket = [self srWebSocket];
}

- (SRWebSocket *) srWebSocket {
    if (!_srWebSocket || _srWebSocket.readyState == SR_CLOSED) {
        _srWebSocket = [[SRWebSocket alloc] initWithURL:[NSURL URLWithString:@"wss://...:8000"]];
        [_srWebSocket open];
    }
    return _srWebSocket;
}

Call it from somewhere,best way you can call from appDelegate.m
Now you are ready to access it by property,
Call singleton
srWebSocket = [SocketManager sharedInstance].srWebSocket;

Or Second way
SRWebSocket * srWebSocket = [[SocketManager sharedInstance] srWebSocket];


text:
Q: SetValue breaking subsequent updates from source I'm having a problem with a piece of code that's starting to drive me out of my mind.  I have a base class in WPF with a declared DependencyProperty:
public partial class AudioTimeControlBase : UserControl
{
    public static readonly DependencyProperty PlaybackPositionProperty = DependencyProperty.RegisterAttached(
        "PlaybackPosition", typeof(TimeSpan), typeof(AudioTimeControlBase),
        new FrameworkPropertyMetadata(TimeSpan.Zero,
            FrameworkPropertyMetadataOptions.Inherits |
            FrameworkPropertyMetadataOptions.AffectsRender |
            FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
            OnPlaybackPositionChanged, CoercePlaybackPosition));

    public TimeSpan PlaybackPosition
    {
        get { return (TimeSpan)this.GetValue(PlaybackPositionProperty); }
        set { this.SetValue(PlaybackPositionProperty, value); }
    }

    private static void OnPlaybackPositionChanged(object sender, DependencyPropertyChangedEventArgs e)
    {
        AudioTimeControlBase control = sender as AudioTimeControlBase;
        if (control != null)
            control.OnPlaybackPositionChanged(e);
    }

    protected virtual void OnPlaybackPositionChanged(DependencyPropertyChangedEventArgs e)
    {
    }

    private static object CoercePlaybackPosition(DependencyObject d, object value)
    {
        TimeSpan t = (TimeSpan)value;
        if(t < TimeSpan.Zero)
            return TimeSpan.Zero;
        return t;
    }

}

Then a derived control:
public partial class WaveViewerControl : AudioTimeControlBase
{
    public WaveViewerControl()
    {
        InitializeComponent();
    }

    void playbackControl_PositionChanged(object sender, EventArgs e)
    {
        PlaybackPosition = ConvertFromPosition(playbackControl.Position);
    }
 }

I've taken out a fair amount of stuff but I really think I've isolated the offending bits to this.  The problem is that when playbackControl_PositionChanged happens (as a result of user action), it breaks the (previously working) binding to the PlaybackPositionProperty and the control receives no subsequent updates.  If anyone has any thoughts or leads at all I would be eternally grateful.  Thanks!
UPDATE: I realize I left some potentially critical information out of this - this control is not being directly represented in my XMAL but is being programmatically added to a parent control.  However, per the "Inhert" option, the bindings of that parent are being correctly inherited.  It's not until the SetValue call that they are apparently overridden.  Does this suggest that two-way binding is not supported by inherited properties?

A: According to WPF Unleashed, setting a value directly removes the binding. (page 261) so what you have described is by design.

A: If you call SetValue on a property that is set to a binding expression that is not two-way or one-way to source, then it will replace the binding expression with the new value.  You have PlaybackPositionProperty set to bind two-way by default, but the Binding could still be manually set to Mode=OneWay.
Check the XAML where WaveViewerControl is being used, and see whether the binding on PlaybackPosition has Mode=OneWay.  You can also check the binding at run-time by calling BindingOperations.GetBinding(this, PlaybackPositionProperty).Mode in your event handler.

Based on your update, yes, that is correct behavior.  You cannot update a two-way binding expression that is set by property value inheritance.  You are setting a local value, which will override the inherited value.  See Dependency Property Value Precedence.


text:
Q: How Does One Connect to an Amazon EC2 Ubuntu Instance from Windows 7? I would like to use VNC or similar to connect to my Ubuntu 11.10 EC2 instance similar to the way one logs into a windows server using remote desktop and while I've installed Xorg, I've not been able to get anything working to hook into my server.
How do I go about accessing the server that way?

A: Client-side, I use Xming and the X2Go client.  These are very easy to set up.
Server side, I installed NX / FreeNX.  One could go with a VNC server or many other options, but I found that FreeNX seemed to work better for my needs and the server-side desktop UI just seemed snappier for me.
I've used most systems out there, and don't have a long-standing preference.  Still, a word of advice: it's best to learn how to set these up via a script, and save your script in case you want to re-generate your AMI.  The various configuration contortions you may go through are not worth re-learning should you decide to produce a new AMI from scratch.
It's good to learn your options for client and server side software and tinker with each one at a time.  I started several cheap spot instances while finding which setup worked best for me.

A: You need to install a VNC server on top of X. There are numerous servers packaged for ubuntu, try apt-cache search vnc.
I find x11vnc (apt-get install x11vnc as root) pretty much self explanatory. Works fine with the tightvnc windows client.
On ec2 you'll need to make sure the requisite ports are unblocked in the firewall, but x11vnc will tell you which ones it needs.


text:
Q: DateTimeControl blank in asp form I have a sharepoint DateTimeControl in an asp form, the dropdown boxes are not displaying any values however.
 <td class="ms-formbody">
    <SharePoint:DateTimeControl ID="dateTimeCurfewIn" runat="server" TimeOnly="true" HoursMode24="true"/>
 </td>

Is there something special I need to add to this to get the time to display in the dropdown boxes?

A: Your example works. Maybe try to add
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

if you didn't it before. Here DateTimeControl Control is full the control properties description.
Good luck.

A: Here is a common method for this, hope it will help someone with the same issue.
/// <summary>
/// Get common SP DateTimeControl with current DateOnly settings and MethodToProcessDateChanged
/// </summary>
public static DateTimeControl Cd(this bool DateOnly, bool AutoPostBack = false,
DateTime? SelectedDate = null, Func<bool> MethodToProcessDateChanged = null)
{
     var d = new DateTimeControl();
     d.DateOnly = DateOnly;
     d.AutoPostBack = AutoPostBack;
     if (SelectedDate != null)
     d.SelectedDate = SelectedDate.Value;
     if (MethodToProcessDateChanged != null)
          d.DateChanged += (o, e) => { MethodToProcessDateChanged();};
     return d;
}

See more details here


text:
Q: Set alarm in same file For some reason I would like to have an AlarmManager to call a broadcast receiver in the same code file so I did something like this:
AlarmManager oAlarmManager;
PendingIntent oPendingIntentAlarm;

Intent intentAlarm = new Intent(this, clsMyReceiver.class);
oPendingIntentAlarm = PendingIntent.getBroadcast(this, 0, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT);
oAlarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
oAlarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()+5000, oPendingIntentAlarm); //Execute in 5 seconds for testing

Then, in this same file I have:
public class clsMyReceiver extends BroadcastReceiver
{
   @Override public void onReceive(Context context, Intent intent)
   {  //This is never reached
   }
}

I have declared it in the Manifest like this:
<receiver
    android:name=".clsMyReceiver"
    android:process=":remote" >
</receiver>

But as I said, the OnReceive in the broadcast is never triggered. Any suggestion?


text:
Q: Snakemake best practice for demultiplexing I have a question about best practices. Specifically, about the best snakemake pattern for demultiplexing reads from illumina sequencing. Our workflow needs to demultiplex multiple lanes of sequencing, and then combine these in a single analysis. Obviously, we know lane and sample names, however sample names are not the same across lanes. With only one lane, one can do something like:
SAMPLES = [...]
rule demux:
    input:
        reads="lanes/lanename.fastq.gz",
        key="keys/lanename.txt"
    output:
        reads=expand("reads/{sample}.fastq.gz", sample=SAMPLES)
    ...

However with multiple lanes, I'm stuck wanting to use a function as an output rule. How would the following translate to something possible:
LANES = {
    "lane1": ["S1", "S2"],
    "lane2": ["S3", "S4"],
    "lane3": ["S5", "S6"],
}

rule demux:
    input:
        reads="lanes/{lane}.fastq.gz",
        key="keys/{lane}.txt"
    output:
        reads=lambda wc: expand("reads/{sample}.fastq.gz", sample=LANES[wc.lane])
...

Forgive me if this has be answered previously, or if there is some obvious approach I'm missing.
Cheers,
Kevin

A: I realise this is an old question, but I had the same problem, and came up with the following solution: Split the demux rule into two. The first creates a temporary directory which holds the demultiplexed reads, and then the second moves a single readset from that directory.
Here's a relatively minimal example:
LANES = {
    "lane1": ["S1", "S2"],
    "lane2": ["S3", "S4"],
    "lane3": ["S5", "S6"],
}

SAMPLES = {}
for lane, samples in LANES.items():
    for sample in samples:
        SAMPLES[sample] = lane

rule all:
    input:
        expand("reads/{sample}.fastq.gz", sample=SAMPLES.keys())

rule get_reads:
    output:
        reads="lanes/{lane}.fastq.gz",
        key="keys/{lane}.txt",
    shell:
        "touch {output}"

rule demux:
    input:
        reads="lanes/{lane}.fastq.gz",
        key="keys/{lane}.txt",
    output:
        directory(temp("demux_tmp_{lane}"))
    params:
        f=lambda w: expand("{sample}.fastq.gz", sample=LANES[w.lane]),
    shell:
        "mkdir -p {output} ; cd {output} ; touch {params.f}"

rule demux_files:
    input:
        lambda w: f"demux_tmp_{SAMPLES[w.sample]}",
    output:
        "reads/{sample}.fastq.gz"
    shell:
        "mv {input}/{wildcards.sample}.fastq.gz {output}"


text:
Q: Combining tikzexternalize with tikzscale and trim axis Attempting to build the following results in pdflatex hanging and building the file over and over again forever:
% !TEX options=--shell-escape
\documentclass{article}
\usepackage[english]{babel}
\usepackage{pgfplots}
\usepackage{tikzscale}
\usepgfplotslibrary{external}
% \tikzexternalize  % !!! B
\pgfplotsset{compat=1.16}

\begin{document}
\begin{filecontents}[overwrite]{tex-stackexchange.tikz}
\begin{tikzpicture}
[trim axis left, trim axis right]  % !!! A
\begin{axis}[
  width=\textwidth,
  height=0.25\textwidth,
  xmin=0, xmax=5, ymin=0, ymax=5]
\addplot coordinates { (1,1) (2,3) (3,2) (4.5,4) };
\end{axis}
\end{tikzpicture}
\end{filecontents}

\begin{figure}
\includegraphics[width=\textwidth]{tex-stackexchange.tikz}
\end{figure}

This is a lot of text. This is a lot of text. This is a lot of text.
This is a lot of text. This is a lot of text. This is a lot of text.
This is a lot of text. This is a lot of text. This is a lot of text.

\end{document}

Commenting out the line marked !!! A makes everything render correctly, but without externalization:

Commenting out the line marked !!! B makes the externalization appear to work, but the plot is now the wrong width.
Commenting out neither results in pdflatex hanging.

This question may seem related, but it:

*

*Is asking for behavior that is obtained by not using trim axis

*Did not get an answer about externalize, which was in the title

A: According to what I find you only need to use the mode=list and make option. Of course, you also need to execute the make file, the prompt will tell you what to do on your machine (hopefully;-).
\documentclass{article}
\usepackage[english]{babel}
\usepackage{pgfplots}
\usepackage{tikzscale}
\usepgfplotslibrary{external}
\tikzexternalize[mode=list and make]  % !!! B
\pgfplotsset{compat=1.16}

\begin{document}
\begin{filecontents}[overwrite]{tex-stackexchange.tikz}
\begin{tikzpicture}
[trim axis left, trim axis right]  % !!! A
\begin{axis}[
  width=\textwidth,
  height=0.25\textwidth,
  xmin=0, xmax=5, ymin=0, ymax=5]
\addplot coordinates { (1,1) (2,3) (3,2) (4.5,4) };
\end{axis}
\end{tikzpicture}
\end{filecontents}

\begin{figure}
\includegraphics[width=\textwidth]{tex-stackexchange.tikz}
\end{figure}

This is a lot of text. This is a lot of text. This is a lot of text.
This is a lot of text. This is a lot of text. This is a lot of text.
This is a lot of text. This is a lot of text. This is a lot of text.

\end{document}


text:
Q: changing the dark mode color in chakra ui I am using the "dark mode" feature provided by the Chakra UI library. However, I can't figure out how to change the "dark mode" colors. In the documentation, I see that Chakra UI is based on something called "styled-system", so I tried to pass a new theme to themeProvider like this:
const theme = {
  ...defaultTheme,
  modes: {
    dark: {
      background: '#000',
    },
  },
};

 <ThemeProvider theme={theme}></ThemeProvider>

However, that didn't work. I also tried to wrap the modes object with a colors object, but that didn't work either. How can I customize the "dark mode" colors?

A: in the latest version of chakra ui we can overwrite colors this way
import { mode } from '@chakra-ui/theme-tools';
import { extendTheme } from '@chakra-ui/core';

const styles = {
  global: props => ({
    body: {
      color: mode('gray.800', 'whiteAlpha.900')(props),
      bg: mode('gray.100', '#141214')(props),
    },
  }),
};

const components = {
  Drawer: {
    // setup light/dark mode component defaults
    baseStyle: props => ({
      dialog: {
        bg: mode('white', '#141214')(props),
      },
    }),
  },
};

const theme = extendTheme({
  components,
  styles,
});

export default theme;

then we pass the theme into ChakraProvider

A: As doc say (and it actually works), you also need to wrap your component with another ColorModeProvider.
 <ThemeProvider theme={customTheme}>
      <ColorModeProvider><YourCompoent/></ColorModeProvider>
 </ThemeProvider>

And use the hook called useColorMode inside your component (or nested if you wish) to get current color mode and toggle between.
const { colorMode, toggleColorMode } = useColorMode();

A: Just in case you want to override only the dark mode background without affecting the default value of the light mode you can retrieve the theme props like the following:
import type { StyleFunctionProps } from '@chakra-ui/styled-system';
import { mode } from '@chakra-ui/theme-tools';

const styles = {
  global: (props: StyleFunctionProps) => ({
    body: {
      // sets a custom bg color for dark mode only
      bg: mode(
        // light mode value retrieved from theme
        props.theme.semanticTokens.colors['chakra-body-bg']._light,
        // your custom value for dark mode
        '#252C32',
      )(props),
    },
  }),
};


text:
Q: MySQL/InnoDB result set limited to 1000 records? I'm loading a RDB with dummy data to practice query optimization. MySQL Workbench executed 10,000 INSERTs without returning an error into my customers table. Yet, when I SELECT * from that table I am only getting back exactly 1000 records in the result set. I am using InnoDB as my table engine
According to this link I should have unlimited records available and a 64TB overall sizelimit.. Im inserting 10,000 records with 4 VARCHAR(255)columns and 2 BOOLEAN columns each and I don't think that tops 1 TB. Am I wrong in this assumption?
Is the result grid limited to 1000 records? Is there an alternative to InnoDB which supports foreign keys? Is the problem that VARCHAR(255) is way too large and I need to reduce to something like VARCHAR(50)? What am I not understanding.
THANK YOU IN ADVANCE

A: No, it is not limited to 1000 records. I have InnoDB complex tables of more than 50 million records with blobs and multiple indexes. InnoDB is perfectly fine, you don't have to look for another engine. Could you be more precise about the context where you executed the query? Was it from a programming language? command line mysql client? Another Mysql client?

A: Many database query tools limit the number of rows returned. Try selecting some data from a high row number to see if your data is there (it should be).

A: In the query editor toolbar there's a drop down where you can limit the number of records you want to have returned. Default is 1000, but you can change that in a wide range, including no limitation.

A: I thought this would be useful for future reference:
In Microsoft SQL Server Management Studio, under Tools->Options->SQL Server Object Explorer->Value for Select Top <n> Rows Command change the number of rows returned:


text:
Q: Event Handler in c# language class Plane
{
    public event EventHandler Land;

    protected void OnLand()
    {
        if ( null != Land )
        {
            Land( this, null );
        }
    }
}

it is event handler best practice to do instead:
EventHandler temp = Land;
if ( null != temp )
{
    temp( this, null );
}

Is that truly necessary? In what case could temp be different from Land?

A: In the case of multi-threaded access, I believe.  If you don't cache the reference, another thread can null it out after your guard but before you fire.

A: If you have concurrency with many threads modifying Land.

A: When in between the test and the raise the last handler is removed from the list by an other thread.
the invokation list of the event will be copied when it changes and the temp reference will still hold the original list.
See: C# Events and Thread Safety


text:
Q: Passing something to main app.js file in React/Redux Is ther a any way to pass redux state  to  main app.js file in react/redux? I wan't to change classname based on redux state. I tried to combine even with local storage but still can't make a satisfying solution.
This is my main app.js file
class App extends Component {

    render() {
        return (

            <Provider store={store}>
                <Router>

                        <Navbar/>
                        <Switch>
                            <Route component={UserIsAuthenticated(MainProfile)} exact path="/profile"/>
                            <Route component={UserIsAuthenticated(MyDiet)} exact path="/diet"/>
                            <Route component={UserIsAuthenticated(AllDiets)} exact path="/alldiets"/>
                            <Route component={UserIsAuthenticated(EditProfile)} exact path="/editprofile"/>
                            <Route component={UserIsAuthenticated(WorkoutPlan)} exact path="/workout"/>
                            <Route component={UserIsNotAuthenticated(Login)} exact path="/login"/>
                            <Route component={UserIsAuthenticated(EditDiet)} exact path="/edit/:id"/>
                            <Route component={UserIsAuthenticated(EditDiet)} exact path="/edit/:id"/>
                            {/*<Route component={UserIsAuthenticated(UsersDiet)} exact path="/usersdiet"/>*/}
                        </Switch>

                </Router>
            </Provider>
        )
    }
}

export default (App)

A: You're already using store using provider in the app. So, you can use:
store.getState().redux_state_name

A: If you need the redux state in the component that is wrapped in your Provider then you might consider moving the Provider component to where you initially render your React.
entry.jsx
const store = createStore(...);

ReactDOM.render(
    <Router>
      <Provider store={store}>
        <App/>
      </Provider>
    </Router>,
    document.getElementById('root')
);

app.jsx
class App extends Component {

    render() {
        return (
            <div className={`${this.state.someData ? 'someClassA' : 'someClassB'}`} >
                <Navbar/>
                <Switch>
                    <Route>'s...
                </Switch>

        );
    }
}

const mapStateToProps = state => {
  return {
    someData: state.foo
  }
}

export default connect(
    mapStateToProps,
    null
)(App)