text:
Q: Tautology and Redundancy difference My text says that :
Redundancy refers to information that is expressed more than once.
Ex:Forever and ever, past history
Tautology refers to phrases that repeats a meaning with different though semantically similar words.
Ex: Free gift
I really can't understand the difference. Is there even any? Are they both the same?

A: The word tautology has several different senses, depending upon its field of use.
A grammatical tautology is little different from redundancy. It just means that the same thing is repeated twice using different words.
Rhetorical and logical tautologies are more interesting.
A logical tautology is a proposition that is true given any possible variables.
A rhetorical tautology is a statement that is logically irrefutable. This can be by repetition, but in its more nuanced form it is done by stating things in such a way that it fails to make a point, while obscuring this fact in the language which is used.
So, for example:

"Either we will live or we will die."

There is no repetition in this statement, but it is nevertheless a rhetorical tautology.
Rhetorical tautologies are meant to sound profound, but they add nothing to a conversation because they literally make no point.

A: Tautology is redundancies within phrases. Redundancy is any kind of repetition: phrases, sentences, paragraphs, entire books, it's all the same; the scale isn't important.

A: A tautology refers to phrasing that repeats a single meaning in identical words:

They followed each other one after the other in succession.

Succession means one after the other.
Redundancy refers to multiple phrasings that are no more meaningful together than one of the phrasings by itself.  My favorite is the legalism found in contracts and trusts that empowers someone to take action

at any time and from time to time

These are two different things:  "At any time" means without temporal restriction, and "from time to time" means sporadically.  But they're redundant because if you may do one, then you may do the other.
Note that redundancy is bad style when it appears in a definitional sense like the "succession" example.  Grammatical tautology falls into this category.  Other redundant language is acceptable for emphatic rhetorical effect:

I am completely, thoroughly, and totally angry with you.

or to make a subtle semantic point -- a free gift is one comes without obligation as opposed to those other things that people call gifts, but which come with strings attached.

A: The OED gives several different senses for tautology. Some of them confirm the points that have already been made in answer to this post, where the same thing is stated more than once using synonymous words and expressions.
However the OED sense which has most resonance with my understanding of the term is meaning 4:

*An argument, explanation, or definition that merely restates in different words the very thing which is to be explained, shown, or
  defined; a failure fully to separate cause from effect in explaining
  an event, phenomenon, etc.

  1997   J. D. Moore Visions of Culture xiii. 178   'I am taller than
  other people because most people are shorter than I am' is a
  tautology.

I am not saying other uses of tautology are wrong, indeed the OED supports them. But for my own part tautology infers an attempted explanation which is no explanation at all, simply a synonymous expression. For other senses of tautology, I would personally tend to use redundancy, or synonymous.

A: All of the above answers say most of what needs to be said. I'll just contribute a small etymological note:
tautology comes from the Greek word tautalogos, a contraction of to auton (the same thing) and  logos (word, speech, reason, argument).
redundancy comes from the Latin verb redundare, which means to overflow or to be abundant. This is a simpler word, I think; one that connotes mere repetition rather than logical fallacy (which is what a tautology is).

A: The law for some reason has more than its share of redundant terminology - law and order, cease and desist, null and void, without let or hindrance, and many more.
Apart from grammar and syntax, tautology is also concerned with logical (or illogical) formulations where things are said unnecessarily, because they could not be any other way, and they're far more common in both creative writing and journalism than one might think:

*

*Before she died, my grandmother used to walk to the shops every day.

*When the plane came to a stop, we disembarked.

*It's raining outside.

*The accident happened at 2:00 am this morning.

*Annual Fees are to be paid in four quarterly instalments.

If you start looking, you see and hear them everywhere.

A: I consider redundancies to be the use of an extra word, whereas tautologies are the statements which equate that which is already equal: "I drew a round circle" as opposed to "My circle was round." In the first, "round" is redundant, but at least the sentence tells us one fact, that I drew it, so the sentence was not a compleat waste of time. In the second, no information is given at all.


text:
Q: scope of expressions and variables in Julia macro in modules For some reason, I had to put quote...end block in the macro and ex is generated programmatically. This code works.
macro addsum_out()
  quote
    ex = :(x+y)
    sum(eval(ex))
  end
end

x = [1 1 1]
y = [2 2 2]

z2 = @addsum_out

When the macro is put inside a module, it no longer works:
module MyModule

export @addsum

macro addsum()
  quote
    ex = :(x+y)
    sum(eval(ex))
  end
end

end

using MyModule
x = [1 1 1]
y = [2 2 2]
z = @addsum

It says:
ERROR: LoadError: UndefVarError: x not defined

I think I should put esc somewhere, to evaluate the expression ex in the main scope outside the module. What should I handle this?

A: The problem here is that a macro (inside a module) referencing x will look for x in that module, e.g. MyModule.x
This is part of macro hygiene.
To prevent macro hygiene from happening, you need to esc(x) -- that means it will use whatever x is in-scope at the call-site.
Your complete solution might look like:
macro addsum_out()
  quote
    esc(x) + esc(y)
  end
end

or more concisely:
macro addsum_out()
  :(  esc(x) + esc(y)  )
end

Note that this is slightly different from doing esc( :(x+y) ) which would be a escaping the + function also. i.e. the module containing this macro might contain an overload for +, and if you want to use this then don't escape the +, otherwise do!
There is a little discussion about this subject in a guide I put together:
https://github.com/p-i-/MetaGuideJulia/wiki#example-swap-macro-to-illustrate-esc

redpajama_set_name: RedPajamaStackExchange


text:
Q: A question on Terence Tao's representation of Peano Axioms While reading Terence Tao's book on Analysis I had some questions regarding the implication  of the Peano Axioms.
After writing the following four axioms (which I will write without changing their original numbering),

Axiom 2.1
$0$ is a natural number.
Axiom 2.2
If $n$ is a natural number then $n{+\!+}$ is also a natural number. (Here $n{+\!+}$ denotes the successor of $n$ and previously in the book the notational implication has been bijected to the familiar $1, 2\ldots$).
Axiom 2.3
$0$ is not the successor of natural number; i.e. we have $n{+\!+}\neq 0$ for every natural number $n$.
Axiom 2.4
Different natural numbers must have different successors; i.e., if $n, m$ are natural numbers and $n\neq m$, then $n{+\!+}\neq m{+\!+}$.

Now let me quote the portion of the text from which my question arises,

"As one can see from this proposition, it now looks like we can keep all of the natural numbers distinct from each other. There is however still one more problem: while the axioms (particularly Axioms $2.1$ and $2.2$) allow us to confirm that $0,1,2,3,\ldots$ are distinct elements of $\mathbb{N}$, there is the problem that there may be other
  "$\color{red}{\text{rogue}}$" elements in our number system which are not of this form:...
...What we want is some axiom which says that the only numbers in $\mathbb{N}$ are those which can be obtained from $0$ and the increment operation - in order to exclude elements such as $0.5$. But it is difficult to quantify what we mean by "can be obtained from"
  without already using the natural numbers, which we are trying to define. Fortunately, there is an ingenious solution to try to capture this fact:

Axiom 2.5
Let $P(n)$ be any property pertaining to a natural number $n$. Suppose that $P(0)$
    is true, and suppose that whenever $P(n)$ is true, $P(n{+\!+})$ is also
    true. Then $P(n)$ is true for every natural number $n$.

The informal intuition behind this axiom is the following. Suppose $P(n)$ is such that $P(0)$ is true, and such that whenever $P(n)$ is true, then $P(n{+\!+})$ is true. Then since $P(0)$ is true, $P(0{+\!+}) = P(1)$ is true. Since $P(1)$ is true, $P(1{+\!+}) = P(2)$ is
  true. Repeating this indefinitely, we see that $P(0), P(1), P(2), P(3),$ etc. are all true- however this line of reasoning will never let us conclude that $P(0.5)$, for instance, is true. $\color{blue}{\text{Thus Axiom 2.5 should not hold for number systems which contain}}$ "$\color{blue}{\text {unnecessary}}$"$\color{blue}{\text {elements such as $0.5$.}}$

My questions are precisely regarding the colored statements.

*

*How can we assume the existence of "$\color{red}{\text{rogue}}$" elements in our number system? To be precise, how can one who doesn't know anything about the number system and the numbers try to convince himself of the existence of such elements?

*Which $P(n)$ only holds for the natural numbers? In other words, how the addition of the fifth axiom resolves the problem of the rogue elements?

Added:-
After reading the various answers below, I think that I should elaborate why the answers below doesn't completely satisfy me.
What KSmarts said in response to my first question seems circular to me. To quote from his answer,

Suppose that in addition to the expected natural numbers $0,1,2,$ etc $\color{green}{\color{green}{\text{there are numbers}}\  a,b, \color{green}{\text{and}}\ c  \ \color{green}{\text{so that}}\ a{+\!+}=b, b{+\!+}=c,\  \color{green}{\text{and}}\ c{+\!+}=a}$. This does not contradict any of the first four axioms, so it is a valid construction under those axioms. However, it does not correspond to what we expect of the natural numbers, so there is another axiom to restrict this construction.

The colored portion is the reason for which I think that the answer is circular. Precisely my question is that how do we convince someone the existence of those $a,b,c$'s who doesn't know anything about the numbers?
Hurkyl raised a good point which tries to resolve the above question,

For your first question, it's not that we assume that rogue elements exist, it's that we cannot assume they do not exist. If we wish that they do not exist, we must choose a definition that allows us to prove it.

"...it's that we cannot assume they do not exist." Exactly! But in my view we can choose a definition to "prove" that such rogue elements don't $\color{darkviolet}{\text{only when}}$ we know the properties of those elements. For then we can "construct" the definition in a way which excludes the possibility of such rogue elements.
So,

How can we know the properties that only belongs to the rogue elements, unless we have a proper idea of the nature of those rogue elements?

And it's precisely in the light of this question that my second question naturally arises. If we know the properties of the rogue elements, then we can define the property $P$ to be the "complement" of the properties which satisfy question my last question.

A: For your first question, it's not that we assume that rogue elements exist, it's that we cannot assume they do not exist. If we wish that they do not exist, we must choose a definition that allows us to prove it.
Regarding your second question, in the language of Peano arithmetic, everything is a natural number. Thus, the only questions we can ask in the language of Peano arithmetic are questions about natural numbers.
If we could mathematically express the idea that a natural number "can be constructed by starting with $0$ and iterating ${+\!+}$", then we could make the following proof:

*

*$0$ "can be constructed by starting with $0$ and iterating ${+\!+}$"

*Suppose that $n$ "can be constructed by starting with $0$ and iterating ${+\!+}$":

*

*Take such a construction

*Apply ${+\!+}$ to it

*Therefore $n+1$ "can be constructed by starting with $0$ and iterating ${+\!+}$":

*Since we've proven the base case and the inductive hypothesis, we know that all natural numbers "can be constructed by starting with $0$ and iterating ${+\!+}$".

I'm going to again answer something slightly different than what you asked. Set theory has a nice trick for this situation: rather than figure out what the rogue elements look like and try to exclude them, you instead figure out how to pick out just the things you want. Suppose you had some model of axioms 2.1 through 2.4 that contained rogue elements. There should be some subset that is also a model of axioms 2.1 through 2.4, but doesn't contain any rogue elements.
However, there there might be many subsets that are models: how do we find the one that we want? Well, the one that we want contains only the numbers that 'must' exist, so it should be the smallest subset that is still a model of axioms 2.1 through 2.4!
So, if we were defining properties of sets rather than formal theories, we would complete the definition with

2.5a. There does not exist a proper subset of the subset natural numbers that satisfies axioms 2.1 through 2.4

Now, this trick generally works best with constructions rather than properties; in this example, the natural numbers are "constructed" out of the constant $0$ and the operator ${+\!+}$. All of the numbers we actually want are things that are specific things that are required to exist, rather than requesting the existence of something with a property.
Putting the emphasis on this, the set theoretic version would be phrased as

2.5b. There does not exist a proper subset of the natural numbers that contains 0 and is closed under ${+\!+}$

Now, we can recover the principle of mathematical induction by using the correspondence between sets and predicates: rather than thinking about a subset $S$ of the natural numbers and which numbers are elements of $S$, we think of a unary predicate $P$ on the natural numbers and which numbers satisfy $P$. Rephrasing in this language

2.5c. Except for the always true predicate, there does not exist a unary predicate $P$ on the natural numbers such that $P(0)$ is true and that $P(n{+\!+})$ is true whenever $P(n)$ is.

This is pretty much the same thing as the axiom 2.5 that you wrote.

A: The point of "excluding" rogue numbers is that there are larger number systems beyond the natural numbers, in which facts that we know about natural numbers no longer hold.
For example, consider the non-negative real numbers with the usual operations of addition and multiplication, and with "successor" interpreted as $x \scriptsize{+\!+}\normalsize = x+1$, consistent with how we treat the natural numbers.  Then your first four axioms are true in this enlarged model, but there are properties of the natural numbers that can be proven by induction (the fifth axiom) that fail in this enlarged model.
For example, there are no natural numbers $n$ such that $n^2 = 2$ (which we could prove by induction), but there is a non-negative real number $x$ such that $x^2 = 2$.  A better example, in the sense of immediate tie to axioms, is the proposition that $0$ is the only number which is not a successor (third axiom).  The proof by induction is straightforward (since apart from base case $n=0$ we only deal with successor elements), but this fails in the enlarged model (there are an infinite number of positive real numbers in $(0,1)$, which are not successors in the defined sense, being one plus a non-negative real number).
If we knew in any concise way the answer to the second part of this Question, "Which $P(n)$ only holds for the natural numbers?", then we would know a great deal more than we do now.  In fact the undecidability of theorems of the Peano axioms means that no finite decision procedure can be given for this part of the Question (unless the Peano axioms are inconsistent, unbeknownst to us).

A: The important thing for your question 1 is whether we want to prove that rogue elements exist or we want to prove that they do not.  We believe we cannot prove that rogue elements exist, because we believe that $\Bbb N$ without rogue elements is a model for the Peano axioms. (We can't prove that within PA, but that is not your question).  We can also show that we cannot prove that rogue elements do not exist by showing that the PA axioms (unless they are inconsistent), including the fifth axiom, have a model with rogue elements.  It is hard to "get a handle" on the rogue elements. They are all greater than all the standard elements, so any property that applies to all sufficiently large numbers applies to all of them.  Any property that applies to infinitely many numbers applies to some of them.  I found a good discussion in "The Incompleteness Phenomenon" by Goldstern and Judah.

A: Part 1
You can't necessarily assume that these rogue numbers exist, however, under the first four axioms, you can't say definitively that they don't exist, which is really the point.
Suppose that in addition to the expected natural numbers $0,1,2,$ etc., there are numbers $a,b,$ and $c$ so that $a{+\!+}=b,\ b{+\!+}=c,$ and $c{+\!+}=a$. This does not contradict any of the first four axioms, so it is a valid construction under those axioms. However, it does not correspond to what we expect of the natural numbers, so there is another axiom to restrict this construction.
Part 2
The property $P(n)$ is arbitrary, it does not need to be specifically defined for the purposes of the axiom. Informally, the fifth axiom states that induction works. Given a property $P(n)$, the two statements that $P(0)$ is true and if $P(n)$ is true, then $P(n{+\!+})$ is true are sufficient to show that $P(n)$ is true for all natural numbers $n$.
Put another way, this means that $0$ and all of its iterated successors make up all of the natural numbers. In the previous example, with $a,b,$ and $c$, there is no iterated successor of $0$, that is, no "regular" natural number $n$, where $n{+\!+}=a$. So, this construction is no longer valid with the axiom of induction.
Edit:
I chose a finite set of hypothetical numbers in Part 1 simply for convenience. What properties these objects have, and what their successors are, is irrelevant. All that matters is that they fit the first four axioms, in that everything in the set has a successor that is also in the set, nothing has a successor that is $0$, and no two distinct objects have the same successor. There are, in fact, infinitely many things that could be in this set, and no way to define them all. In addition to the problem of not being numbers that we "want," this also means that the natural numbers, as defined so far, are not uniquely defined up to isomorphism.
There is one other property that we know these rogue numbers have, and that is whatever we use to define them as "rogue". That is, while they are a valid part of the natural numbers that we have constructed so far, they aren't a part of the natural numbers that we want to construct. So the natural question (no pun intended) is what other property or properties do we want the natural numbers to have?
Naively, the natural numbers are the "counting" numbers. For any natural number $n$, if we start at zero and repeatedly take the successor, we would (theoretically) be able to get $n$, eventually. So, presumably, the rogue numbers are numbers that you can't "count" to. This is what the fifth axiom, the axiom of induction, deals with. If $P(0)$, and $P(n)\Rightarrow P(n+1)$, then you can show $P(1)$, $P(2)$, and so on for any number that you can count to from zero. The axiom states that this covers all of the natural numbers. Everything else is excluded. It doesn't matter if they are irrational numbers, Gaussian integers, letters, transfinite and infinitesimal surreals, or, as Kundor commented, wooly mammoths. If you can't count to it from zero, it isn't a natural number.

A: 1. The intuition behind the formulation of induction principle is that you can "prove" that a certain property $Q$ is not "a valid" property for the natural numbers. For instance, suppose we have the property $Q(n):=n\text{ have decimal part}$. Now, if we define $P(n):=\text{no } Q(n)=n\text{ have no decimal part}$. Thus, using induction, cleary $P(0)$ is true, and $P(n)\implies P(n\!+\!\!+)$ is true, for any natural number $n$. Hence, we conclude that every natural number have no decimal part. (Obviously the notions like $Q$ are no defined in that section, but this "proof" should give some idea how the induction principle exclude another "no-natural number objects".)
In conclusion, the induction principle says that every natural number either is zero or is the successor of another natural number (in brief, you can show by induction that every natural number is de predecessor of another natural number), i.e., for every natural number $n$ either $n=0$ or $n=m\!+\!\!+$ for some natural number $m$. So any other object is not a natural number.
2. Tao says it is a little vague what property $P$ means, but you can consider properties involving natural numbers like $$P(n):= n \text{ is a natural number such that}\dotsc$$
For example

*

*$n$ is odd,

*$n^{2^n}+f(n)>1$,

*$n$ solves $(n+x)^3=n^3+x^3+3nx(n+x)$, etc.

Thus there are no restrictions for $P$; but one can consider that $P$ treats about natural numbers.

A: The first four axioms describe a structure that would include an infinite, unbranching "chain" of elements starting at $0$, a structure I call the main sequence. It corresponds to the set of natural numbers. The first four axioms, however, cannot rule out the possibility that other elements in this structure may exist apart from this main sequence. There could be infinitely many such side structures -- either finite loops or infinite structures like the integers that go off to infinity in two directions. The fifth axiom explicitly denies the existence of any such side structures. It states, in effect, that there are no elements outside of the main sequence.
See graphical representations in "What is a number again?" (January 22, 2014) at my math blog.


text:
Q: Python: Error messages that can't resolve I am new to python. I am using python 3.x. I have tried to correct this code many times but I am getting few error messages. Can someone please help to correct me with the code?
import urllib.request as urllib2
#import urllib2
#import urllib2
import json

def printResults(data):
    #Use the json module to load the string data into a directory
    theJSON = json.loads(data)
    #Now we can access the contents of json like any other python object
    if "title" in theJSON["metadata"]:
        print (theJSON["metadata"]["title"])

def main():

    #Define the varible that hold the source of the Url
    urlData= "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.geojson"

    #Open url and read the data
    webUrl= urllib2.urlopen(urlData)
    #webUrl= urllib.urlopen(urldata)
    print (webUrl.getcode())
    if (webUrl.getcode() == 200):
        data= webUrl.read()
        #Print our our customized result
        printResults(data)
    else:
         print ("Received an error from the server, can't retrieve results  " + str(webUrl.getcode()))

if __name__== "__main__":
    main()

Here are the errors that I am getting:
Traceback (most recent call last):
  File "C:\Users\bm250199\workspace\test\JSON_Data.py", line 30, in <module>
    main()
  File "C:\Users\bm250199\workspace\test\JSON_Data.py", line 25, in main
    printResults(data)
  File "C:\Users\bm250199\workspace\test\JSON_Data.py", line 8, in printResults
    theJSON = json.loads(data)
  File "C:\Users\bm250199\AppData\Local\Programs\Python\Python35-32\lib\json\__init__.py", line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'

A: Just have to tell python to decode the bytes object it got into a string.
This can be done by using the decode function.
theJSON = json.loads(data.decode('utf-8'))

You could make the function more robust by adding an if condition like:
def printResults(data):
    if type(data) == bytes: # Convert to string using utf-8 if data given is bytes
        data = data.decode('utf-8')

    #Use the json module to load the string data into a directory
    theJSON = json.loads(data)
    #Now we can access the contents of json like any other python object
    if "title" in theJSON["metadata"]:
        print (theJSON["metadata"]["title"])


text:
Q: XML validation No matching global declaration available for the validation root I have an XML schema provided by Cisco for an IOS XE router. When running the command 'show ip access-list test | format' in the router's cli, it spits out an XML fragment that should validate against this schema. However it does not. Instead I get the error ": No matching global declaration available for the validation root"
Schema provided by Cisco extracted by running 'show xsd-format cli show ip access-lists' as recommended here http://www.cisco.com/c/en/us/td/docs/ios-xml/ios/xmlpi/command/xmlpi-cr-book/xmlpi-cr-p1.html#GUID-33CB3BAB-25B4-4FAD-9741-C7AFB483F701 is shown below:
<?xml version="1.0" encoding="UTF-8"?>
  <xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
    <xsd:complexType name="ShowAccesslists_def">
      <xsd:sequence>
        <xsd:element ref="SpecVersion" minOccurs="0" />
        <xsd:choice minOccurs="0" maxOccurs="unbounded">
          <xsd:element ref="Info" />
          <xsd:element name="Access-List" minOccurs="0" maxOccurs="1">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="Type" minOccurs="0" maxOccurs="1" type="xsd:string" />
                <xsd:element name="Name" minOccurs="0" maxOccurs="1" type="xsd:string" />
                <xsd:element name="DenyFilter" minOccurs="0" maxOccurs="1">
                  <xsd:complexType>
                    <xsd:sequence>
                      <xsd:element name="Filter" minOccurs="0" maxOccurs="1" type="xsd:string" />
                    </xsd:sequence>
                  </xsd:complexType>
                </xsd:element>
                <xsd:element name="PermitFilter" minOccurs="0" maxOccurs="1">
                  <xsd:complexType>
                    <xsd:sequence>
                      <xsd:element name="Filter" minOccurs="0" maxOccurs="1" type="xsd:string" />
                    </xsd:sequence>
                  </xsd:complexType>
                </xsd:element>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="SpecVersion" type="xsd:string" />
    <xsd:element name="Info" type="xsd:string" />
    <xsd:element name="ShowAccesslists" type="ShowAccesslists_def" />
  </xsd:schema>

The XML fragment the router spits out is:
<?xml version="1.0" encoding="UTF-8"?>
   <ShowAccesslists xmlns="ODM://built-in//show_access-lists">
    <Access-List>
      <Type>Extended IP</Type>
      <Name>test</Name>
      <PermitFilter>
        <Filter>10 permit ip any any</Filter>
      </PermitFilter>
      <PermitFilter>
        <Filter>20 permit tcp 0.0.0.1 255.255.255.0 any</Filter>
      </PermitFilter>
      <PermitFilter>
        <Filter>40 permit tcp host 10.22.1.128 10.11.79.0 0.0.0.255 eq domain</Filter>
      </PermitFilter>
      <PermitFilter>
        <Filter>50 permit tcp host 10.22.1.128 eq domain 10.11.79.0 0.0.0.255</Filter>
      </PermitFilter>
    </Access-List>
  </ShowAccesslists>

Is the schema broken? How do I get it to validate?

A: Answer depends on whether you wish to change your XML or your XSD...
Change XML
According to your XSD, your XML should not be in a namespace and should not have multiple PermitFilter elements.
Therefore, if you wish to keep the XSD constant, the following updated XML will validate successfully against your XSD.
<?xml version="1.0" encoding="UTF-8"?>
<ShowAccesslists>
  <Access-List>
    <Type>Extended IP</Type>
    <Name>test</Name>
    <PermitFilter>
      <Filter>10 permit ip any any</Filter>
    </PermitFilter>
  </Access-List>
</ShowAccesslists>

Change XSD
Your XML is in a namespace and has multiple PermitFilter elements.
If you wish to keep the XML constant, add a targetNamespace to your XSD, define a namespace prefix for that namespace, and use the prefix when referencing components in that namespace.  The following updated XSD shows exactly how to do this and will successfully validate your XML:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:sal="ODM://built-in//show_access-lists"
            targetNamespace="ODM://built-in//show_access-lists">
  <xsd:complexType name="ShowAccesslists_def">
    <xsd:sequence>
      <xsd:element ref="sal:SpecVersion" minOccurs="0" />
      <xsd:choice minOccurs="0" maxOccurs="unbounded">
        <xsd:element ref="sal:Info" />
        <xsd:element name="Access-List" minOccurs="0" maxOccurs="1">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="Type" minOccurs="0" maxOccurs="1" type="xsd:string" />
              <xsd:element name="Name" minOccurs="0" maxOccurs="1" type="xsd:string" />
              <xsd:element name="DenyFilter" minOccurs="0" maxOccurs="1">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="Filter" minOccurs="0" maxOccurs="1" type="xsd:string" />
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
              <xsd:element name="PermitFilter" minOccurs="0" maxOccurs="unbounded">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="Filter" minOccurs="0" maxOccurs="1" type="xsd:string" />
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:choice>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:element name="SpecVersion" type="xsd:string" />
  <xsd:element name="Info" type="xsd:string" />
  <xsd:element name="ShowAccesslists" type="sal:ShowAccesslists_def" />
</xsd:schema>


text:
Q: Unable to locate css_selector element Selenium I'm trying to find a button to click using Selenium. The portion of html containing the button is the following:
<button class="btn-standard call-to-action">Login</button>

I am trying to find it with:
btn = driver.find_element_by_css_selector("btn-standard.call-to-action")

And then i should execute btn.click()
But when i try to run the code i get this error:
 no such element: Unable to locate element: {"method":"css
selector","selector":"btn-standard.call-to-action"}

How can I fix this?

A: Try this
btn = driver.find_element_by_css_selector(".btn-standard.call-to-action")

You are missing a dot at the beginning of css_selector so it looks for an element btn-standard and not a class. And there is no such element as btn-standard
Also you can try element type with class like so:
btn = driver.find_element_by_css_selector("button.btn-standard")

Or any mix of class and element type

A: You can even use xpath:
btn = driver.findElement(By.xpath("//button[contains(text(),'Login')]"))

A: For css selectors '.' is appended in the beginning only for class.
Can you try this:
       btn = driver.find_element_by_css_selector("button.btn-standard")


text:
Q: XMLRPC in Bugzilla 2.x I had a requirement to automate bug logging in Bugzilla. I googled and was able to make use of XML RPC in bugzilla.
But I couldn't make use of XML RPC in the bugzilla local server which was maintained by our Software Support Team. I am using Bugzilla version 2.20.2. Does this support XML RPC ??
I am able to communicate with another server of Bugzilla which is 3.6.2 .
How can we enable XMLRPC in the Bugzilla Installation ??

A: Actually, if we use the installer available from here , and had installed the required perl modules it is working fine


text:
Q: How to collect statistics about data usage in an enterprise application? For optimization purposes, I would like to collect statistics about data usage in an enterprise Java application. In practise, I would like to know which database tables, and moreover, which individual records are accessed most frequently.
What I thought I could do is write an aspect that records all data access and asynchronously writes the results to a database but I feel that I would be re-inventing the wheel by doing so. So, are there any existing open source frameworks that already tackle this problem or is it somehow possible to squeeze this information directly from MySQL?

A: This might be useful - have you seen the UserTableMonitoring project?


text:
Q: How to merge 2 CSV files together by multiple columns in Python I have two CSV files. File 1 that looks like:
Ticker  |    Date     |   Marketcap
  A     |  2002-03-14 |    600000
  A     |  2002-06-18 |    520000
                   .
                   .
  ABB   |  2004-03-16 |    400000
  ABB   |  2005-07-11 |    800000
                   .
                   .
  AD    |  2004-03-16 |    680000
                   .
                   .

File 2 like:
Ticker  |    Date     |     Open    |    Close   |
  A     |  2002-03-14 |    580000   |    500000  |
  ABB   |  2002-03-14 |    500000   |    420000  |
  AD    |  2002-03-16 |    700000   |    670000  |
                          .
                          .
                          .
                          .

The periods indicate that values continue on for a large number of entries for each ticker for both File 1 and File 2. The first file has all values for every date and every ticker listed all in one line continuously whereas the second file has all values for every year and ticker listed one-by-one.
What I want to do is merge files 1 and 2 based off both "Ticker" and "Date" to look like:
Ticker  |    Date     |   Marketcap |    Open     |    Close   |
  A     |  2002-03-14 |    600000   |    580000   |    500000  |
  ABB   |  2002-03-14 |    520000   |    500000   |    420000  |
                                 .
                                 .

I've tried merging files using something like:
a = pd.read_csv("File1.csv")
b = pd.read_csv("File2.csv")
merged = a.merge(b, on='Date')

But I don't think this accounts for both Date and Ticker at once.

A: I believe you need to use ['Date', 'Ticker'] instead of just 'Date'. Also you might need to specify the how argument depending on what you want.

A: You can try the following code:
a = pd.read_csv("File1.csv", "\t")
b = pd.read_csv("File2.csv", "\t")
merged = pd.merge(a, b, how='inner', on=['Ticker', 'Date'])
print merged

If File1.csv is:
Ticker  Date    Marketcap
A   2002-03-14  600000
A   2002-06-18  520000
ABB 2004-03-16  400000
ABB 2005-07-11  800000
AD  2004-03-16  680000

And File2.csv is:
Ticker  Date    Open    Close
A   2002-03-14  580000  500000
ABB 2004-03-16  500000  420000
AD  2004-03-16  700000  670000

Then the output of the above code will be:
  Ticker        Date  Marketcap     Open   Close
0      A  2002-03-14      600000  580000  500000
1    ABB  2004-03-16      400000  500000  420000
2     AD  2004-03-16      680000  700000  670000

If you want all rows from File1.csv and only matching rows from File2.csv, you can use this instead:

merged = pd.merge(a, b, how='left', on=['Ticker', 'Date'])

This will produce:
  Ticker        Date  Marketcap       Open     Close
0      A  2002-03-14      600000  580000.0  500000.0
1      A  2002-06-18      520000       NaN       NaN
2    ABB  2004-03-16      400000  500000.0  420000.0
3    ABB  2005-07-11      800000       NaN       NaN
4     AD  2004-03-16      680000  700000.0  670000.0

A: Try this:
 merged=a.merge(b, how='left',on=['Ticker', 'Date'])


text:
Q: Equipment maintenance tracking software I need software for equipment maintenance tracking, I am thinking of designing an Openoffice.org base database for this but It would probably save me a lot of time if something already exist to do this that is freely available. I would be happy if someone could point me to something, even if the software was not designed specifically for equipment maintenance tracking but could be repurposed in some way.

A: What I believe you are looking for is a fixed asset management system, you can find plenty of Linux based fams, but a lot of them are designed for enterprise so you will find that they are interesting to set up and most likely web based.
I recommend checking out some of the items in this list:
http://sourceforge.net/projects/fams/


text:
Q: Is there a way to add a "delete software" button upon right-click in the gnome app launcher? The question is really in the title, but more specifically.. does anyone know of a extension (or any other way) that can add a possibility to delete a software within the app launcher?
As shown on picture.

Although the software center is ok to install software, it feels unnecessarily clunky to have to delete software through it.
Any ideas anyone? Thanks in advance?
Ubuntu 22.04

A: Installing and deleting software is not related to the daily use of the computer. It is related to the administration of the system. It also is not something you do several times every day. The Gnome Developpers therefore opted it wise to keep these aspects out of the interface in which you do your daily work. An added benefit is that inexperienced users then will not inadvertently delete software and require help desk assistance because of this.
This could be implemented by a Gnome Shell extension. Possibly, nobody took interest for the reasons mentioned above. You could file an enhancement request to the developers of Gnome Shell, but I feel that the chances that that would be accepted, are very small, for the reasons stated above.
Your options to remove software are 1) using the software center 2) using synaptic package manager or 3) use apt remove on the terminal.


text:
Q: Update a Single TableView Cell Label I am trying to create a cell with a 'count' variable which is a label that shows how many items are in a folder. I am doing this with a fetch request in the cellForRowAt func that counts the items in the request. The problem I am facing is that this isn't getting called every-time a new item is added resulting in the wrong count. Reloading the tableView every time in viewWillAppear fixes the problem but won't work in my use case as I am dealing with a lot of data. How could I fix this?
class FolderTableViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "folderCell", for: indexPath) as! FolderTableViewCell

        let request = NSFetchRequest<NSFetchRequestResult>(entityName: "Note")
        request.predicate = NSPredicate(format: "userDeleted = false")
        let count = try! context.count(for: request)

        let folders = folderNames(name: "TEST", icon: "TestImage", count: count)
        cell.updateFolders(with: folders)
        return cell
    }

}

class FolderTableViewCell: UITableViewCell {

    func updateFolders(with folders: folderNames) {
        folderCellLabel.text = folders.name
        folderCellImage.image =  UIImage(named: "TestImage")

        if folders.count != 0 {
            folderCellCount.text = "\(folders.count)"
        }
    }

}

A: tableView.reloadRows(at: [selectedIndex], with: .automatic)

selectedIndex is the index you want to reload.
refer to this: Is it possible to refresh a single UITableViewCell in a UITableView?
Thanks


text:
Q: How change content of dist zip? Gradle 7.1
plugins {
    id 'application'
 }

In my java project I create dist like this:
gradle distZip

As result create zip with the next content:
\app
\lib

OK, but I need to create one more folder (data) with file myfile.txt. Location of myFile.txt is on build\resources\main\db\sqlite\myFile.txt
So the result must be like this;
 \app
 \data\myFile.txt
 \lib

Is it possible?


text:
Q: How can I validate a JWSObject that has a "crit" value in its headers? I'm trying to write some code to sign and validate payloads using my private/public keys in java following JOSE standards. I need to use the PS256 encryption algorithm for this.
I'm using connect2id's library Nimbus JOSE + JWT. I'm able to get to the point where I can sign a payload with a private key I load from the file system, and I can also validate it. However as part of my requirements, my header needs to have a "crit" value (explained as part of RFC-7515).
My problem is the following: As soon as I have a "crit" value in the header, my token validation fails (even if the values in the "crit" array are present in my jws header, as required by the standard). If I take out the "crit", then the signature is validated correctly.
// create RSA key used for signing.
RSAKey rsaJWK = new RSAKey.Builder(pub)
  .privateKey(priv)
  .keyUse(KeyUse.SIGNATURE)
  .algorithm(JWSAlgorithm.PS256)
  .keyID("KeyID")
  .build();

// Create RSA-signer with the private key
JWSSigner signer = new RSASSASigner(rsaJWK);

// setting critical values to be used in jws header
Set crit = new HashSet();
crit.add("myHeader");

// setting additional parameters for the jws header
Map myParams = new HashMap();
myParams.put("myHeader", false);

// build the jws header with all the values needed
JWSHeader jwsHeader = new JWSHeader.Builder(JWSAlgorithm.PS256)
  .type(JOSEObjectType.JOSE)
  .contentType("application/json")
  .keyID("KeyID")
  .criticalParams(crit)
  .customParams(myParams)
  .build();

// build the jws object with the header we created above and a static payload for now
JWSObject jwsObject = new JWSObject(jwsHeader, new Payload("{\"message\":\"In RSA we trust!!!\"}"));

// sign the payload
jwsObject.sign(signer);

// print out the token
String s = jwsObject.serialize();
System.out.println("Your token:" + s);

// To parse the JWS and verify it, e.g. on client-side
JWSObject jwsValObj = JWSObject.parse(s);

JWSVerifier verifier = new RSASSAVerifier(pub);

// verify the signature of the parsed token
boolean sigval = jwsValObj.verify(verifier);
System.out.println("Signature Validation passed: " + String.valueOf(sigval));

I'm expecting the signature to be verified properly since the values in "crit" are present in the token given.
As soon as I remove the line with .criticalParams(crit), then verification goes through without a problem.
Can someone help me out with this? Am I misunderstanding something or missing some glaring detail?

A: Following RFC 7515, critical headers must be understood by application, so you need to indicate library that they are deferred to the application for processing
Looking at RSASSAVerifier source code, Try to change
JWSVerifier verifier = new RSASSAVerifier(pub);

with
JWSVerifier verifier = new RSASSAVerifier(pub, crit);


text:
Q: Dealing with class multiple input in web scraping
Hi, I am trying to scrape the value ="36", but I don't know how to deal with the fact there are multiple inputs of the class.
My code is the following:
## cdkitchen.com
url= 'http://www.cdkitchen.com/recipes/recs/32/Snowball_Cookies_II54545.shtml'
r = requests.get(url)
page_body = r.text
soup=BeautifulSoup(page_body, 'html.parser')
stat= soup.find('div', class_='col-md-4 col-sm-4 mb-20')
for a in stat.find('form', class_='change-servs-form'):
    print(a.get_value())

the get_value() doesn't work, I tried some other things but I am blocked, is there an easy way to specify which input we want to scrape?

A: This is how you properly specify a class in beautifulsoup find method {'class': 'classname'}
Also, use soup.get('attribute') to get any attribute from the given tag (value for this matter).
Working code:
stat = soup.find('div', {'class': 'col-md-4 col-sm-4 mb-20'})
for a in stat.find('form', {'class': 'change-servs-form'}):
    print(a.get('value'))

36

Note: I prefer CSS selectors but I didn't want to temper with your code all that much. You should look into that :)
EDIT
Using CSS selectors, getting value attr from each input tag inside the form
stat = soup.find('form', {'class': 'change-servs-form'})
input_tags = stat.select('input')
for a in input_tags:
    print(a.get('value'))

36
  21411
  change servings
  reset

A: Another way could be something like below. Using css selectors:
import requests
from bs4 import BeautifulSoup

res = requests.get('http://www.cdkitchen.com/recipes/recs/32/Snowball_Cookies_II54545.shtml')
soup = BeautifulSoup(res.text, 'lxml')
item_name = '\n'.join([item['value'] for item in soup.select('.change-servs-form input')])
print(item_name)

Output:
36
21411
change servings
reset


text:
Q: ASP.NET JWT: Signature validation failed. No security keys were provided to validate the signature I've been making a web api in F#, mostly following this guide: https://www.blinkingcaret.com/2017/09/06/secure-web-api-in-asp-net-core/. However, I've been getting this error whenever I try to hit an authenticated endpoint in my aspnet webapi:
Failed to validate the token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiciIsImV4cCI6IjE1MjI2MzUwNDMiLCJuYmYiOiIxNTIyNTQ4NjQzIn0.VofLygSMitkmEsTBFNG-7-3jMAZYkyvfwc2UIs7AIyw.
    Microsoft.IdentityModel.Tokens.SecurityTokenInvalidSignatureException: IDX10500: Signature validation failed. No security keys were provided to validate the signature.
       at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateSignature(String token, TokenValidationParameters validationParameters)
       at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
       at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.<HandleAuthenticateAsync>d__6.MoveNext()

I've found similar issues linked here, but none whose resolution helped me. My Startup.fs looks like:
type Startup private () =
    new (configuration: IConfiguration) as this =
        Startup() then
        this.Configuration <- configuration

    // This method gets called by the runtime. Use this method to add services to the container.
    member this.ConfigureServices(services: IServiceCollection) =
        // Add framework services
        services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(fun options ->
            options.TokenValidationParameters = TokenValidationParameters (
                ValidateAudience = false,
                ValidateIssuer = false,
                ValidateIssuerSigningKey = true,
                IssuerSigningKey = SymmetricSecurityKey(Encoding.UTF8.GetBytes("the secret that needs to be at least 16 characeters long for HmacSha256")),
                ValidateLifetime = false, //validate the expiration and not before values in the token
                ClockSkew = TimeSpan.FromMinutes(5.0) //5 minute tolerance for the expiration date
            ) |> ignore
        ) |> ignore
        services.AddMvc() |> ignore
        services.AddSwaggerGen (fun c -> c.SwaggerDoc("v1", Swagger.Info()))  |> ignore
        services.AddCors() |> ignore

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    member this.Configure(app: IApplicationBuilder, env: IHostingEnvironment) =
        app.UseExceptionHandler(
            fun options ->
                options.Run(
                    fun context ->
                        let ex = context.Features.Get<IExceptionHandlerFeature>()
                        match ex.Error with
                        | HttpCodedException (code, message) ->
                             printfn "code: %i, msg: %s" (int code) message
                             context.Response.StatusCode <- int code
                             context.Response.WriteAsync(message)
                        | exn -> raise (exn)
                )
        ) |> ignore

        // let cors = Action<CorsPolicyBuilder> (fun builder -> builder.WithOrigins("http://localhost:3000").AllowAnyHeader().AllowAnyMethod() |> ignore)
        app.UseCors(fun policy ->
            policy.AllowAnyHeader()
                    .AllowAnyOrigin()
                    .AllowCredentials()
                    .AllowAnyMethod()
                    .Build() |> ignore
        ) |> ignore

        app.UseAuthentication() |> ignore

        app.UseMvc() |> ignore

    member val Configuration : IConfiguration = null with get, set

I've tried turning off basically all of the validation, so I'm confused why this is still failing. If it's helpful, the place where I generate the tokens looks like:
let GenerateToken (username) =
    let claims = [|
        Claim (ClaimTypes.Name, username)
        Claim (JwtRegisteredClaimNames.Exp, DateTimeOffset(DateTime.Now.AddDays(1.0)).ToUnixTimeSeconds().ToString())
        Claim (JwtRegisteredClaimNames.Nbf, DateTimeOffset(DateTime.Now).ToUnixTimeSeconds().ToString())
    |]
    let cred =
        new SigningCredentials(
            SymmetricSecurityKey(Encoding.UTF8.GetBytes("the secret that needs to be at least 16 characeters long for HmacSha256")),
            SecurityAlgorithms.HmacSha256
        )
    let token = JwtSecurityToken(JwtHeader(cred), JwtPayload(claims))
    JwtSecurityTokenHandler().WriteToken(token)

Hoping someone can see what I'm doing wrong.

A: Finally figured this out. F# doesn't use = for assignment, it uses <-. So needed to change my service AddAuthenticaton call to:
    services.AddAuthentication(fun options ->
        options.DefaultScheme <- JwtBearerDefaults.AuthenticationScheme
        options.DefaultAuthenticateScheme <- JwtBearerDefaults.AuthenticationScheme
        options.DefaultChallengeScheme <- JwtBearerDefaults.AuthenticationScheme
    ).AddJwtBearer(fun options ->
        options.TokenValidationParameters <- TokenValidationParameters (
            ValidateAudience = false,
            ValidateIssuer = false,
            ValidateIssuerSigningKey = false,
            IssuerSigningKey = SymmetricSecurityKey(Encoding.UTF8.GetBytes("the secret that needs to be at least 16 characeters long for HmacSha256")),
            ValidateLifetime = false, //validate the expiration and not before values in the token
            ClockSkew = TimeSpan.FromMinutes(5.0), //5 minute tolerance for the expiration date
            ValidateActor = false,
            ValidateTokenReplay = false
        )
    ) |> ignore

Now everything works fine.

A: This has been working well for me.
JWT Authentication settings
services.AddAuthentication(options =>
{
    options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
    options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
    options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(options =>
{
    options.RequireHttpsMetadata = false;
    options.TokenValidationParameters = new TokenValidationParameters()
    {
        ValidateIssuerSigningKey = true,
        IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes("thisKeyIs32CharactersLong1234567"))
        ValidateIssuer = true,
        ValidIssuer = "MyIssuer",
        ValidateAudience = true,
        ValidAudience = "MyAudience",
        ValidateLifetime = true,
        ClockSkew = TimeSpan.Zero
    };
});

And then to create the actual token
var handler = new JwtSecurityTokenHandler();
var securityToken = handler.CreateToken(
    new SecurityTokenDescriptor
    {
        Issuer = "MyIssuer",
        Audience = "MyAudience",
        SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(Encoding.ASCII.GetBytes("thisKeyIs32CharactersLong1234567")), SecurityAlgorithms.HmacSha512Signature),
        Subject = new ClaimsIdentity(
            new[] {
                new Claim(ClaimTypes.Name, "My Name"),
                new Claim(ClaimTypes.Sid, "My UID"),
                new Claim(ClaimTypes.GroupSid, "My GID")
            },
        Expires = DateTime.Now + TimeSpan.FromMinutes("30")
    });

// Save token
handler.WriteToken(securityToken);

Hope it helps.


text:
Q: PDF, probability, variance, statis Let X be normal with mean 1 and variance 4. LetY =2X+3.
Find P(Y ≥ 0)
I've solved E(Y) = 5 and Var(Y)=16. How do I apply this solve $P(Y\geq 0)$

A: now you can standardize the variable: $P(Y\leq 0)=\Phi \left( \frac{0-\mu}{\sigma} \right)$, where $\Phi(.)$ is the function of the standard normal distribution. Here you have to take the complementary possibility $P(Y\geq 0)=1-\Phi \left( \frac{0-\mu}{\sigma} \right)$
greetings,
calculus


text:
Q: Adding Multiple Events Problem iCalendar PHP I have no problem adding a single event to the calendar. But I am having a problem when adding multiple events with the foreach. Where am I making a mistake? Can you help me?(The dates I pulled from the database are in Y-m-d format.)
errror is "Some events in the calendar file could not be added. The calendar file may be corrupt."
<?php
require_once("zapcallib.php");
include('../dbcon/db.php');

$ical = "BEGIN:VCALENDAR\n
VERSION:2.0\n
PRODID:-//[YOUR WEBSITE], Inc.//EN\n";

foreach($db->query("SELECT * FROM rezervasyondurumu where evid='1'") as $listele) {
  $baslangic= $listele['baslangic'];
  $bitis= $listele['bitis'];
  $ical .= "\nBEGIN:VEVENT";
  $ical .= "\nUID: ".$listele['aciklama'] ." fewofethiye.com";
  $ical .= "\nDTSTAMP:" . date('Ymd');
  $ical .= "\nORGANIZER:catalog@example.com";
  $ical .= "\nDTSTART:".date("Ymd", strtotime($baslangic));
  $ical .= "\nDTEND:".date("Ymd", strtotime($bitis));
  $ical .= "\nSUMMARY:".$listele['aciklama'];
  $ical .= "\nDESCRIPTION:" .$listele['aciklama'];
  $ical .= "\nEND:VEVENT";

}

$ical .= "\nEND:VCALENDAR";

header("Content-type: text/calendar; charset=utf-8");
header("Content-Disposition: inline; filename=calendar.ics");
echo $ical;
?>


text:
Q: How can I make a border-radius element a different color with css? I'm trying to get the following image using border, but I couldn't change the color of the places I want. I looked at the use of Rotate, but it plays in the photo inside the circle.How can I generate a color plant with css?

The code below doesn't do what I want.
.
profile-img {
            width: 70px;
            height: 70px;
            border-bottom: 4px #272121 solid;
            border-bottom-left-radius: 50%;
            border-bottom-right-radius: 50%;
            border-top: 4px #272121 solid;
            border-top-left-radius: 50%;
            border-top-right-radius: 50%;
        }

A: maybe not quite accurately calculated the positions of the colors, but the principle should be clear.

body {
  padding: 0;
  display: flex;
  min-height: 100vh;
}

div {
  margin: auto;
  background-color: #ddd;
  width: 130px;
  height: 130px;
  position: relative;
  border-radius: 100%;
}

div::after {
  content: '';
  width: 150px;
  height: 150px;
  display: block;
  z-index: -10;
  position: absolute;
  left: -10px;
  top: -10px;
  border-radius: 100%;
  background-image: conic-gradient(#F8D41A, #F8D41A 35%, #FFFFE8 50%, #F8D41A 65%, #F8D41A 80%, #FFFFE8 90%, #F8D41A 100%)
}


text:
Q: Expand listfield row height dynamically in blackberry I want to expand list field row height dynamically..When you click on one of the items in the List Field it expands to give you more information. Anyone know how to do it?Any sample code related to it would be helpful.

A: The ListField uses the same hieght for all elements in the list. What you may want to look at is the TreeField. There is sample code distributed with the Blackberry Java Development Environment (in projects: communicationapidemo, serviceroutingdemo, and sqlitedemo).


text:
Q: how to install python and modules(XlsWriter, Pandas. etc) from C# wpf application I have a WPF application that requires python 3.6.150 and other libraries like pandas and XlsWriter.
currently the python installation is done manually by downloading and running the installer.
what I have tried:
I have set a variables to get the path where python is installed and run commands. However I am sure there are better ways to do this.
string path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

string pathFull = path + @"\Programs\Python\Python36\Scripts";
string installXlsWriter = "pip install XlsxWriter";
string installNumpy = "pip install numpy";
string installPandas = "pip install pandas";

// install xlswriter
System.Diagnostics.Process.Start("CMD.exe",installXlsWriter);


text:
Q: JNI and Java have different results when calling Integer.valueOf(int),is it a bug? Eclipse
Integer v1 = Integer.valueOf(55);
Integer v2 = Integer.valueOf(55);
System.out.println("v1==v2 ? " + (v1 == v2));
//bacause of Integer cache, v1 == v2 is true

Visual Studio
jclass Integer = jni_env->FindClass("java/lang/Integer");
jmethodID valueOf = jni_env->GetStaticMethodID(Integer, valueOf", "(I)Ljava/lang/Integer;");
jint intV = 55;
jobject v1= jni_env->CallStaticObjectMethod(Integer, valueOf, intV);
jobject v2 = jni_env->CallStaticObjectMethod(Integer, valueOf, intV);

v1 = 0x0000000019b01000 {...}
v2 = 0x0000000019b01008 {...}
Obviously, v1 and v2 are not the same object.Can someone tell me why?Thanks

A: When using Integer.valueOf() method in Java, you are creating an instance of Integer which is a wrapper around a primitive type: int.
You are already aware that the above method caches values. If you check the documentation, you can find

Returns an Integer instance representing the specified int value. If a new Integer instance is not required, this method should generally be used in preference to the constructor Integer(int), as this method is likely to yield significantly better space and time performance by caching frequently requested values. This method will always cache values in the range -128 to 127, inclusive, and may cache other values outside of this range. source

Therefore
Integer v1 = Integer.valueOf(55);
Integer v2 = Integer.valueOf(55);
System.out.println("v1==v2 ? " + (v1 == v2));

will evaluate as true. But here, the operation done with == is not on the value itself, but the reference to the object in the heap memory. Since .valueOf() caches 55 automatically, v1 and v2 points to the same object.
When using jni with the following call
jobject v1= jni_env->CallStaticObjectMethod(Integer, valueOf, intV);

then v1 is a jni object that wraps around the java object. If you do the same call for v2, you get a different jni object. Both object have different references but will point to the same integer object internally. That's what you see.


text:
Q: Why notifyAll() doesn't work? After been thinking about a solution, i don't know why this code doesn't works properly.
If I execute mediaPlayer.start(), the thread enters on loop and wait(), but then, when mediaPlayer calls OnCompletionListener, notifyAll() doesn't wake from wait(), and loops in wait() state forever...
(Supposing that 'Music Thread' is properly started at the start of the class, and the same with MediaPlayer object)
private synchronized void set()
{
    while(mediaPlayer.isPlaying())
{
    try {
        wait();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}
    //DO SOMETHING (THE PROBLEM IS THAT NEVER REACHES THIS CODE)
}

private synchronized void reproductor()
{
    mediaPlayer.start();
    mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
        @Override
        public synchronized void onCompletion(MediaPlayer mediaPlayer) {
            notifyAll();   //because mediaPlayer.isPlaying() changes

        }
    });
}

private class Music implements Runnable
{
    @Override
    public void run() {
        try {
            reproductor();
            while(true) {
                set();
                Thread.sleep(500);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

On the other hand, if i use contrary statement in loop it works properly (!mediaPlayer.isPlaying()), why?

A: You aren't notifying the same object you're waiting on. You're notifying the listener object, which is an instance of an anonymous class implementing the listener interface. You need to qualify notifyAll() as XXX.this.notifyAll(), where XXX is the same of the class enclosing the set() and reproductor() methods.


text:
Q: Grouping elements by object attribute I really need to solve a problem i've been stuck into for 3 days.  Any help would be appreciated.
I have a Car class with brand, model and color instance variables.
I have a Preferences class with name, brand, model and color instance variables.
I have a preferences (Key = name, value = Car) HashMap  that contains people's names as keys and Car they would like to drive as values.
Finally i have a names ArrayList that contains all the names in the system.
I want somehow to group the names of the people according to the car they would like to drive.
For example i want the output to be something like:
Ford Focus, 2006, Blue : Nick,Bill,Jim
Opel Astra, 2008, Black : Joe, George
Mercedes CLK, 2009, Black : Steve, Chris, John
The first thing i thought of was, that i could hold all the duplicates in a list and then get the names of that list, but i figured out i can't form groups of people according to their preferred car. So, i think the following piece of code doesn't help at all.
Preferences[] p = new Preferences[preferences.size()];

for (int i = 0; i < preferences.size(); i++) {
    p[i] = (Preferences) preferences.get(names.get(i));
    Car car = new Car(p[i].getBrand(), p[i].getModel(), p[i].getColor());
    if (!set.add(car)) { //duplicate
        System.out.println("Duplicate!");
        listOfDuplicates.add(car);
    }
}

Is there anything i can do?

A: Map<Car, List<String>> namesByCar = new HashMap<Car, List<String>>();
for (Map.Entry<String, Car> entry : preferences) {
    String name = entry.getKey();
    Car car = entry.getValue();
    List<String> names = namesByCar.get(car);
    if (names == null) {
        names = new ArrayList<String>();
        namesByCar.put(car, names);
    }
    names.add(name);
}

Here you go...
It would be even easier with Guava's Multimap.


text:
Q: IPython nbconvert output pdf without In[#] words When I run below command to convert a IPython notebook to pdf, I wish to remove the leading word "In[#]" but only display the cell content.
ipython nbconvert --to=latex  --post=pdf input.ipynb

A: Some useful information at nbconvert-example.
Just copy style_notebook.tplx to local directory and do some minor modify:
diff --git a/latex_cell_style/use_cell_style.tplx b/latex_cell_style/use_cell_style.tplx
index 72b3c24..9114157 100644
--- a/latex_cell_style/use_cell_style.tplx
+++ b/latex_cell_style/use_cell_style.tplx
@@ -1,5 +1,5 @@
 ((= This line selects the cell style. =))
-((* set cell_style = 'style_python.tplx' *))
+((* set cell_style = 'style_notebook.tplx' *))

 ((= This line inherits from the built in template that you want to use. =))
-((* extends 'latex_article.tplx' *))
\ No newline at end of file
+((* extends 'article.tplx' *))
diff --git a/notebook_cell_style/style_notebook.tplx b/notebook_cell_style/style_notebook.tplx
index 504cd52..7bd9f2a 100644
--- a/notebook_cell_style/style_notebook.tplx
+++ b/notebook_cell_style/style_notebook.tplx
@@ -1,6 +1,6 @@
 ((= Notebook input/output style =))

-((* extends 'latex_base.tplx' *))
+((* extends 'base.tplx' *))

 % Custom packages
 ((* block packages *))
@@ -29,7 +29,7 @@
     \newlength{\inputpadding}
     \setlength{\inputpadding}{0.5em}
     \newlength{\cellleftmargin}
-    \setlength{\cellleftmargin}{0.15\linewidth}
+    \setlength{\cellleftmargin}{0\linewidth}
     \newlength{\borderthickness}
     \setlength{\borderthickness}{0.4pt}
     \newlength{\smallerfontscale}
@@ -177,15 +177,5 @@
 % Name: draw_prompt
 % Purpose: Renders an output/input prompt for notebook style pdfs
 ((* macro draw_prompt(prompt, number, color, space) -*))
-    \begin{minipage}{\cellleftmargin}%
-    \hfill%
-    {\smaller%
-    \tt%
-    \color{(((color)))}%
-    (((prompt)))[(((number)))]:}%
-    \hspace{\inputpadding}%
-    \hspace{(((space)))}%
-    \hspace{3pt}%
-    \end{minipage}%
 ((*- endmacro *))

Then copy below files to your notebook directory:
style_notebook.tplx
ipython_nbconvert_config.py
use_cell_style.tplx

Run below command to generate pdf output:
ipython nbconvert  test.ipynb

Output as below:


text:
Q: Query-builder in Symfony2, known function Month error I have a problem with Symfony2 QueryBuilder.
I have the following code which throws an error
$repositorio= $em->getRepository('SingUserBundle:Data');
$consulta= $repositorio->createQueryBuilder('d')
    ->where('d.usuario = :usuario')
    ->andWhere ('MONTH(d.fecha) = :mesActual')
    ->setParameter('usuario', $usuario->getId())
    ->setParameter('mesActual', $mesActual)
    ->getQuery();
$totaldatos= $consulta->getSingleResult();

The error is:
[Syntax Error] line 0, col 80: Error: Expected known function, got 'MONTH'

A: As Gremo reported in his answer, there is no builtin month function. So, you have to extend DQL to have the month function.
If you are not skilled to do that or you have no time, I suggest to install the DoctrineExtensions Mysql Function Pack, available for free on Gitbub repository.
It includes many useful DQL function, even included the month function.

A: Simply as the message says: query builder doesn't support MONTH function. Either write a user defined function or use native SQL with a result set mapping.

A: Finally I fix up my problem!
and finally I didn´t use MONTH
$fecha=new \DateTime("now");
            $fecha->setDate(DATE_FORMAT($fecha, 'Y'),DATE_FORMAT($fecha, 'm'),01);

            $qb= $this->createQueryBuilder('ud')
                ->where('ud.usuario = :identifier')
                ->andWhere('ud.fecha >= :identifier2')
               ->setParameters(array('identifier'=>$user,'identifier2'=> $fecha));

I took the date one month laterand did the query.
I hope to help someone!

A: It was an easy solution to solve this problem, at least for me:
$month= 04;
$qb = $this->getEntityManager()->createQueryBuilder();
$result = $qb->select('yd')
->from('RocketSellerTwoPickBundle:YearDates','yd')
->where($qb->expr()->like('yd.date', ':month'))
->setParameter('month', '%-' . $month . '-%')
->getQuery()
->getResult();

A: I had the same problem and I solved using the following code:
    $qb = $this->getEntityManager()->createQueryBuilder();

    $startDate = date( 'Y-m-' ) . '01'; // First day in current month
    $endDate   = date( 'Y-m-t' ); // Last day in current month

    $qb
        ->addSelect( 'l' )
        ->from( 'BackendBundle:Local', 'l' )
        ->join('l.inscriptions', 'i')
        ->where( 'i.date >= :startDate' )
        ->andWhere( 'i.date <= :endDate' )
        ->setParameter('startDate', $startDate)
        ->setParameter('endDate', $endDate)
    ;

    $query = $qb->getQuery();
    $query->setQueryCacheLifetime( 3600 );
    $query->setResultCacheLifetime( 3600 );
    $query->useQueryCache( true );

    return $query->getResult();

At least works for me, hope you can find useful.


text:
Q: How to make HTTP POST request from front-end to Spring? I'm trying to set up a webapp with ReactJS as the front-end and a Java back-end connected via Spring, but I am new to Spring.
I have two different Requests set up right now in a RestController:
@RequestMapping(value = "/index")
public String index() {
        return "index string!";
}

@RequestMapping(method=RequestMethod.POST, value="/login")
public void login(@RequestParam("user") User user) {
        System.out.println(user);
}

I can successfully query /index from the front-end like this:
fetch("http://localhost:3002/index").then(function(response) {
    console.log(response.text());
    return response;
});

This prints a Promise that contains the string "index string!"
(I'm not exactly sure how to use this string yet either, but that's not my main problem)
I want to send data using a POST request (should it be PUT?) for a user to log in. My plan is to get a User Object from the request and validate that against my database somewhere else in the Java code. Here is a User object:
public class User {
  private String username;
  private String password;

  public User(String uName, String pass) {
    username = uName;
    password = pass;
  }
}

and here is the POST request in the front-end:
fetch('http://localhost:3002/login', {
        method: 'POST',
        body: {
          username: username,
          password: password
        }
    });

where username and password are strings parsed from HTML.
My understanding is that Spring should create a User Object from the body of the request and let me use that, but instead I'm getting a 400 error without much more detail.
How can I make this 400 error go away and successfully pass data from my front-end to my back-end?
EDIT: here is the top few lines of the returned error
VM10542:1 POST http://localhost:3002/login 400 ()
(anonymous) @   VM10542:1
func    @   LoginPage.js:26

LoginPage.js:26 is the fetch call.

A: First of all, yes POST is the correct method for this type of call.
In your case you have two options:
Send data as a body
So that the endpoint implementation will look like this:
@RequestMapping(method=RequestMethod.POST, value="/login")
public void login(@RequestBody User user) {
    System.out.println(user);
}

Then send it as a JSON
fetch('http://localhost:3002/login', {
  method: "POST",
  headers: {
    Accept: "application/json",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    username: "foo",
    password: "bar"
  })
});

Or send it in params
So that the endpoint implementation will look like this:
@RequestMapping(method=RequestMethod.POST, value="/login")
public void login(@RequestParam("username") String username,
                  @RequestParam("password") String password) {
    System.out.println(username + " " + password);
}

Then send it in params (not the best implementation):
fetch('http://localhost:3002/login?username=' + username
                                 + '&password=' + password, {
  method: "POST",
  headers: {
    Accept: "application/json",
    "Content-Type": "application/json"
  }
});

Of course you should bear in mind that plain sending a password is not a good idea, but I believe it is for learning purposes. In other case you may take a look at HTTPS.
You may also take a look at other login handling techniques like for starters JWT or maybe you can introduce OAUTH. Good luck!
EDIT:
I haven't noticed that your model class is wrong.
I believe that you need to make it look like this:
class User {
    private String username;
    private String password;

    public User(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }
}

So the Spring was telling you that the constructor is wrong, because he couldn't find the proper mapping for the username and password fields.


text:
Q: How to create a WebKit browser plugin in C#? I want to create C# plugin for some 3d + Music editing stuff. I want to be able to run my files inside browsers pages (so to see HTML some Flash content and some content which is rant by my plugin) using something like HTML tag or some JavaScript. (So my plugin will be small, powerfull and i want it to run at least on Windows and Mac firefox and safary and Chrome)(If it'll be runing on Linux itll be grate)))
I'ma beginner so any helpfull info will be appriciated

A: You could achieve it using Silverlight .. think abt it .. :)


text:
Q: Serializing and deserializing a bit field  I've been handed a document that defines a set of messages that are transmitted and received over a serial communications channel. I'd like to take the incoming messages and deserialize them into objects, and serialize my outbound messages as well. The encoding over the wire is established and not changeable, and consists of various bitfields in the header and varying payloads, e.g.,
class Message{
int msg_num : 7
int dest_addr : 4
bool SRR : 1
bool IDE : 1
int source_addr : 6
//... and so on...
}

I took a look at using protobufs, but it appears that their varint method of encoding is established. I've also looked at boost-serialization, but based on what I've read so far, how the encoding is done there is not entirely clear.
So, a few questions:

*

*Can I use boost-serialization to convert my bytestream to objects?

*With a goal of not having to roll my own routines for serialization (a maintenance mess), is there a preferred mechanism for accomplishing my task (e.g., a custom boost-serialization Archive, another method I've not discovered)

A: I think you won't find an easy-to-use serializer that will match the custom protocol you are looking at. But it look the set of primitives you have (int, bool + size ) are simple enough to be able to write your own decoder/encoder. Simply generating C/C++ code based on the message received. It should be fairly simple task to generate a compilable code taking such description. It should be an automated generation done at the compile time - similar to what protobuf/Corba are doing.
Example: from the specification:
class Message{
    int msg_num : 7
    int dest_addr : 4
    bool SRR : 1
    bool IDE : 1
    int source_addr : 6
    //... and so on...
}

the converter could write a function with body similar to (abstract notation and assuming MSB):
Decoder:
m = new Message()
{
    long long val = 0
    for(int i=0; i<7; i++) {
        val <<= 8
        val += nextByte()
    }
    m.msg_num = val
}
{
    long long val = 0
    for(int i=0; i<4; i++) {
        val <<= 8
        val += nextByte()
    }
    m.dest_addr = val
}
{
    int val = nextByte()
    m.SRR = val
}
{
    int val = nextByte()
    m.IDE = val
}
{
    long long val = 0
    for(int i=0; i<6; i++) {
        val <<= 8
        val += nextByte()
    }
    m.source_addr = val
}
// and so on

Encoder:
{
    long long val = m.msg_num
    for(int i=0;i<7;i++) {
        writeByte(val & 0xFF)
        val >>= 8
    }
}
{
    long long val = m.dest_addr
    for(int i=0;i<4;i++) {
        writeByte(val & 0xFF)
        val >>= 8
    }
}
....

That should be pretty easy to generate and the simplest way to make sure the encoding is custom.

A: In case you're limited to single platform only (i.e. limited with single byte order), and Message is POD type, you can declare your message as primitive.
Otherwise, in case of boost.serialization at least, you'll have to write code, i.e. 'routines for serialization'. It supports byte order conversions, at least
[Edit]
Wrong, it's not primitive, I'm lost in the depths of serialization docs


text:
Q: Why ngModel.$render is not getting invoked? EDIT 1: Fixed a bug, but still not working.
element.val(ngModel.$viewValue || '');

should have been:
dateInput.val(ngModel.$viewValue || '');

EDIT 2: The problem seems to be due to the isolate scope. The injected ngModel's $render() method is not getting invoked when the scope is an isolate. If I make the scope non-isolate and set ng-model="selectedDate", then $render() is getting invoked as expected.
EDIT 3: Actually the problem is due to $parent.selectedDate. If I change it to selectedDate, the code seems to be working fine. However I want to ensure that selectedDate is not getting defined on the directive's scope, but it is inherited from its parent's scope. That's why I want to use $parent., but it is not working as expected.

I am writing a custom date picker that when the browser supports HTML5 date inputs, uses that, and otherwise uses jQuery UI's Date Picker. It is still work in progress and right now only the part to use native HTML 5 date inputs is being implemented.
The directive can be used like this:

However, when $scope.selectedDate has an initial value, it is not getting rendered by the directive. Also external changes to selectedDate` (e.g. by clicking on a button) are not being obserevd by the directive.
Any ideas what is possibly wrong with my code?
Here's a live version of the code: milDatePicker.
Here's the code for the directive:
var app = angular.module('plunker', []);

app.controller('MainCtrl', function($scope) {
  $scope.selectedDate = '2020-01-01';
  $scope.changeDate = function() {
    $scope.selectedDate = '2030-03-03';
  };
});

app.directive('milDatepicker', function () {
   var template =
      '
' +
         '   <input type="date" class="form-control">' +
         '
' +
         '      <button type="button" class="btn btn-default btn-back">' +
         '         ' +
         '      </button>' +
         '      <button type="button" class="btn btn-default btn-reset">Today</button>' +
         '      <button type="button" class="btn btn-default btn-forward">' +
         '         ' +
         '      </button>' +
         '
' +
         '
';

   return {
      template: template,
      restrict: 'A',
      require: 'ngModel',
      scope: {},
      priority: 0,
      link: function (scope, element, attrs, ngModel) {
         var nativeDatePickerHandlers = {
            back: function () {
               var $input = element.find("input").first();
               if ($input.val() === '' || $input.val() === undefined) {
                  return;
               }

               scope.$apply(function () {
                  var currentDate = moment($input.val(), "YYYY-MM-DD"),
                     yesterday = currentDate.subtract('days', 1).format("YYYY-MM-DD");

                  $input.val(yesterday);
                  ngModel.$setViewValue(yesterday);
               });
            },
            forward: function () {
               var $input = element.find("input").first();
               if ($input.val() === '' || $input.val() === undefined) {
                  return;
               }

               scope.$apply(function () {
                  var currentDate = moment($input.val(), "YYYY-MM-DD"),
                     tomorrow = currentDate.add('days', 1).format("YYYY-MM-DD");

                  $input.val(tomorrow);
                  ngModel.$setViewValue(tomorrow);
               });
            },
            reset: function () {
               var $input = element.find("input").first();

               scope.$apply(function() {
                  var today = moment().format("YYYY-MM-DD");
                  $input.val(today);
                  ngModel.$setViewValue(today);
               });
            },
            change: function () {
               var $this = $(this);

               scope.$apply(function () {
                  ngModel.$setViewValue($this.val());
               });
            }
         };

         function initNativeDatePicker(element) {
            var dateInput = element.find("input").first();

            element.find('.btn-back').first().on("click", nativeDatePickerHandlers.back);
            element.find('.btn-reset').first().on("click", nativeDatePickerHandlers.reset);
            element.find('.btn-forward').first().on("click", nativeDatePickerHandlers.forward);

            dateInput.on("change", nativeDatePickerHandlers.change);

            ngModel.$render = function () {
               dateInput.val(ngModel.$viewValue || '');
            };
         }

         // on browsers that support the HTML 5 date picker just use that
         // and do not use the jQuery UI DatePicker
         if (Modernizr.inputtypes.date) {
            initNativeDatePicker(element);
         } else {

         }
      }
   };
});


text:
Q: Ecto.migrate create database schema I am just getting started with Elixir/Phoenix and Ecto migrations. I cannot find a way to create Postgres database schemas using migrations. My database will need up to 4 different schemas in the near future. I mean doing this, but creating a schema instead of a table. I'm not sure it can be done, but if so, how? Thanks.
  def change do
    create table(:people) do
      ...
    end
  end

A: The Ecto.Migration.execute/1 function is what you're looking for. You can use it to execute arbitrary SQL commands, like creating users, schemas, or adding extensions to the database.
defmodule Example.Migrations.MakeSchema do
  use Ecto.Migration

  execute "CREATE SCHEMA example"
end


text:
Q: tikz-qtree and tufte-book I want to use tikz-qtree to add trees to a book formatted with tufte-book. For the most part, they work. However, one example does not. Consider the following minimal example:
\documentclass{tufte-book}
\usepackage{tikz-qtree}
\begin{document}
    \Tree [.mabubundok ma- [.bubundok \textsc{red} bundok ] ]
\end{document}

When I compile it, I get the following error message:
Package tikz Error: Giving up on this path. Did you forget a semicolon?.

However, if I change the document class to article, it compiles just fine:
\documentclass{article}
\usepackage{tikz-qtree}
\begin{document}
    \Tree [.mabubundok ma- [.bubundok \textsc{red} bundok ] ]
\end{document}

What is causing this behavior?

A: The problem is not with tikz-qtree but with the use of \textsc within the tree. The tufte-book class redefines \textsc using commands from the soul package. So you need to use \textsmallcaps instead.
\documentclass{tufte-book}
\usepackage{tikz-qtree}
\begin{document}
    \Tree [.mabubundok ma- [.bubundok \textsmallcaps{red} bundok ] ]
\end{document}

You can see this clearly by comparing \textsc and \textsmallcaps. The former is letter spaced, while the latter is regular \scshape:
\documentclass{tufte-book}

\begin{document}
\textsc{foo}

\textsmallcaps{foo}
\end{document}

This example provides a good argument for using semantic markup rather than formatting elements directly. So a better version of your code would be to define a macro for grammatical feature markup, which would then be defined as using \scshape directly, and only changed once in the document.
\documentclass{tufte-book}
\usepackage{tikz-qtree}
\DeclareTextFontCommand{\feat}{\scshape}
\begin{document}
    \Tree [.mabubundok ma- [.bubundok \feat{red} bundok ] ]
\end{document}


text:
Q: Is it possible to make ngModel in angular more forgiven about objects? I convert code from angularjs to angular.
Angularjs is very forgiven about objects that not exist. For example, foo.bar doesn't exist in data because data is null. but when I typing in the input angularjs is creates the bar as string inside foo object:
class HomeCtrl {
  data;
  ...
}

<form>
  <input ng-model="$ctrl.data.foo.bar" />
  data.foo.bar: {{$ctrl.data.foo.bar |json}}
</form>
<button ng-click="$ctrl.fn()">click</button>

stackblitz
vs angular, which throws an error when the object is null because foo.bar doesn't exist:
import 'zone.js/dist/zone';
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { bootstrapApplication } from '@angular/platform-browser';
import { FormsModule, NgForm } from '@angular/forms';

@Component({
  selector: 'my-app',
  standalone: true,
  imports: [CommonModule, FormsModule],
  template: `

Hello from {{name}}!

      Learn more about Angular

    <form >
      <input name="foo" [(ngModel)]="data.foo.bar">

    </form>

    submitted: {{data|json}}
  `,
})
export class App {
  name = 'Angular';

  data = null;
}

bootstrapApplication(App);

stackblitz
Is it possible to achieve the same behavior in angular like angularjs does? Maybe by directive or something similar solution (no with *ngIf)?


text:
Q: How to get the pixel data of an PNG downloaded using XMLHttpRequest (XHR2) I am using this code from
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data
var oReq = new XMLHttpRequest();
oReq.open("GET", "/myfile.png", true);
oReq.responseType = "arraybuffer";

oReq.onload = function (oEvent) {
  var arrayBuffer = oReq.response; // Note: not oReq.responseText
  if (arrayBuffer) {
    var byteArray = new Uint8Array(arrayBuffer);
    for (var i = 0; i < byteArray.byteLength; i++) {
      // do something with each byte in the array
    }
  }
};

oReq.send(null);

I am using it to download a png file which I then want to display in a Canvas element. I realise there are easier ways to do this, but I need to be able to manipulate the pixels so I would really like to have the pixel data in a TypedArray, also I have tried loading it using a regular DOM Image object, drawing it to canvas and using getImageData() but it too slow (it's a large image) - so now I am trying this method, what I get from the load is what I assume is the compressed data, so my question is - is there a quick way to decompress/inflate this data to get the image pixel data, or am I just plain wrong to try this?

A: you can make a base64 and set to src of a image... like below
var oReq = new XMLHttpRequest();
oReq.open("GET", "https://npmjs.org/static/npm.png", true);
oReq.responseType = "arraybuffer";

oReq.onload = function (oEvent) {

  var arrayBuffer = oReq.response; // Note: not oReq.responseText
  var binaryString = '';

  if (arrayBuffer) {

    var byteArray = new Uint8Array(arrayBuffer);

    for (var i = 0; i < byteArray.byteLength; i++) {

      binaryString += String.fromCharCode( byteArray [ i ] ); //extracting the bytes

    }

    var base64 = window.btoa( binaryString ); //creating base64 string

    img.src = "data:image/png;base64," + base64; //creating a base64 uri

  }
};

oReq.send(null);

a working jsfiddle... -> http://jsfiddle.net/Castrolol/mHv4b/


text:
Q: How can I open a shared sub calendar in Outlook 2010? There is a team in my office that has a shared calendar (the team calendar is set up as a user in Active Directory/Exchange, so treat the team as a user). The team also has 3 sub-calendars for the different team members. Other people in the office need to be able to access this team's calendar. They can go to Open Calendar in Outlook and see the main calendar, but they cannot see the sub-calendars.
The sub-calendars all have the Default user permissions set to Reviewer.
If you go to File  → Account Settings → Change [logged in Exchange account] → More Settings → Advanced and add the team's mailbox, it does show the calendars in Outlook, but it comes up under My Calendars instead of Shared Calendars.
We need to be able to go to Open Calendar and open the calendar and open all the sub-calendars this way. How is this possible?

A: A procedure for sharing Exchange sub-folders is described in the article :
How to View Shared Subfolders in an Exchange Mailbox.
If this doesn't work for you, please let us know where it fails, or how your needs are
different from these addressed by the article.

A: You have to send the share invite from the user again for the link to add this to your shared calendars, i.e., from the user that is sharing the calendar.
Just right click share calendar, select the user then email them the link. You can then go in and edit the permissions. I have not found another way.

A: Outlook 2013 is... fun.
In your Navigation menu (Mail, Calendar, Notes, etc.) at the bottom of the Navigation pane, click the "..." and select "Folders".
Now you can navigate around an account's folders like you could in the golden days, and finding that sub Calendar should be easy.
To get the sub Calendar to add to your "My Calendars" (in the 'normal' view, that is), you have to bounce around and repeatedly select and unselect it until Outlook decides you'll probably want to view this Calendar again later.

A: Once you've added the new mailbox (Calendar share source) in your Account Settings, you can drag the additional calendars to new custom Calendar groups. In Outlook 2010, right-click in the Calendar navigation pane, select New Calendar Group, name it how you please, then drag the shared calendar into it. It should no longer show up in My Calendars.


text:
Q: selenium webdriver giving "unknown error: Element is not clickable at point (747, 238)" when clicking on an angular js date picker package redbus;

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;

public class Searchforbus {

   public static  void main(String[] args) throws InterruptedException  {
     System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe");
     ChromeDriver driver = new ChromeDriver();
     driver.get("http://www.redbus.in/");
     driver.manage().window().maximize();
     driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS);
     driver.findElementById("src").sendKeys("Nagercoil");
     driver.findElementByClassName("selected").click();
     driver.findElementById("dest").sendKeys("Chennai");
     driver.findElementByClassName("selected").click();
     Thread.sleep(3000);
     driver.findElementById("onward_cal").click();
     WebElement element1= driver.findElementByXPath("//div[@id='rb-calendar_onward_cal']/table/tbody/tr[3]/td[6]");
     System.out.println("Check1");
     Actions builder= new Actions(driver);
     builder.moveToElement(element1).click().perform();
     System.out.println("Check2");

    }

}

I am getting the below error:
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (747, 238). Other element would receive the click: <label for="onward_cal" style="font-family:Lato" class="db text-trans-uc move-up">...</label>
  (Session info: chrome=54.0.2840.99)

at redbus.Searchforbus.main(Searchforbus.java:28)

A: @vinu the date you are provided in locator element1 points to 3rd December which is disabled in calender since it is past date, make sure you provide enabled/available dates
Make a habit of using explicit wait condition before clicking tricky element like calender
e.g WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("element_xpath")));
ref links

A: Rahul is right. You selected past date which is disabled. try to select future date and let us know what is the error if it fails.

A: import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.io.File;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Set;

import org.apache.commons.io.FileUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class CommonSeleniumUtils extends Driver {

     static WebDriver driver = Driver.getDriver();

    public void switchToWindowByTitle(String title) {
        Set<String> windows = driver.getWindowHandles();
        System.out.println("Amount of windows that are currently present :: " + windows.size());
        for (String window : windows) {
            driver.switchTo().window(window);
            if (driver.getTitle().startsWith(title) || driver.getTitle().equalsIgnoreCase(title)) {
                break;
            } else {
                continue;
            }
        }
    }

    public void clickWithJS(WebElement elementtoclick) {
        WebDriverWait wait = new WebDriverWait(driver, Long.parseLong(ConfigurationReader.getProperty("timeout")));
        wait.until(ExpectedConditions.elementToBeClickable(elementtoclick));
        ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", elementtoclick);
        ((JavascriptExecutor) driver).executeScript("arguments[0].click();", elementtoclick);
    }

    public void waitForPresenceOfElementByCss(String css) {
        WebDriverWait wait = new WebDriverWait(driver, Long.parseLong(ConfigurationReader.getProperty("timeout")));
        wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(css)));
    }

    public void waitForVissibilityOfElement(WebElement element) {
        WebDriverWait wait = new WebDriverWait(driver, Long.parseLong(ConfigurationReader.getProperty("timeout")));
        wait.until(ExpectedConditions.visibilityOf(element));
    }

    public void waitForStaleElement(WebElement element) {
        int i = 0;
        while (i < 10) {
            try {
                element.isDisplayed();
                break;
            } catch (StaleElementReferenceException e) {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e1) {
                    e1.printStackTrace();
                }
                e.printStackTrace();
                i++;
            } catch (NoSuchElementException e) {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e1) {
                    e1.printStackTrace();
                }
                e.printStackTrace();
                i++;
            } catch (WebDriverException e) {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e1) {
                    e1.printStackTrace();
                }
                e.printStackTrace();
                i++;
            }
        }
    }

    public boolean verifyElementIsNotPresent(String xpath) {
        List<WebElement> elemetns = driver.findElements(By.xpath(xpath));
        return elemetns.size() == 0;
    }

    public boolean verifyElementIsNotPresent(By by) {
        List<WebElement> elemetns = driver.findElements(by);
        return elemetns.size() == 0;
    }

    public void scrollToElement(WebElement element) {
        ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element);
    }

    public void hitEnterUsingRobot() {
        Robot rb;
        try {
            rb = new Robot();
            rb.keyPress(KeyEvent.VK_ENTER);
            rb.keyRelease(KeyEvent.VK_ENTER);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }

    public boolean verifyAlertPresent() {
        try {
            driver.switchTo().alert();
            return true;
        } catch (NoAlertPresentException Ex) {
            System.out.println("Alert is not presenet");
        }
        return false;
    }

    public static void takeSnapShot() {
        try {
            TakesScreenshot scrShot = ((TakesScreenshot) driver);
            File SrcFile = scrShot.getScreenshotAs(OutputType.FILE);
            String path = System.getProperty("user.dir") + "\\screenshots.jpg";
            System.out.println(path);
            File DestFile = new File(path);
            FileUtils.copyFile(SrcFile, DestFile);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }

    }
    public void safeJavaScriptClick(WebElement element) throws Exception {
        try {
            if (element.isEnabled() && element.isDisplayed()) {
                System.out.println("Clicking on element with using java script click");

                ((JavascriptExecutor) driver).executeScript("arguments[0].click();", element);
            } else {
                System.out.println("Unable to click on element");
            }
        } catch (StaleElementReferenceException e) {
            System.out.println("Element is not attached to the page document "+ e.getStackTrace());
        } catch (NoSuchElementException e) {
            System.out.println("Element was not found in DOM "+ e.getStackTrace());
        } catch (Exception e) {
            System.out.println("Unable to click on element "+ e.getStackTrace());
        }
    }
}

After this, call this method ===>>> safeJavaScriptClick

     WebElement element =  driver.findElement(By.xpath("YOUR XPATH"));
        try {
            seleniumTools.safeJavaScriptClick(element);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }


text:
Q: could not execute update query error in hiberante query Iam writing the following code for delete in hibernate
Query query = session.createQuery("delete  Contact contact where contact.firstName  = 'Deepak'");
              int row = query.executeUpate();
              if (row == 0){
              System.out.println("Doesn't deleted any row!");
              }
              else{
              System.out.println("DeletedRow: " + row);
              }

It gave me the following error
Hibernate: delete from CONTACT contact0_ where (contact0_.FIRSTNAME='Deepak')
could not execute update query
Can anyone help me