text:
Q: Precedence in C operators == and ( = ) I have to analyze what some code in C does, and I have a doubt about what happens in a certain line. The code is
#define PRINTX printf("%d\n", x)

void problem() {
    int x = 2, y, z;
    x *= 3 + 2; PRINTX;
    x *= y = z = 4; PRINTX;
    x = y == z; PRINTX;
    x == (y = z); PRINTX; // This line is the problem
}

This code snippet prints the resulting numbers:
10
40
1
1  // This result **

the problem is that I'm still trying to figure out why does the last line prints out x = 1, when the operation is x == (y = z). I'm having trouble finding out what that 1 means and the precedence of the operations. Hope someone can help me! :)

A: Nothing in the last statement changes the value of x, so its value remains unchanged.

Parens were used to override precedence, forcing the = to be the operand of the ==.
An operator's operands must necessarily be evaluated before the operator itself, so we know the following:

*

*y is evaluated at some point before the =.

*z is evaluated at some point before the =.

*x is evaluated at some point before the ==.

*= is evaluated at some point before ==.

That's it. All of these are valid orders:

*

*z y = x ==

*y z = x ==

*x y z = ==

*etc.

But whenever x, y and z are evaluated, we can count on the following happening:

*

*= assigns the value of z (currently 4) to y and returns it.

*== compares the value of x (currently 1) with the value returned by = (4). Since they're different, == returns 0 (which isn't used by anything).

As you see, nothing changed x, so it still has the value it previously had (1).

A: In the last statement, nothing is changing the value of x. We are testing if x equals something, but we aren't changing it's value.
So it continues having the same value as it had in the previous statement, in particular, a value of 1.

A: the reason is because the == operator checks if the 2 numbers are equal, and returns 1 if equal and 0 if not equal that is why it returns one you can check by making x= 1 and y=2 and using the == operator between them

A: The comparison result of x and assignment of y with (y = z) is discarded.  Last line could have dropped the compare: y = z; PRINTX;.
The assignment is not subsequently used either, so the line could have been PRINTX;.


text:
Q: pandas rolling appy on a dataframe I have Yahoo Stock data, that I would like to manipulate, like so,
import pandas as pd
import pandas.io.data as web
data = web.DataReader('SPY','yahoo')
data.head()

Out[13]:
            Open    High    Low     Close   Volume  Adj Close
Date
2010-01-04  112.37  113.39  111.51  113.33  118944600   103.44
2010-01-05  113.26  113.68  112.85  113.63  111579900   103.71
2010-01-06  113.52  113.99  113.43  113.71  116074400   103.79
2010-01-07  113.50  114.33  113.18  114.19  131091100   104.23
2010-01-08  113.89  114.62  113.66  114.57  126402800   104.57

For any given date, I would like to look forward 2 days and find the lowest quote for it. So, for 2010-1-4, the correct answer would be 112.85.
Now, I could iterate over all the dates with a for loop and get what I want. But I would like to figure out if I could do this in a vectorized manner. Maybe by using a rolling_apply lambda function. This is what I have done so far...
def foo(x):
    today = x[0]
    forward = x[1:]
    return (forward.min())
pd.rolling_apply(data,2,foo)

This does not work since the rolling_apply works on a Series and does not have access to the other columns on the data frame.
Is this some neat way to this?

A: Rather than calling rolling_apply on the whole dataframe, just call it on the column of interest and call min:
pd.rolling_apply(data['Low'],2,min)

Interestingly the global min function outperforms the numpy min, perhaps not that surprising given that all we are doing is finding the lowest value of a 2 element array:
In [26]:

%timeit pd.rolling_apply(data['Low'],2,np.min)
%timeit pd.rolling_apply(data['Low'],2,min)
10 loops, best of 3: 15.4 ms per loop
1000 loops, best of 3: 1.44 ms per loop

redpajama_set_name: RedPajamaStackExchange


text:
Q: Ordinal arithmetic So I'm having trouble understanding ordinal arithmetic.
So if you have $\omega = \bigcup \{ n | n\in\mathbb{N}\}$
How is this defined
$\omega^2$ as in the notes I'm reading it has $\omega^2 = \bigcup \{ \omega^n| n<\omega\}$, however this can't be correct.
So I'm having big trouble of understanding multiplication.
I understand how addition works.
In particular, if $\eta$ is the order type of $\mathbb{Q}$, what is $(\eta+1) \cdot (\eta+1)$?

A: I suspect that the definition of $\omega^2$ was intended to read
$$\omega^2=\bigcup\{\omega\cdot n:n<\omega\}\;,$$
where $\cdot$ indicates ordinal multiplication. Using $\longrightarrow$ to represent a set ordered in type $\omega$, we can picture $\omega\cdot n$ as
$$\underbrace{\longrightarrow\longrightarrow\ldots\longrightarrow}_{n\text{ arrows}}$$
and get the following picture:
$$\begin{array}{rl}
\omega\cdot 0:\\
\omega\cdot 1:&\longrightarrow\\
\omega\cdot 2:&\longrightarrow\longrightarrow\\
\omega\cdot 3:&\longrightarrow\longrightarrow\longrightarrow\\
\vdots\quad&\qquad\vdots\\
\omega^2=\omega\cdot\omega:&\underbrace{\longrightarrow\longrightarrow\longrightarrow\longrightarrow\longrightarrow\ldots}_{\omega\text{ arrows}}
\end{array}$$

The order type $\eta+1$ is what you get when you add a right endpoint to $\Bbb Q$; it's the order type of $\Bbb Q\cap(0,1]$, for instance. The order type $(\eta+1)\cdot(\eta+1)$ can then be visualized as follows.

Let $A=\Bbb Q\cap(0,1]$, and let $X=A\times A$. Let $\le$ be the usual linear order on $A$, and let $\preceq$ be the reverse lexicographic order on $X$ defined as follows: if $\langle p,q\rangle,\langle a,b\rangle\in X$, $\langle p,q\rangle\preceq\langle a,b\rangle$ iff either $q<b$, or $q=b$ and $p\le a$.

$X$ is the set of points of $(0,1]\times(0,1]$ with rational coordinates. Speaking pictorially, if $x$ and $y$ are points of $X$ with $x$ to the left of $y$, then $x\preceq y$; if $x$ and $y$ are on the same vertical line, then $x\prec y$ iff $x$ is below $y$.

A: Another way of visualizing $\omega^2$ as an order type is to embed it into the rationals: since the numbers $\left\{0, \frac{1}{2},\frac{3}{4}, \frac{7}{8},\ldots\right\}$ are an embedding of $\omega$ into the interval $\left[0,1\right)$, we can find our embedding of $\omega^2$ by simply placing $\omega$ copies of these — one for each natural number — side by side: $\left\{0, \frac{1}{2}, \frac{3}{4},\frac{7}{8},\ldots,1,1\frac{1}{2}, 1\frac{3}{4}, \ldots, 2, 2\frac{1}{2}, 2\frac{3}{4}, \ldots, 3, \ldots \right\}$ - in other words, all the numbers of the form $i+1-2^{-j}$, $i,j\geq 0$.


text:
Q: Excel Text Box Character Limitation In my excel workbook, WORKSHEET1 has a text box that contains the formula =SHEET2!B25. The text in the text box cuts off at 255 characters. If I create a 2nd text box on WORKSHEET1 and just enter text, I can go well beyond 250 characters.
Is there any workaround to the 255 character limit when using a formula in the text box to get text from another worksheet?

A: Right-click the text box when in Design mode (on the Developer tab), and select 'Properties'. In the Properties dialog, set Max Length to 0.

A: I can get the worksheet properties, but I can't get the text box properties. If I right-click on the text box and select the properties beside the design mode I get the worksheet properties dialog box as shown. If I right-click on the text box and select the "Size and Properties" from the drop-down menu, I just get the standard window for formatting the text box.
Properties Screenshots
I figured out the problem. I had inserted a text box using the INSERT tab / Insert text Box, not the DEVELOPER tab, Insert, Active X / Text Box.
Doing it this way I do get all of the text, but I lose the (bulleted) numbered list I had in the original text box. I don't see any way in the text box properties to have a numbered list within the Active X text box.

A: If you cannot come right with the string length using a text box, then you can also try the camera command in the newer versions of Excel.

*

*Place the cursor on the cell you want to display.

*Select the camera

*Go to the place in your workbook & click on the sheet

*Press enter

*it will display the cell in a window (similar to a text box)

You may need to include the camera function in the ribbon, for which you need to go to File/Options/Customize Ribbon/All Commands/Add>>


text:
Q: Move point along "recticircle" path Given a "recticircle":
$$\left(\frac{\operatorname{abs}\left(x\right)}{a}\right)^{2a/r}+\left(\frac{\operatorname{abs}\left(y\right)}{b}\right)^{2b/r}=1$$
with $a$ being the width, $b$ being the height and $r$ be the radius of the corners, which gives this kind of shapes:

How do I make a function in which a point follow its path?
For example, to make a point follow a circular path the following function is used:
$$x = \text{Math.sin(time)* rad;}$$
$$y =  \text{Math.cos(time) * rad;}$$
in which rad is the radius of the circle, and time is the current point of the simulation.

A: This parameterization should work:
$$
\DeclareMathOperator{\sign}{sign}
x=a\,\sign(\cos t)\,|\cos t|^{r/a},
\quad
y=b\,\sign(\sin t)\,|\sin t|^{r/b},
$$
where $\sign(\cdot)$ is the sign function.


text:
Q: Cursor.getCount() is negative (= -1) I tried to load a list of values from a table, but the cursor returns a length of -1?
Is there a possibility to view a sqlite database on a android emulator?
The Code which is buggy:
final Cursor c = db.query(
    ACCESS_TOKEN_TABLE,
    new String[] { ACCESS_TOKEN_COL_ID, ACCESS_TOKEN_COL_VALUE },
    ACCESS_TOKEN_COL_SERVER_ID + "=" + serverId,
    null,
    null,
    null,
    null);

public static final String COL_ID = "_id";
public static final String ACCESS_TOKEN_TABLE = "accesstoken";
public static final String ACCESS_TOKEN_COL_ID = COL_ID;
public static final String ACCESS_TOKEN_COL_SERVER_ID = "server_id";
public static final String ACCESS_TOKEN_COL_VALUE = "value";

And there is one entry in the database. The value of ServerID is 1 and there exists one entry, where the ServerID is 1.
Sincerely
xZise
PS: Two questions only to open the database.

A: you have an sqlite3 command if you "adb -e shell" with a CLI interface to the db.
better yet - i know of an eclipse plugin that can view sqlite database content using the ddms. but my personal favorite is to pull the db file out of the emulator, and use sqlite database browser to view the contents.

A: getCount() = -1 -> nothing to count... (are you sure your query is OK?)
Don't know about viewing sqlite db with Android emulator but you can use apps like Root Explorer to view Databases.

A: If the cursor is -1 the SQL statement is not returning any results. Maybe if you were to add the code you are using for your SQL select statement.
As for the second, viewing the DB - yes it is possible:

*

*In Eclipse, DDMS view, click on the name of the emulator in the Devices tab (If the Devices tab isn't showing: Window->Show View->Devices)

*Next click on the File Explorer tab (If the tab isn't showing: Window->Show View->File Explorer)

*Now browse through the file tree. You need to go to:
data/data/com.package.name/databases

*Now click on the name of the database you want to inspect. You will need to copy it to your computer. (To do this, click the picture of a floppy disc with an arrow on it. Save it somewhere you can find.)

*You will need an SQLite browser, like the SQLite Manager add-on for Firefox

*In Firefox, open the SQLite Manager (Tools->SQLite Manager)

*In SQLite Manager, click Database, Connect Database (You may have to change the file type from SQLite DB Files (.sqlite;) to All Files as the Android DB  doesn't have to have the .sqlite extension on the file)
Another option is to use the Questiod SQLite Browser plugin for eclipse - I have just added this - makes the above process twice as easy!

A: Ahr.... I was two lines to high:
So the problem isn't that the cursor returns a negative length, the problem is that it doesn't can give me the indexes of the columns.
I'm very sorry. Because of an totally other question, I posted a new question:
Cursor doesn't find columns?
Sincerely
xZise


text:
Q: Why is binaryreader stripping first byte of my file? So I am writing a program that will receive settings from a binary file in vb.net. I am reading 25 bytes at a time. However when I retrieve my byte array it is missing the first byte, and only the first byte.
        Dim bytes(24) As Byte
        Using fs As BinaryReader = New BinaryReader(File.Open(folder.SelectedPath & "\*********", FileMode.Open, FileAccess.Read))
            While fs.Read() > 0
                fs.Read(bytes, 0, bytes.Length)
            End While
            fs.Close()
        End Using

My resulting array will miss only the first byte which in my case is 0x40. Why is this happening and what should I do to avoid this?

A: It is because the fs.Read in While fs.Read() > 0 reads something from the stream, and thus the stream is no longer at position 0.
Here is how you should do it:
Dim bytes(24) As Byte
Using fs As BinaryReader = New BinaryReader(File.Open(folder.SelectedPath & "\*********", FileMode.Open, FileAccess.Read))

    Dim total_read As Integer

    While total_read < bytes.Length
        Dim read = fs.Read(bytes, total_read, bytes.Length - total_read)
        If read = 0 Then
            Exit While
        End If

        total_read += read
    End While
End Using


text:
Q: When did "lesbian" become well-known as a noun, not an adjective? A friend asked me earlier why it was that "gay" is an adjective, but "lesbian" is a noun. I've been doing some searching online, because it's an interesting question. According to etymonline, "lesbian" was originally an adjective describing someone from Lesbos; it got its modern sense because of the poet Sappho, who lived on Lesbos, and wrote a lot about female love.
The question is: when did it get this modern sense? But also, when did it stop becoming commonly used as an adjective?

A: As a noun meaning "native or citizen of the island of Lesbos," Lesbian has been used in English as a noun since the earliest translations of Herodotus and Thucydides. As a result, the notion of using lesbian as a noun when the later meaning of "a woman who is a homosexual" (Merriam-Webster's current definition) arose, around 1890, would not have struck many hearers as being a startling innovation. Interestingly, MW reports that both the noun lesbian and the noun sapphism (meaning "lesbianism") around 1890.
Though Sappho was well known to have been a native of Lesbos, one eighteenth-century makes no reference to her in expressing an unflattering opinion as to the licentiousness of the island's population (most particularly the men). From An Universal History, from the Earliest Account of Time to the Present, volume 3 (1738):

As to the morals of the ancient Lesbians, we cannot say any thing in their commendation ; they were given to all sorts of lewdness and debauchery, insomuch that to express the lewd and dissolute life of a debauchee, the antients used to say, that he lived like a Lesbian. [Hubert] Goltzius exhibits a medal [coin], which does no great honour to the Lesbian women.

I haven't found a picture of Goltzius's medal online; but another author observes that the medals of Lesbos were notably oriented toward sexuality. From Richard Knight, The Worship of Priapus and Its Connection with the Mystic Theology of the Ancients (1865):

It appears, too, that the act of generation was a sort of sacrament in the island of Lesbos ; for the device on its medals (which in the Greek republics had always some relation to religion) is as explicit as forms can make it.

William Guthrie, A New Geographical, Historical, and Commercial Grammar (1815) recounts Lesbos's past and continuing claims to fame:

It produces excellent oil and wine, the latter of which was anciently in high esteem, and still sells at a great price. It i famous for having been the native place of Sappho. The ancient Lesbians were accused of dissolute manners, and the modern inhabitants, it is said, too much resemble them in this respect.

And Julius Rosenbaum, The Plague of Lust: Being a History of Venereal Disease in Classical Antiquity (1901) reports that "irrumation" (oral sex performed on a man) was associated in ancient Greece with the island of Lesbos:

This the Greeks called λεσβιαζειν (to follow the Lesbian mode), because the vice was especially practiced by the Lesbian women, though in common with all others of the sort of the sort it came originally from Asia.

The connection between Sappho and the modern sense of lesbianism appears not to have been universally recognized in the nineteenth century. From Agnes Smith, Olympus and Its Inhabitants (1851):

The most celebrated victim of this extravagant superstition [that diving off a promontory on the island of Leucadia into the sea would cure one of unhappy memories of a lost love] was the fair Lesbian Sappho, whose immortal verses so well depict the passion which destroyed her. Its object, a beautiful youth of Mitylene, was a man insensible to the charms of mind or the power of genius, he despised her unsolicited love, and, unable either to conquer it or to bear its torments, she sought its remedy in the waters of Leucos.

On the other hand, William Mure, A Critical History of the Language and Literature of Antient Greece, volume 3 (1854) alludes to the sexual attraction of women to other women in connection with "the Lesbian vice":

Another delicate question involved in this inquiry, is that concerning the precise nature of the intercourse between Sappho and her female associates. It will neither be necessary nor agreeable here to dwell at any length on the chapter of Greek scandalous history with which this question connects itself, further than by remarking that the taste for impure intercourse, which forms so foul a blot on the Greek national character, was not confined to the male sex ; and that, among the females who had the chief credit of being infected with that taste, the Lesbians were so remarkable, as to have procured for it, under its several varieties, the distinctive title of the Lesbian vice. This certainly affords strong presumption that in a Lesbian female association, the main object of which was the pursuit of love and pleasure, even this eccentric variety of the passion was not likely to be excluded.
...
We may add, what is probably known to most men who have lived much in the world during the last half century, that, at different epochs of that period, the "Lesbian vice" has not only prevailed to a greater or less extent in certain European capitals, but has, in almost every such instance, numbered among its votaries females distinguished for refinement of manners and elegant accomplishments.

Mure's discussion in an appendix dedicated to a discussion of "the Lesbian vice" is especially interesting because in it he makes clear that his focus there is not on what Rosenbaum in 1901 calls "the Lesbian mode" of sexual interaction between men and women.
The earliest unmistakable instance of "a lesbian" in the modern sense of the term that a Google Books search returns is from Edgar Saltus, The Imperial Orgy: An Account of the Tsars from the First to the Last (1920):

Indulgent and cruel, prodigal and mean, a woman in whom every contradiction was resumed, Catherine was an empress who made enormous an empire already vast ; a tsarista who enumerated her victories and could not count her amours ; a conqueror who had Adonis for secretary of the treasury and Apollo for minister of war ; a cynic who slaughtered Poland and called herself a pupil of Voltaire ; a sovereign before whom the entire pageant of passion and glory unrolled ; a tyrant and a lesbian who passed through history dripping with blood and exhaling the perfume of Eros.

This is, of course, much later than the earliest citation in Merriam-Webster, and is undoubtedly a sign of the limitations of the Google Books database or search engine or both. The earliest Google Books match for lesbians is from Jacobus X, Crossways of Sex: A Study in Eroto-pathology, volume 2 (1904), which devotes a lengthy chapter to "Lesbians, Tribades, Fricarelles, and Saphists."

A: Adjective:
In 1890, the term lesbian was used in a medical dictionary as an adjective to describe tribadism (as "lesbian love").
Lesbianism, to describe erotic relationships between women, had been documented in 1870. The terms lesbian, invert and homosexual were interchangeable with sapphist and sapphism around the turn of the 20th century.
Noun:
The use of lesbian in medical literature became prominent; by 1925, the word was recorded as a noun to mean the female equivalent of a sodomite.
http://en.wikipedia.org/wiki/Lesbian#cite_note-Zimmerman.2C_20th_century_terminology-7


text:
Q: With ghc is there a way to import symbols that are not explicitly exported? I'm going to guess the answer is 'no', but is there a way to import a symbol from a module that is not explicitly export from said module?
I tried looking up various ghc (6.12.1) flags like -XPackageImports, but I don't see anything that will do what I want? (which is purely for doing some quick & dirty testing without re-compiling some other modules; i don't actually want to write code this way)

A: No.  There isn't even a dirty hack.  The .hi files which are used by the type checker to find out the types of things of imported modules only contain info about exported names.  The only way to change that is to edit the source file.

A: No


text:
Q: PHP 7 Mail() not working I have read I believe every post on here related to this.  I have a feeling that this is Linux file rights related, but not to sure. My environment is a test Centos7 box running Apache 2.4 and Php7 with phpMyAdmin etc.  I can send mail using the sendmail somename@domain.com.  I have tested this.
In my php.ini file(s) I have "sendmail_path = /usr/sbin/sendmail -t -i;"
$to = "Jesse.---@-----------.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: webmaster@example.com" . "\r\n" .
            "CC: somebodyelse@example.com";
$mail = mail($to,$subject,$txt,$headers); //I have tried with no headers as well.

The mail function  returns a false.

A: This problem can have so many reasons, that's why I am not using mail() anymore, I use PHPMailer with an external SMTP (GMAIL for example), but if you still want to use mail(), make sure that Sendmail, Exim or Postfix is installed on your server.
Test the mail() on the terminal first, if you can send on terminal, the problem may be some configuration on the php.ini, if the message fails on the terminal, you need to check the Postfix / Sendmail / Exim logs for the error message.
Make sure with your server provider too, if you are authorized to use mail(). Some servers block this function due to spam, and they require manual authorization.


text:
Q: Internal resistance problem
A 12V battery has an internal resistance of $2.0\Omega$. A load of variable resistance is connected across the battery and adjusted to have resistance equal to that of the internal resistance of the battery. Find the power dissipated.

The equation for internal resistance is
 $$\mathcal{E}=I(R+r)$$
where $R$ is the resistance in the circuit, $r$ is the internal resistance of the battery and $I$ is the current. We know that $\mathcal{E}=12V$. The sum of internal and external resistance would be $4 \Omega$, seeing as the variable resistor is set to $2 \Omega$, which adds to the already exisiting $2 \Omega$ from the battery.
The equation for power dissipated is
$$P=I^2R=\frac{V^2}{R}$$
So I substitued the value for $V$ and the value for $R$ to get
$$P=\frac{12^2}{4}=36$$
This is, however, wrong. Any ideas as to why?

A: Why do you substitute $R$ with 4? $R$ "is the resistance in the circuit", so it equals $2\Omega$, not $4\Omega$. There is another question though: do they need total dissipation or just dissipation in $R$?

A: You aren't applying your power equation correctly. You can't just plug in any voltage, current, or resistance.
The equation $P=IV$ gives you the power delivered or dissipated by a single part of the circuit with a potential drop $V$ across it and current $I$ flowing through it.
If you want the total power dissipated in the circuit, you must apply this to each element separately. If just the outer resistance, then only consider this resistor. I will leave this to you.

A: Your answer looks right to me as long as you want the total power dissipated (including in the battery).

A:

The question is a multiple choice and one of the answers state 'power dissipated in the battery is 18W'. This (C) is the correct answer as the total resistence in series is 4 ohms, the current through the load is 3A not 6A and the PD across the load is 6V.


text:
Q: Map network drive automatically via ps1 - not working I have a network drive (Z:, dedicated server) from which I am running all my development applications. Every now and then Windows 10 loses the ability to access the drive, in which case I typically type in net use Z: //xx.x.x.xx/abc. This works fine, but since it happens periodically I was looking to automate this process via a powershell script. This is what I came up with (newbie to powershell):
If ( !(Test-Path Z:) ) {
    Test-Path -Path "\\xx.x.x.xx\abc" -PathType Container
    net use Z: \\xx.x.x.xx\abc
} Else {
    Write-Host "**********`n*`n* Drive already mapped`n*`n**********`n"

    Read-Host -Prompt "Press Enter to exit"
}

The problem is that executing this file does not properly map the drive on my computer. Z is still unavailable, and only typing this out manually resolves the problem. This is the power shell error I get when trying to access the Z drive without proper mapping:
Set-Location : Cannot find drive. A drive with the name 'Z' does not exist.
At line:1 char:1
+ Set-Location $MyInvocation.MyCommand.Name
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Z:String) [Set-Location], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

Do I have to run the shell with privileges? How can I properly automate this?


text:
Q: How to query an rdf file locally with SPARQL in PHP I need to request an rdf file with some SPARQL Query. And I have to do it in PHP. I test my code with WAMP.
Is it possible to request rdf file locally with sparql query in php ? If yes, is it possible to do it with "Easyrdf". I found EasyRDF and i try it but I don't really know how it's work, I didn't find anyway to put rdf file locally in the code. So, if it's possible can you please check my code to see what's wrong with it ?
require "C:/Users/adela/vendor/autoload.php";

set_include_path(get_include_path() . PATH_SEPARATOR . '../lib/');
require_once "C:/Users/adela/easyrdf-0.9.0/lib/EasyRdf.php";
require_once "C:/Users/adela/easyrdf-0.9.0/examples/html_tag_helpers.php";
EasyRdf_Namespace::set('ns', 'http://www.it-sudparis.eu/family#');
EasyRdf_Namespace::set('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
EasyRdf_Namespace::set('rdfs', 'http://www.w3.org/2000/01/rdf-schema#');
EasyRdf_Namespace::set('owl', 'http://www.w3.org/2002/07/owl#');
EasyRdf_Namespace::set('xsd', 'http://www.w3.org/2001/XMLSchema#');
EasyRdf_Namespace::set('tg', 'http://www.turnguard.com/functions#');
EasyRdf_Namespace::set('cd', 'https://www.project_aikm_20170547/cd#');
$sparql = new EasyRdf_Sparql_Client('http://localhost/Knowledge_Project/lib/EasyRdf/Sparql');

$result = $sparql->query(
    'SELECT * WHERE {'.
    '  ?p ?s ?o .'.
    '}'
);
print_r($result);
foreach ($result as $row) {
    echo print_r($row);
}

There is no error and this is the result of the print_r($result):

EasyRdf_Graph Object ( [uri:EasyRdf_Graph:private] => http://localhost/Knowledge_Project/lib/EasyRdf/Sparql [parsedUri:EasyRdf_Graph:private] => EasyRdf_ParsedUri Object ( [scheme:EasyRdf_ParsedUri:private] => http [fragment:EasyRdf_ParsedUri:private] => [authority:EasyRdf_ParsedUri:private] => localhost [path:EasyRdf_ParsedUri:private] => /Knowledge_Project/lib/EasyRdf/Sparql [query:EasyRdf_ParsedUri:private] => ) [resources:EasyRdf_Graph:private] => Array ( ) [index:EasyRdf_Graph:private] => Array ( ) [revIndex:EasyRdf_Graph:private] => Array ( ) [bNodeCount:EasyRdf_Graph:private] => 0 [loaded:EasyRdf_Graph:private] => Array ( ) [maxRedirects:EasyRdf_Graph:private] => 10 )

I already check that the program doesn't go in the foreachloop.
PS:

Window version: 10 ; PHP version: 7.3.12 ; WAMP version: 3.2.0

Update:
If i pass in 7.4.1 version of PHP the script give a lot of error:


text:
Q: How can I pass entire card to another component on onClick button in ReactJS? I have two component Owner and Order. I have a card with a click button "Accept" on it in Owner Component. How can I make pass entire card to Order component on clicking the accept button. I want same card to appear to in Order component. I am using reactJs.
Below is part of Owner component, which has a card
import React, { Component } from 'react'

export default class Owner extends Component{

    constructor(props) {
        super(props);
    }

    render(){

        let { OrderID,CID,DeliveryEst,DeliveryInstructions,DriverID,Orders,PrepInsruction,RID,Status,Total } = this.props.indOrder;

        return(

{CID}

{RID}

                        {/*
Last updated 3 mins ago
 */}

                        <button type="button" onClick={() => {this.props.removeOrder(OrderID);this.props.showOrder(OrderID)}}class="btn btn-success btn-sm" style={{width:'50%'}}>Accept</button>

                        <button type="button" class="btn btn-danger btn-sm" style={{width:'50%'}}>Decline</button>

        )
    }
}

And this is the Order component where I want to display the card when I press accept button.
export default class Order extends Component {
  render() {

    return (

    )
  }
}

A: If I understand your question, you can pass state from parent to the child using props
Like:
<Card
  stateOfMyCard={() => this.isMyCardOpened()}
  ...otherPropsForExample
/>

isMyCardOpened is a function in your parent component.
In your child component, you get the props, and considering that is a function, you can call it whenever you want.
So, in the onClick event in your "Accept button" you should do this:
onClick={stateOfMyCard} or onClick={this.props.stateOfMyCard}

The second is if you haven't destructured your props
And if I have explained well, you should be display your card in parent and child components because setState is called from child and update state in parent.


text:
Q: Batch File filter ping result and append .csv I made a simple script of For /L loop ending at x times with a nested loop inside it while filtering ping results.
@echo off
setlocal enableextensions enabledelayedexpansion

for /L %%D in (1,1, x times) do (
for /f "delims=" %%A in ('ping -n 2 -l 64 192.168.0.1 ^|findstr /c:"Packets" /c:"Minimum"') Do
(CALL SET var=%%var%% %%A)
)
echo !var! >> pingresults.txt

endlocal

However, this code produces the results into a single line.
Packets: Sent = 2, Received = 2, Lost = 0 (0 loss),      Minimum = 1ms, Maximum = 3ms, Average = 2ms      Packets: Sent = 2, Received = 2, Lost = 0 (0 loss),      Minimum = 1ms, Maximum = 2ms, Average = 1ms      Packets: Sent = 2, Received = 2, Lost = 0 (0 loss),      Minimum = 2ms, Maximum = 3ms, Average = 2ms      Packets: Sent = 2, Received = 2, Lost = 0 (0 loss),      Minimum = 1ms, Maximum = 3ms, Average = 2ms      Packets: Sent = 2, Received = 2, Lost = 0 (0 loss),      Minimum = 2ms, Maximum = 7ms, Average = 4ms

Can anyone help me to resolve this one line results into multiple lines?
Besides, it would be helpful if someone can help convert and append the results into .csv with format as below:
  packetsent,packetrcv,packetloss,minlatency,maxlatency,avglatency,datetime
  2,2,0,2ms,7ms,4ms,datetimehere
  2,2,0,1ms,2ms,4ms,datetimehere

A: My project need to run repetitive ping for 120 loops with 50 packet count each loop.
BTW, I found the solution:
@echo off
setlocal enabledelayedexpansion

echo This Ping Test expected to be finished within 1.6 hours...
echo packetsent,packetreceived,packetloss,minlatency,maxlatency,avglatency,timestamp > ping.csv

(for /l %%A in (1,1,120) do (
  for /f "tokens=2,4,6 delims=,=(" %%i in ('ping 192.168.0.1 -n 50 -l 64 ^| findstr "Packet Minimum"') do (
     set all=!all!, %%i,%%j,%%k
     set all=!all: =!

)
echo !all:~1!,!date! !time!
set "all="

) ) >> ping.csv
Echo ***Ping Test completed.***
pause

Output on cmd should look like this:
C:\>ping.bat
This Ping Test expected to be finished within 1.6 hours...
2,2,0,25ms,26ms,25ms,Thu 10/06/2021  3:55:23.68
2,2,0,25ms,25ms,25ms,Thu 10/06/2021  3:55:24.79
2,2,0,24ms,25ms,24ms,Thu 10/06/2021  3:55:25.94
2,2,0,25ms,49ms,37ms,Thu 10/06/2021  3:55:27.05
2,2,0,25ms,26ms,25ms,Thu 10/06/2021  3:55:28.15
..........
***Ping Test completed.***
Press any key to continue . . .

Sorry, English is not my native language :)


text:
Q: Heredoc not working <?php

$information = <<<INFO
Name: John Smith
Address: 123 Main St
City: Springville, CA
INFO;

echo $information;

?>

Result:

Parse error: syntax error, unexpected T_SL on line 3

A: Heredoc syntax has some strict rules we have to consider;
1 - There shouldn't be any character after opening identifier
True
"$a = <<<HEREDOC"

False
"<<<HEREDOC   "   //Remove space after opening identifier;

2 - There shouldn't be any other character after and before closing identifier except delimiter semicolon ; at the end. Also no indentation is allowed.
True
"HEREDOC;"

False
"HEREDOC  ;"   //Remove space between HEREDOC and ;

False
" HEREDOC;"   //Remove space before HEREDOC

False
"HEREDOC; "   //Remove space after ;

Heredoc string.
END;

A: I've just edited your question and fixed invalid formatting (SO is using Markdown). I found out that there is a space character after <<<INFO - that causes the error.
Delete that space and everything should work fine... well - it has to works fine.

A: The parser is complaining because you have whitespace after the angled brackets declaring a heredoc. You need to make sure you're actually following the heredoc syntax, which you can find on the PHP Manual site (specifically:  http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc).
<?php
$information = <<<ENDHEREDOC
this is my text
ENDHEREDOC;
echo $information;

A: https://repl.it/@CiscoTest/PHP-Heredocs-lesslessless
    <?php
        //Heredocs start with <<< and a token ended with semi-colon
        print <<< ENDHEREOK
        We used ENDHEREOK "as" our token
              Looks like it just "print"
              things "as" it is. Let me loooook at what I just typed

        I may add some more! I m gonna end it using ENDHEREOK but any token can be used
        Give it a "try"! Also pay attention to so many double quotes because it is mandatory!
         Also yes "if" you put
        space after token(ENDHEREOK) above, you will get an error, just hit enter key after token!
        Try this on repl.it
        https://repl.it/@CiscoTest/PHP-Heredocs-lesslessless
        ENDHEREOK;
        ?>


text:
Q: Why isn't this allowed before super() I have been coding in React js. I have read that in ES6 classes to access 'this' we need to first call super(props) and I would like to know why this is.Answers I have found mainly talk about Javascript being unable to know what 'this' is unless superclass is called. I would like to know what that means because outside the constructor, 'this' is recognized and we don't call super(props) each time.
class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = { /* initial state */ };
  }
}

A: Constructor function will return 'this' by default. According to oops concept child class always inherit 'this' object from parent class by super() call. so if we try to use this in child class without super call it will throw an error.
If we return anything except 'this' from child class then super() call is not necessary.
I have explained by some simple examples.
example 1
class A {
  constructor() {
    this.a = 0;
  }
}

class B extends A {
    constructor() {
        console.log(this);
    }
}
const instanceA = new A();
console.log(instanceA) // A {a: 0}
const instanceB = new B();
console.log(instanceB) // Error: Must call super constructor in derived class before
accessing 'this' or returning from derived constructor

example 2
class A {
  constructor() {
    this.a = 0;
  }
}

class B extends A {
    constructor() {
      return {b: 3}
    }
}
const instanceA = new A();
console.log(instanceA) // A {a: 0}
const instanceB = new B();
console.log(instanceB) // Object {b: 3}

example 3
class A {
  constructor() {
    this.a = 0;
  }
}

class B extends A {
    constructor() {
      super()
    }
}

const instanceB = new B();
console.log(instanceB) // B {a: 0}

A:
The constructor method is a special method for creating and initializing an object created with a class. There can only be one special method with the name "constructor" in a class. A SyntaxError will be thrown if the class contains more than one occurrence of a constructor method. A constructor can use the super keyword to call the constructor of a parent class.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
It means if you have class MyComponent extends React.Component you always need super() call in order to make this defined.

If you don't specify a constructor method, a default constructor is used.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/constructor#Default_constructors
Constructor of superclass should be called before this in order to finish configuration of this before subclass started configuration of this. Otherwise superclass constructor could get this modified by subclass. Superclass should not know something about subclasses. That is why super() call in constructor should be before access to this.

A: This is really complicated, unfortunately.

The short story: access of this in a subclass before super() call is not allowed, because in ES6 this is being born in the base class, therefore super() is needed to initialize it.
For more information, refer to 15.6.2 Allocating and initializing instances1. The author is one of the few people that explains this in detail.
Here is a relevant sample from the book1 above.

Under the hood, it roughly looks as follows.

// Base class: this is where the instance is allocated
function Person(name) {
    // Performed before entering this constructor:
    this = Object.create(new.target.prototype);

    this.name = name;
}
···

function Employee(name, title) {
    // Performed before entering this constructor:
    this = uninitialized;

    this = Reflect.construct(Person, [name], new.target); // (A)
        // super(name);

    this.title = title;
}


text:
Q: File system error in ms flow from powerapps When create file system in ms flow using power apps its getting error like

Unable to process template language expressions in action 'Create_file' inputs at line '1' and column '2179': 'The template language expression 'json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$connections']['shared_filesystem']['connectionId']'
  cannot be evaluated because property 'shared_filesystem' doesn't exist, available properties are ''.
  Please see https://aka.ms/logicexpressions for usage details.'.

A: Are you using Test then Use tests from previous runs? Try using I'll perform the trigger action instead.
I've seen the error you mentioned after you add an action which requires a new Connection, but try to use previous test runs that do not have the Connection established.
(If that makes sense)


text:
Q: Is there a way to shorten something like this? In this part of the code, a scanner asks the user to input a number between one and five. I will need to rewrite this for a bunch of variables, so is there any way to make it shorter?
if (Q1 != 1 || Q1 != 2 || Q1 != 3 || Q1 !=4 || Q1 != 5) {
    System.out.println("Error: Please enter a number between 1 and 5.");
}

Instead of typing Q1 != 1 or 2 or 3 etc, is there a way to write 1-5 or something like that?

A: Try this,
if(Q1 <1 || Q1 >5) System.out.println("Error: Please enter a number between 1 and 5.")

A: For the general case, use a set.
Declare a class field, or a local variable:
Set<Integer> accepted = new LinkedHashSet<>(Arrays.asList(1,2,3,4,5));

Then:
if (!accepted.contains(Q1))
    System.out.println("Error: Please enter a number that is one of: " + accepted);

Use LinkedHashSet so the printed version has the same order as the declaration.

A: The above answers are nice for this specific problem, but if you have 5 separate Strings for example, and you want to check if each of them are valid (they aren't null or empty), then you should create a method, to do that.
public boolean isValid(String... args) {
    for (String s : args) {
        if (s == null or s.equals("")) {
            //Something is invalid
            return false;
        }
    }
    //Everything is valid
    return true;
}


text:
Q: How to disable the all network adaptor or interface into down state during the startup in MAC OSX I am new to MAC architecture.
I need to disable all the network adaptors during the System startup.
I have no idea to solve.
Is it possible add the commands like
sudo ifconfig en0 down;
 sudo ifconfig en1 down
into the startup scripts ?? or
it is best to write daemons ??
Please suggest me some good solutions to solve this problem ..
Thanks in Advance :)

A: I'm not sure exactly what you're trying to accomplish, so it's a bit hard to make solid recommendations. My understanding is that OS X's interfaces start off in the down state, then are configured & brought up by the configd daemon, based on the configuration in /Library/Preferences/SystemConfiguration/*. So, I see several ways to do something along these lines:

*

*Configure the network settings to make all interfaces inactive (either in System Preferences -> Network pane, or with the networksetup command), and let configd apply them. Note that you'd have to make this change before shutting down in order for it to be the active config at startup.

*Somehow set the network config during startup before configd reads it. This is going to be very difficult, since OS X doesn't use a sequenced startup process; it just launches all of the various daemons, and lets them sort themselves out. Thus, trying to get your daemon to run before configd will be a crapshoot at best. (Actually, I can think of ways, but ... they're ugly.)

*Make another daemon that waits until configd activates the network interfaces, then turns them back off. And then watches to make sure configd doesn't turn them back on... Ick.
Basically, all of these approaches are problematic. But depending on what your actual goal is, there might be a better way.

A: Thanks Gordon,
Finally I got a solution to my problem.
I used a bash script + plist,
#disable_internet.sh ( Executive Permission using chmod )

    #!/bin/sh
    sudo ifconfig en0 down > /dev/null 2>&1

#com.disable.interent.startup.plist

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>com.symantec.disable.internet</string>
        <key>ProgramArguments</key>
        <array>
            <string>/Users/Shared/disable_internet.sh</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>OnDemand</key>
        <false/>
        <key>Nice</key>
        <integer>1</integer>
        <key>StartInterval</key>
        <integer>30</integer>
        <key>StandardErrorPath</key>
        <string>/dev/null</string>
        <key>StandardOutPath</key>
        <string>/dev/null</string>
    </dict>
    </plist>

##############
used a command:
##############
Before restart:

    sudo cp /Users/Shared/com.disable.interent.startup.plist /Library/LaunchDaemons/com.disable.interent.startup.plist

    sudo launchctl load -w /Library/LaunchDaemons/com.disable.interent.startup

After restart, when job is done:

    sudo launchctl load -w /Library/LaunchDaemons/com.disable.interent.startup

    sudo rm -rf /Library/LaunchDaemons/com.disable.interent.startup.plist

    sudo ifconfig en0 up


text:
Q: ServiceStack - Timeout Expired caused by max application pool size I'm using ServiceStack's funq and I have code below in my AppHost file. The API hit timeout expired error due to application pool size hits maximum limit.
    var dbFactory = new OrmLiteConnectionFactory(string.Empty, SqlServerDialect.Provider);

...

// Loop to get multiple different country connection string
foreach (string server in countryCodeList)
{
    dbFactory.RegisterConnection(server, connectionString, SqlServerDialect.Provider);
}

this.RequestFilters.Add((httpReq, httpRes, requestDto) =>
{
    requestInfo = requestDto.Dump();
    ...
    container.Register<IReferenceRepository>(c => new ReferenceRepository(dbFactory, baseModel.db_country_code));
    container.Register<ICompanyRepository>(c => new CompanyRepository(dbFactory, baseModel.db_country_code));
    ...
});

I have implemented IDisposable in my Repository base class. But it does not seem dispose the connection at the end of each request. In the perfmon.exe can see the NumberOfPooledConnections is keep increasing for each request without dropping.
Codes in Repository bass class:
public class Repository : IDisposable
{
    protected IDbConnectionFactory dbFactory { get; set; }
    public string CountryCode { get; set; }
    private IDbConnection db;

    public Repository(IDbConnectionFactory dbConnectionFactory, string countryCode)
    {
        this.dbFactory = dbConnectionFactory;
        this.CountryCode = countryCode;
    }

    protected virtual IDbConnection Db(string connectionKey)
    {
        return db ?? (db = dbFactory.OpenDbConnection(connectionKey));
    }

    public virtual void Dispose()
    {
        if (db != null)
            db.Dispose();
    }
}

Just wondering if adding ReusedWithin(ReuseScope.Request) into container.Register part will it helps?
Can anyone guide me if I'm doing in the correct way? Thanks in advance.
Edited: The API request will call from one service to the other and it gets data from different repository.

A: All dependencies in ServiceStack should be registered in AppHost.Configure() which runs once on StartUp and should be considered immutable thereafter.
You should not be registering dependencies in a RequestFilter (which gets run on each request).
OrmLiteConnectionFactory (like all factories in ServiceStack) are designed to be registered as a singleton, which is also the default lifetime in Funq, i.e:
container.Register<IDbConnectionFactory>(
    c => new OrmLiteConnectionFactory(connString, SqlServerDialect.Provider));

You can then resolve it from the IOC in order to register your named connections, e.g:
var factory=(OrmLiteConnectionFactory)container.Resolve<IDbConnectionFactory>();
foreach (string server in countryCodeList)
{
    factory.RegisterConnection(server, connString, SqlServerDialect.Provider);
}

All other dependencies like your repositories should also be registered in AppHost.Configure(). If it implements IDisposable and has ReuseScope of None or Request it will be disposed of at the end of the request.
Using Request Data to Create Dependencies
As dependencies needs to be registered on StartUp it doesn't have access to Request data. If that's what's needed it needs to be passed in at run-time.
You can reduce boilerplate by adding it to a base Service class, e.g:
public abstract class AppServiceBase : Service
{
    public IDbConnectionFactory DbFactory
    {
        get { return TryResolve<IDbConnectionFactory>(); }
    }

    ReferenceRepository refRepo;
    public ReferenceRepository ReferenceRepo
    {
        get
        {
            if (refRepo == null)
                refRepo = new ReferenceRepository(
                    DbFactory.OpenDbConnection(Request.Param("c_code")));

            return refRepo;
        }
    }

    public override Dispose()
    {
        base.Dispose();

        if (refRepo != null)
           refRepo.Dispose();
    }
}

Which your services can then access like a normal dependency, i.e:
public class MyService : AppServiceBase
{
    public object Get(Request request)
    {
        var foo = ReferenceRepo.GetById(request.Id);
    }
}


text:
Q: React - Iterate through state using map function I'm relatively new to React and creating a ToDoList style Recipe App. The user should be able to add new recipes to the list as well as delete or edit existing recipes.
I ran into an issue getting the ingredients to display on separate lines and asked this question on how to do that. The end result was that I added a second .map function within my container to iterate through ingredients and display each one as a new paragraph element. Here is my container, Item.js:
import React from 'react';
import Button from 'react-bootstrap/lib/Button';

const Item = (props) => (

      {/* Iterates through recipe item names and displays them */}
      {props.items.map((item, index) => {
        return (

{item}

         // This is what I added
        {/* Iterates through recipe ingredients and displays them*/}

          {props.ingredients[index].map((ingredient, ingredientIndex) => {
            return (

                {ingredient}

            )
          })}

          <Button className="edit-button" onClick={() => props.edit(item, index)}>Edit</Button>
          <Button className="delete-button" onClick={() => props.delete(item, index)}>Delete</Button>

      );
    }
  )}

)

export default Item;

Now the initial recipes within my state properly display ingredients on new lines, and any recipe item the user edits also displays ingredients on a new line. Exactly what I wanted.
The issue is when the user adds a new recipe the ingredients aren't displayed on new lines the way I want. If you click the add new recipe button and add a new one the ingredients are displayed side by side and as one single paragraph element.
I have two functions that handle adding a new recipe and editing an existing recipe, onSubmit and onEditSubmit. onEditSubmit is working fine because when recipes are edited the ingredients display properly on separate lines. onSubmit is the issue. How can I change onSubmit and get it to display ingredients on new lines and as separate paragraphs? I think this is an issue with how I am setting state within onSubmit and might involve the use of the spread operator.
Here is my App.js:
import React, { Component } from 'react';
import Item from './Item';
import './App.css';
import ModalComponent from './Modal.js';
import Button from 'react-bootstrap/lib/Button';
import EditModalComponent from './EditModal.js';
import SimpleStorage from "react-simple-storage";

export default class App extends Component {
  constructor(props) {
    super(props);

    this.state = {
      items: ["Pumpkin Pie", "Spaghetti", "Onion Pie"],
      ingredients:[
        ["Pumpkin Puree ", "Sweetened Condensed Milk ", "Eggs ", "Pumpkin Pie Spice ", "Pie Crust "],
        ["Noodles ", "Tomato Sauce ", "(Optional) Meatballs "],
        ["Onion ", "Pie Crust "]
      ],

      // Recipe name and ingredients
      inputVal: '',
      ingredientVal: '',
      // Recipe name and ingredients when user is editing existing recipe
      inputValEdit: '',
      ingredientValEdit: '',
      // Controls whether forms are displayed or hidden
      showRecipeForm: false,
      showRecipeEditForm: false,
      // Index to select which recipe item is being edited
      editingIndex: ''
    };

  }

  // Get text user inputs for recipes
  handleChange = (event) => {
    this.setState({ [event.target.name]: event.target.value });
  };

  // When user submits recipe this adds it to the list
  onSubmit = (event) => {
    event.preventDefault();

    this.setState({
      items: [...this.state.items, this.state.inputVal],
      ingredients: [...this.state.ingredients, [this.state.ingredientVal]],
      showRecipeForm: false
    });

  }

  // When user edits existing recipe this adds it to the list
  onEditSubmit = (event) => {
    event.preventDefault();
    const {items, ingredients, inputValEdit, ingredientValEdit, editingIndex} = this.state;

    // Selects proper recipe item to edit
    items[editingIndex] = inputValEdit;
    ingredients[editingIndex] = ingredientValEdit.split(',');

    this.setState({
      items: items,
      ingredients: ingredients,
      inputVal: '',
      ingredientVal: '',
      showRecipeEditForm: false
    });
  }

  closeRecipeForm = () => {
    this.setState({
      showRecipeForm: false,
      showRecipeEditForm: false
    });
  }

  // Shows recipe
  AddRecipe = (bool) => {
    this.setState({
      showRecipeForm: bool
    });
  }

  // Is called when one of the edit recipe buttons is clicked, shows RecipeEditForm
  edit = (item, index) => {
    this.setState({
      showRecipeEditForm: !this.state.showRecipeEditForm,
      editingIndex: index
    });
  }

  // Deletes recipe item from the list
  delete = (item, index) => {
     this.setState({
      ingredients : this.state.ingredients.filter((_, i) => i !== index),
      items: this.state.items.filter((_, i) => i !== index)
    });
  }

  render() {
    return (

        {/* Handles storing data in local sessions via react-simple-storage*/}
        <SimpleStorage parent={this} />

Recipe List

        <ModalComponent
          inputVal={this.state.inputVal}
          handleChange={this.handleChange}
          ingredientVal={this.state.ingredientVal}
          onSubmit={this.onSubmit}
          addRecipe={this.addRecipe}
          showRecipeForm={this.state.showRecipeForm}
          closeRecipeForm={this.closeRecipeForm}
        />

        <EditModalComponent
          inputValEdit={this.state.inputValEdit}
          handleChange={this.handleChange}
          ingredientValEdit={this.state.ingredientValEdit}
          onEditSubmit={this.onEditSubmit}
          closeRecipeForm={this.closeRecipeForm}
          addRecipe={this.addRecipe}
          showRecipeEditForm={this.state.showRecipeEditForm}
        />

        <Item
          items={this.state.items}
          ingredients={this.state.ingredients}
          edit={this.edit}
          delete={this.delete}
        />

      <Button className="add-recipe-button" onClick={this.AddRecipe}>Add New Recipe</Button>

    );
  }

}

Do I need to make onSubmit more similar to onEditSubmit? If so how can I do this?

A: In your store, your ingredients variable is an array of arrays.[ [a, b] , [c, d]]
You need to follow this format as you did in onEditSubmit. The .split() function return an array and save it into state.
Change the part in onSubmit
this.setState({
    items: [...this.state.items, this.state.inputVal],
    ingredients: [...this.state.ingredients, [this.state.ingredientVal]],
    showRecipeForm: false
});

to
this.setState({
    items: [...this.state.items, this.state.inputVal],
    ingredients: [...this.state.ingredients, this.state.ingredientVal.split(',')],
    showRecipeForm: false
});


text:
Q: Problem using the table tag I am trying to use the table tag to contruct a section of my site. Basically, I want a three column table with each column separated from each other and having a styled border round it (e.g 1px solid #000000).
I understand each table column cannot be separated with margins using CSS so i used border-spacing and border-collapse property as follows.
border-collapse:separate;
border-spacing:10px 50px;

The above partically worked in that the columns got separated however, i was unable to have a surrounding border on each column.
Any ideas would be greatly appreciated.

A: I think you need to put the border on individual td elements.  It's awkward because that means you have to put top and bottom borders on td's in top and bottom rows.  Scott may be right that you want to use div's instead, but then again for all we know it is tabular data you are displaying, and you just want it styled a particular way.
edit:
Here, this seems to do what you want, if a tad kludgy, and with the caveat that on early versions of IE, firstChild and lastChild only work with the right DOCTYPE:
table { border-collapse: separate;  border-spacing:  2px 0; }

td { border: solid black;  border-width: 0px 1px;}

tr:first-child td {
border-top-width: 1px;
}

tr:last-child td {
border-bottom-width: 1px;
}

A: I think you would be better served providing a link to the page with the data/content you want structured. As I stated earlier in this post, I'm of a mind to think that nested divs would serve you well. This is turning into a 'discussion' rather than an 'answer.'

A: You might consider reading up on the <div> tag; using tables for layout is frowned upon these days.

A: I concur with Scott. Tables are for data. Divs are for formatting. You'll likely also have to do some homework on Cascading Style Sheets if you're not familiar with them.


text:
Q: how can i mark class serializable defined in silverlight project? how can i mark  class serializable defined in silverlight project. i m trying to add assembly reference of using System.Runtime.Serialization but still its not allowing me to mark a class serializable

A: Are you just trying to attribute your type with the Serializable attribute?
That exists in the System namespace rather than System.Runtime.Serialization. Have you imported the System namespace? See SerializableAttribute class
Unless I've missed something, in which case your question probably needs more detail.
Edit: See this question about Serialization in Silverlight 4


text:
Q: How to add several ports to FirewallException in Wix? I use property PORTS to pass some http ports to my installation.
Then these ports will be stored into init file and used by the application.
I need to add these ports to FirewallException?
But following code does not work:
<Component Id="fwException" Guid="MyGUID">
   <Condition>Privileged</Condition>
   <RegistryKey Root="HKCU" Key="Software\Company\[ProductName]">
      <RegistryValue Name="fwException" Value="1" KeyPath="yes" Type="integer" />
   </RegistryKey>

   <fire:FirewallException Id="My_Ports" Name="My Node.exe" Profile="domain" Port="[PORTS]" Protocol="tcp" Scope="localSubnet"/>
</Component>

How to add several ports to FirewallException?

A: Summary
In WIX 3.9 (and earlier), the FirewallExtension only supports a single integer for the Port attribute. The Port attribute supports Formatted values, but the result of the formatting must still be a single integer.  In your case [PORTS] must evaluate to a single integer.
If the Port attribute is set to 'Not a number', you would typically see this error in the installation log:
SchedFirewallException:  Error 0x80070057: failed to parse record field: 3 as number: Not a number

From @Sean's comment, multiple ports should work in WIX 3.10.  See http://wixtoolset.org/issues/4206/ for details of the feature request.
Workaround for WIX 3.9 and Earlier
It is possible to work around this restriction by using FirewallExtension delcarations:
<Component Id="fwException" Guid="-- YOUR GUID --">
  <Condition>Privileged</Condition>
  <RegistryKey Root="HKCU" Key="Software\Company\[ProductName]">
  <RegistryValue Name="fwException" Value="1" KeyPath="yes" Type="integer" />
  </RegistryKey>

  <fire:FirewallException Id="My_Port1" Name="My Node.exe" Profile="domain" Port="[PORT1]" Protocol="tcp" Scope="localSubnet"/>
  <fire:FirewallException Id="My_Port2" Name="My Node.exe" Profile="domain" Port="[PORT2]" Protocol="tcp" Scope="localSubnet"/>
</Component>

If you need a variable number of ports (up to a pre-defined maximum limit) you could try 1 firewall extension per component with a condition on each component:
<Component Id="fwException1" Guid="-- YOUR GUID --">
  <Condition>Privileged AND PORT1</Condition>
  <RegistryKey Root="HKCU" Key="Software\Company\[ProductName]">
  <RegistryValue Name="fwException1" Value="1" KeyPath="yes" Type="integer" />
  </RegistryKey>

  <fire:FirewallException Id="My_Port1" Name="My Node.exe" Profile="domain" Port="[PORT1]" Protocol="tcp" Scope="localSubnet"/>
</Component>

<Component Id="fwException2" Guid="-- YOUR GUID --">
  <Condition>Privileged AND PORT2</Condition>
  <RegistryKey Root="HKCU" Key="Software\Company\[ProductName]">
  <RegistryValue Name="fwException2" Value="1" KeyPath="yes" Type="integer" />
  </RegistryKey>

  <fire:FirewallException Id="My_Port2" Name="My Node.exe" Profile="domain" Port="[PORT2]" Protocol="tcp" Scope="localSubnet"/>
</Component>

From the command line you would specify multiple ports as: PORT1=7071, PORT2=7072, and so on.  How suitable this is depends on the maximum number of ports you need to specify.


text:
Q: How to compare two excel files and replace the matching value in one of the excel file column where the match found using C#? I have two excel sheet files say Excel1 and Excel2.
In Excel1, I have two columns as -
COL A and COL B with around 10000 rows data.
In Excel2, I have three columns as -
COL1, COL2 and COL3
From above two excel, COLA(From Excel1) and COL1(Excel2) has the same entries.
Depending on the matching string, I have to copy the COLB value from Excel1 to COL3 of Excel2.
Can anyone please guide me on this, how to do it using C#?
Thanks,


text:
Q: Turn ON/OFF 5V 2-5A by Raspberry Pi GPIO I need to control few 5V 2-5A devices by rpi GPIOs, which has the 3.3V logic level. I come up with a simple circuit, but I'll appreciate any ideas, corrections, suggestions. The LOAD is something like a powerful LED flashlight (pure real load, without reactive elements). It won't turn on/off often (once in a few minutes), so it shouldn't be a big problem with frequencies. All LOADs have common ground wire: they are parts of one device and all connected to the ground wire and chassis.
Is the circuit correct? Is it possible to improve it? MOSFET is 100V, is there any better choice?

UPDATE
After @brhans comment, I'm considering also Mosfet IRF9540 (it can work with 3A at 5V) or several FDN340P, but they are in SOT23 package (hard to assemble with my equipment). Is IRF9540 a better choice?


text:
Q: PowerShell unable to compress and delete source files in my desktop I need to fix an issue with the PowerShell command to compress and delete the .CSV files from my desktop.
The error is as follows:
At line:14 char:5
+     Compress-Archive @paramCompressArchive
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Get-ChildItem -...ldersStats.CSV":String) [Compress-Archive], InvalidOperationException
    + FullyQualifiedErrorId : ArchiveCmdletPathNotFound,Compress-Archive

This is my script so far, which is part of my larger script, but I just need to fix the issue on the moving to ZIP archive and then delete section:
$MailboxName = 'My.UserName@domain.com'
try {
    $paramCompressArchive = @{
        Path            = 'Get-ChildItem -Path "$([Environment]::GetFolderPath("Desktop"))\"
                                         -Include "$($MailboxName)-RetentionPolicyTags.CSV",
                                                  "$($MailboxName)-Details.CSV",
                                                  "$($MailboxName)-Diagnostic.CSV",
                                                  "$($MailboxName)-MRMLogs.CSV",
                                                  "$($MailboxName)-MbxStats.CSV",
                                                  "$($MailboxName)-MbxFoldersStats.CSV",
                                                  "$($MailboxName)-ArchiveMbxFoldersStats.CSV"'
        DestinationPath = "$([Environment]::GetFolderPath("Desktop"))\$($MailboxName).ZIP"
        Force           = $true
    }

    Compress-Archive @paramCompressArchive

    $paramRemoveItem = @{
        Path    = "$([Environment]::GetFolderPath("Desktop"))\"
        Include = "$($MailboxName)-RetentionPolicyTags.CSV",
                    "$($MailboxName)-Details.CSV",
                    "$($MailboxName)-Diagnostic.CSV",
                    "$($MailboxName)-MRMLogs.CSV",
                    "$($MailboxName)-MbxStats.CSV",
                    "$($MailboxName)-MbxFoldersStats.CSV",
                    "$($MailboxName)-ArchiveMbxFoldersStats.CSV"
        Force   = $true
        WhatIf  = $true
    }

    Remove-Item @paramRemoveItem
}
catch {
    $error[0].exception.gettype().fullname
}

A: Continuing from my comment, you can create variables only once in your code like and use these like:
$MailboxName = 'My.UserName@domain.com'
$Path        = [Environment]::GetFolderPath("Desktop")
$Include     = 'RetentionPolicyTags', 'Details', 'Diagnostic', 'MRMLogs',
               'MbxStats', 'MbxFoldersStats', 'ArchiveMbxFoldersStats' | ForEach-Object {
                   '{0}-{1}.csv' -f $MailboxName, $_
               }

# get the list of files to process
$files = (Get-ChildItem -Path $Path -Filter '*.csv' -File -Recurse -Include $Include).FullName
# create a Hashtable for splatting (used for both Compress-Archive and Remove-Item)
$paramCompressAndDelete = @{
    Path            = $files
    DestinationPath = Join-Path -Path $Path -ChildPath ('{0}.ZIP' -f $MailboxName)
    Force           = $true
}

try {
    Compress-Archive @paramCompressAndDelete
    # now use the same splatting Hashtable for deletion
    $paramCompressAndDelete.Remove('DestinationPath')
    Remove-Item @paramCompressAndDelete -WhatIf
}
catch {
    throw
}

A: The error is because of the quoting around the command that you want to use to get the paths of the files to compress:

 Path            = 'Get-ChildItem -Path  ... '

Just remove the quotes and also make sure that you extract the full path (.Fullname) from the Get-ChildItem output.
Also, for -Include to work, the -Path argument must end with a wildcard (*).
To remove code duplication, define the include list as an array at the beginning, so you can use it for both Compress-Archive and Remove-Item. Further code duplication can be avoided by storing the result of [Environment]::GetFolderPath() into a variable.
$includeList = @(
    "$($MailboxName)-RetentionPolicyTags.CSV"
    "$($MailboxName)-Details.CSV"
    "$($MailboxName)-Diagnostic.CSV"
    "$($MailboxName)-MRMLogs.CSV"
    "$($MailboxName)-MbxStats.CSV"
    "$($MailboxName)-MbxFoldersStats.CSV"
    "$($MailboxName)-ArchiveMbxFoldersStats.CSV"
)

$desktopDir = [Environment]::GetFolderPath('Desktop')
$desktopDirWildCard = Join-Path $desktopDir *

$items = Get-ChildItem -Path $desktopDirWildCard -Include $includeList

$paramCompressArchive = @{
    Path            = $items.Fullname   # Creates array of full paths
    DestinationPath = Join-Path $desktopDir "$MailboxName.ZIP"
    Force           = $true
}

Compress-Archive @paramCompressArchive

$paramRemoveItem = @{
    Path    = $desktopDirWildCard
    Include = $includeList
    Force   = $true
    WhatIf  = $true
}

Remove-Item @paramRemoveItem


text:
Q: Dynamically created DropDownList no firing event. yes, Autopostback is set to TRUE Below is my code for a dynamic dropdownlist. It does generate the HTML properly. However, the event is not fired. And, when I change the event name to "onchange" it gives me a compile error saying that it couldn't find the script. By it's there in my code-behind.
Also, I'm adding this in the OnInit page event.
pValueCmbBox.Attributes.Add("runat", "server");
pValueCmbBox.SelectedIndexChanged += new EventHandler(ddlParent_SelectedIndexChanged);
pValueCmbBox.Attributes.Add("OnSelectedIndexChanged", "ddlParent_SelectedIndexChanged");
pValueCmbBox.Attributes.Add("AutoPostBack", "True");

*

*Why isn't OnSelectedIndexChanged being fired?

*Is "onchange" only for calling javascript?

*Should I implement this as an ASCX instead?

A: To answer my own question...
I ended up making an ASCX out of it and now it works fine!

A: 1)  It doesn't work because you're not adding the attribute "AutoPostBack" the way you should.
pValueCmbBox.Attributes.Add("runat", "server"); //doesn't make sense...it's just for decoration...because you can't use in page behind code
pValueCmbBox.SelectedIndexChanged += new EventHandler(ddlParent_SelectedIndexChanged); //this line it's okay
pValueCmbBox.Attributes.Add("OnSelectedIndexChanged", "ddlParent_SelectedIndexChanged"); //this it's not necessary at all...because you already specified through pValueCmbBox.SelectedIndexChanged
pValueCmbBox.Attributes.Add("AutoPostBack", "True"); //this is the problem

As you can see in here, SelectedIndexChanged "Occurs when the selection from the list control changes between posts to the server." . So you had a good idea regarding AutoPostBack = true; You should have written:
pValueCmbBox.AutoPostBack = true;

And now for the runat="server" problem you can set your page behind function as following:
protected void ddlParent_SelectedIndexChanged(object sender, EventArgs e)
{
 DropDownList c = (DropDownList)sender; //this is your pValueCmbBox that you set it in OnInit
 //more code here
}

2)  onchange is for javascript, but for c#/vb you can use OnTextChanged
3)  You can do that, as you already tried...or the way i told you. :)


text:
Q: Machine Key Generation in vb.net I have a vb.net product that has a trial version runner embedded. I want the user to be able to click a button to generate a machine specific key/code from his end, if he is interested in purchasing and send that code/key to me to generate an activation key in order to run the full version of the product.
I have been combing stackoverflow for something that can guide me but seem not to get very close answers. Any help will be greatly appreciated. Thanks in advance.

A: See it can be as simple as generating a GUID at the user machine and storing it locally in a license file in a json format .
{
"Permissions": [
{
  "Name": "My Sample Application",
  "Description": "Application Description goes here",
  "Entitlements": [
    {
      "ResourceType": "validity",
      "ResourceValue": "2020/12/31"
    },
    {
      "ResourceType": "num_of_users",
      "ResourceValue": "5"
    }
  ],
  "EntitlementKey": [
    {
      "KeySignature": "",

    }
  ]
}
]

You can then add your license entitlement to the struture by signing the contents using your private key .
The software on it's side can always validate the license using the public part and can then enforce the entitlement on the  user's system


text:
Q: Using ipywidgets with plotly in jupyter notebook I want to use the offline plotting of plotly inside a jupyter notebook and want to manipulate or redraw the plot by using widgets from ipywidgets.
Unfortunately I do not manage to update the plots appropiately:
from ipywidgets import widgets, HBox, Output
import plotly as py
from plotly.offline import iplot
from IPython.display import display

%matplotlib inline
ip_widget = widgets.FloatSlider(
    value=6,
    min=3,
    max=10,
    step=1,
    description='num',
    continuous_update = True
)

ow = Output()
def response(change):
    with ow:
        iplot([{'x':list(range(int(ip_widget.value))), 'y': list(range(int(ip_widget.value)))}])
ip_widget.observe(response)
display(ip_widget)

The provided code has two disadvantages:
It plots the graph multiple times.
The graph only shows up, if the slider is used.
How can I overcome these two issues? Please note that I don't want to use the online plotting capabilities of plotly and I don't want to solve this problem using interact.
Thank you very much for your answers.

A: Have you tried using interact? Here is a very clear example:
http://nbviewer.jupyter.org/github/yankev/test/blob/master/plotlywidget_working2.ipynb
By the way, the interact function lives in ipywidgets (and not IPython.html.widgets anymore). Other than that, the example is pretty much up-to-date.


text:
Q: Why does UserDetailsService return null in Spring Boot app? A simple spring boot app has a custom UserDetailsService.  The Spring Boot Controller is called by an AngularJS app, and authentication requests from the AngularJS app are made to the backend at the /user url pattern.  But login requests are causing the controller logs to indicate that the controller is not finding the /user url pattern, and that the UserDetailsService is thus returning null.  What specific changes need to be made to the code below in order to enable client requests for the backend /user url pattern to find the controller method and thus also correctly instantiate the custom UserDetailsService?
The app is so simple that the controller is less than 200 lines of code.
The code for the controller is:
@SpringBootApplication
@Controller
@EnableJpaRepositories(basePackages = "demo", considerNestedRepositories = true)
public class UiApplication extends WebMvcConfigurerAdapter {

    // Match everything without a suffix (so not a static resource)
    @RequestMapping(value = "/{[path:[^\\.]*}")
    public String redirect() {
        // Forward to home page so that route is preserved.
        return "forward:/";
    }

    @RequestMapping("/user")
    @ResponseBody
    public Principal user(Principal user) {
        return user;
    }

    public static void main(String[] args) {
        SpringApplication.run(UiApplication.class, args);
    }

    @Bean
    public LocaleResolver localeResolver() {
        SessionLocaleResolver slr = new SessionLocaleResolver();
        slr.setDefaultLocale(Locale.US);
        return slr;
    }

    @Bean
    public LocaleChangeInterceptor localeChangeInterceptor() {
        LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
        lci.setParamName("lang");
        return lci;
    }

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/login").setViewName("login");
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(localeChangeInterceptor());
    }

    @Order(Ordered.HIGHEST_PRECEDENCE)
    @Configuration
    protected static class AuthenticationSecurity extends
            GlobalAuthenticationConfigurerAdapter {

        @Autowired
        private Users users;

        @Override
        public void init(AuthenticationManagerBuilder auth) throws Exception {
            auth.userDetailsService(users);
        }
    }

    @SuppressWarnings("deprecation")
    @Configuration
    @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
    @EnableWebMvcSecurity
    @EnableGlobalMethodSecurity(prePostEnabled = true)
    protected static class SecurityConfiguration extends WebSecurityConfigurerAdapter {

        @Override
        protected void configure(HttpSecurity http) throws Exception {
            http.httpBasic().and().authorizeRequests()
                    .antMatchers("/index.html", "/", "/login", "/message", "/home")
                    .permitAll().anyRequest().authenticated().and().csrf()
                    .csrfTokenRepository(csrfTokenRepository()).and()
                    .addFilterAfter(csrfHeaderFilter(), CsrfFilter.class);
        }

        private Filter csrfHeaderFilter() {
            return new OncePerRequestFilter() {
                @Override
                protected void doFilterInternal(HttpServletRequest request,
                                                HttpServletResponse response, FilterChain filterChain)
                        throws ServletException, IOException {
                    CsrfToken csrf = (CsrfToken) request.getAttribute(CsrfToken.class.getName());
                    if (csrf != null) {
                        Cookie cookie = WebUtils.getCookie(request, "XSRF-TOKEN");
                        String token = csrf.getToken();
                        if (cookie == null || token != null
                                && !token.equals(cookie.getValue())) {
                            cookie = new Cookie("XSRF-TOKEN", token);
                            cookie.setPath("/");
                            response.addCookie(cookie);
                        }
                    }
                    filterChain.doFilter(request, response);
                }
            };
        }

        private CsrfTokenRepository csrfTokenRepository() {
            HttpSessionCsrfTokenRepository repository = new HttpSessionCsrfTokenRepository();
            repository.setHeaderName("X-XSRF-TOKEN");
            return repository;
        }
    }

    @Service
    class Users implements UserDetailsService {

        private UserRepository repo;

        @Autowired
        public Users(UserRepository repo) {
            this.repo = repo;
        }

        @Override
        public UserDetails loadUserByUsername(String username)
                throws UsernameNotFoundException {
            User user = repo.findByName(username);
            if (user == null) {
                return null;
            }
            List<GrantedAuthority> auth = AuthorityUtils
                    .commaSeparatedStringToAuthorityList("ROLE_USER");
            if (username.equals("admin")) {
                auth = AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_ADMIN");
            }
            String password = user.getPassword();
            return new org.springframework.security.core.userdetails.User(username, password, auth);
        }

    }

    @Repository
    interface UserRepository extends CrudRepository<User, Long> {
        User findByName(String name);
    }

    @Entity
    class User {
        @GeneratedValue
        @Id
        private Long iduser;
        private String name;
        private String password;
        @OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
        private Collection<SessionLog> sessionLogCollection;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getPassword() {
            return password;
        }

        public void setPassword(String password) {
            this.password = password;
        }
    }

    @Entity
    class SessionLog {

        @GeneratedValue
        @Id
        private Long id;
        private String sessionid;
        @ManyToOne(optional = true)
        @JoinColumn(name = "iduser")
        private User user;

        public String getSessionid() {
            return sessionid;
        }
    }

}

And the complete stack trace produced by the login request is:
2015-12-30 14:27:07.628 DEBUG 4398 --- [nio-8080-exec-5] o.s.security.web.FilterChainProxy        : /js/navigation/login.html has an empty filter list
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/css/**'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/js/**'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/images/**'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/**/favicon.ico'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/error'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/configprops']
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/configprops'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/configprops/**']
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/configprops/**'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/configprops.*']
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/configprops.*'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/configprops/']
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/configprops/'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/autoconfig']
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/autoconfig'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/autoconfig/**']
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/autoconfig/**'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/autoconfig.*']
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/autoconfig.*'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/autoconfig/']
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/autoconfig/'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/metrics']
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/metrics'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/metrics/**']
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/metrics/**'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/metrics.*']
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/metrics.*'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/metrics/']
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/metrics/'
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/env']
2015-12-30 14:27:21.617 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/env'
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/env/**']
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/env/**'
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/env.*']
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/env.*'
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/env/']
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/env/'
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/trace']
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/trace'
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/trace/**']
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/trace/**'
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/trace.*']
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/trace.*'
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/trace/']
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/trace/'
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/health']
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/health'
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/health/']
2015-12-30 14:27:21.620 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/health/'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/beans']
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/beans'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/beans/**']
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/beans/**'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/beans.*']
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/beans.*'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/beans/']
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/beans/'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/info']
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/info'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/info/']
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/info/'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/dump']
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/dump'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/dump/**']
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/dump/**'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/dump.*']
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/dump.*'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/dump/']
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/dump/'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/mappings']
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/mappings'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/mappings/**']
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/mappings/**'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/mappings.*']
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/mappings.*'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : Trying to match using Ant [pattern='/mappings/']
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Checking match of request : '/user'; against '/mappings/'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.web.util.matcher.OrRequestMatcher  : No matches found
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.security.web.FilterChainProxy        : /user at position 1 of 13 in additional filter chain; firing Filter: 'WebAsyncManagerIntegrationFilter'
2015-12-30 14:27:21.621 DEBUG 4398 --- [nio-8080-exec-6] o.s.security.web.FilterChainProxy        : /user at position 2 of 13 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
2015-12-30 14:27:21.622 DEBUG 4398 --- [nio-8080-exec-6] w.c.HttpSessionSecurityContextRepository : HttpSession returned null object for SPRING_SECURITY_CONTEXT
2015-12-30 14:27:21.622 DEBUG 4398 --- [nio-8080-exec-6] w.c.HttpSessionSecurityContextRepository : No SecurityContext was available from the HttpSession: org.apache.catalina.session.StandardSessionFacade@71f7b6fe. A new one will be created.
2015-12-30 14:27:21.622 DEBUG 4398 --- [nio-8080-exec-6] o.s.security.web.FilterChainProxy        : /user at position 3 of 13 in additional filter chain; firing Filter: 'HeaderWriterFilter'
2015-12-30 14:27:21.622 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.header.writers.HstsHeaderWriter  : Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@a3b708e
2015-12-30 14:27:21.622 DEBUG 4398 --- [nio-8080-exec-6] o.s.security.web.FilterChainProxy        : /user at position 4 of 13 in additional filter chain; firing Filter: 'CsrfFilter'
2015-12-30 14:27:21.622 DEBUG 4398 --- [nio-8080-exec-6] o.s.security.web.FilterChainProxy        : /user at position 5 of 13 in additional filter chain; firing Filter: ''
2015-12-30 14:27:21.622 DEBUG 4398 --- [nio-8080-exec-6] o.s.security.web.FilterChainProxy        : /user at position 6 of 13 in additional filter chain; firing Filter: 'LogoutFilter'
2015-12-30 14:27:21.630 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.u.matcher.AntPathRequestMatcher  : Request 'GET /user' doesn't match 'POST /logout
2015-12-30 14:27:21.630 DEBUG 4398 --- [nio-8080-exec-6] o.s.security.web.FilterChainProxy        : /user at position 7 of 13 in additional filter chain; firing Filter: 'BasicAuthenticationFilter'
2015-12-30 14:27:21.632 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.a.www.BasicAuthenticationFilter  : Basic Authentication Authorization header found for user 'admin'
2015-12-30 14:27:21.632 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.authentication.ProviderManager     : Authentication attempt using org.springframework.security.authentication.dao.DaoAuthenticationProvider
2015-12-30 14:27:22.155 DEBUG 4398 --- [nio-8080-exec-6] .s.a.DefaultAuthenticationEventPublisher : No event was found for the exception org.springframework.security.authentication.InternalAuthenticationServiceException
2015-12-30 14:27:22.155 DEBUG 4398 --- [nio-8080-exec-6] o.s.s.w.a.www.BasicAuthenticationFilter  : Authentication request for failed: org.springframework.security.authentication.InternalAuthenticationServiceException: UserDetailsService returned null, which is an interface contract violation
2015-12-30 14:27:22.155 DEBUG 4398 --- [nio-8080-exec-6] s.w.a.DelegatingAuthenticationEntryPoint : Trying to match using RequestHeaderRequestMatcher [expectedHeaderName=X-Requested-With, expectedHeaderValue=XMLHttpRequest]
2015-12-30 14:27:22.155 DEBUG 4398 --- [nio-8080-exec-6] s.w.a.DelegatingAuthenticationEntryPoint : Match found! Executing org.springframework.security.web.authentication.HttpStatusEntryPoint@784c2ce0
2015-12-30 14:27:22.155 DEBUG 4398 --- [nio-8080-exec-6] w.c.HttpSessionSecurityContextRepository : SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
2015-12-30 14:27:22.155 DEBUG 4398 --- [nio-8080-exec-6] s.s.w.c.SecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed

A: The controller method is found. The problem is this code:
if (user == null) {
    return null;
}

As you clearly can see in the log messages:
Authentication request for failed: org.springframework.security.authentication.InternalAuthenticationServiceException: UserDetailsService returned null, which is an interface contract violation

Returning null is not allowed in a UserDetailsService implementation.
So check if you have an entry in your database for the admin user and remove the return null and throw a UsernameNotFoundException instead.


text:
Q: What does "survivalsvm" predict? I'm trying to develop a predictive model using cancer survival data and used the R package survivalsvm which uses SVM method.  After running the following code i got some results but finding it difficult to interpret it.  I know that in Cox regression it predicts the Cumulative Hazard Function, but is it the same in survivalsvm?  I ran both Cox and survivalsvm models and the results are quite different:
smodel_svm = survivalsvm(Surv(time, outcome) ~ radius.mean + tumor.size, data=training_set, gamma.mu = 1)
pred_test_svm = predict(smodel_svm, test_set)
summary(pred_test_svm)

A: The difference might be because you're using default parameters that is using type="regression" that uses the regression approach as described in this paper.
In summary, the authors(Van Belle et al. ) propose a different approach(MODEL 2 and MODEL 3) that essentially uses a Cox model but with both regression and ranking constraints.
Note however that the authors concluded:

Comparison of model 2 with the
coxmodel revealed no significant differences in performance. The advantage of model 2 above cox model lies in the easy extension towards non-linear models without the need to check non-linearities in the variables before modelling

From the function's docs(focusing on the parameter type):

The following denotations are used for the models implemented:
'regression' referring to the regression approach, named SVCR in Van Belle et al. (2011b),
'vanbelle1' according to the first version of survival surpport vector machines based on ranking constraints, named RANKSVMC by Van Belle et al. (2011b),
'vanbelle2' according to the second version of survival surpport vector machines based on ranking constraints like presented in model1 by Van Belle et al. (2011b) and

A: Predictions from survivalsvm have to be interpreted as ranks. The way in survival svm is to be able to predict ranks among individuals to estimate which patient, for example, should be handled earlier than others. See also fouodo et al. (2018) for more details about package usage in R.

A: If you use the regression approach, it will tell you the prediction of survival time. If you use vanbelle1 or vanbelle2 it will tell you the rank. The hybrid method also tells u the rank of the observation. As I know, from the rank we have, we can cluster them into groups of high-risk and low-risk using the rank or sometimes refer as a prognostic index.


text:
Q: ImageMagick SVG with Windows symbol font (private use unicode character) I'm using MagickNet (ImageMagick for .NET) to read the SVG code below, which contains a valid character from the "Symbol" true type font on Windows. The character is UF0B7 (uniF0B7 in the cmap table of the symbol.ttf font). This is a filled circle. The image I get using ImageMagick contains a rectangle with F0B7 written inside.
Here is my SVG file containing this special character. It is inside the text XML element (you might see it as a small square on your browser):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="main1" width="960" height="720">
    <g transform="matrix(1.3333334 0 0 1.3333334 0 0)">
        <path stroke="none" fill="#FFFFFF" fill-rule="evenodd" d="M0 0L720 0L720 540L0 540z" transform="matrix(1 0 0 1 0 0)"  />
        <text style="fill:#000000;font-family:Symbol;" font-size="32" transform="matrix(1 0 0 1 43.08661 129.5433)" fill-opacity="1" x="0.028347015" y="29.952" letter-spacing="-0.01"></text>
    </g>
</svg>

Here is my C# code:
byte[] imageData = File.ReadAllBytes(@"F:\test.svg");
using MagickImage image = new MagickImage(imageData);
image.Write(@"F:\test.jpg");

Is there a way to make ImageMagick use the system's Symbol font with such private use characters (according to the unicode standard) ? This character and others of the same kind are often used by Powerpoint software for bullets. I need, in my own software, to convert pptx slides to svgs using available libraries, and then rework them, isolate paragraphs in separate SVGs, to produce slide animation. In order to convert the final SVGs to images, I could also use other libraries like SVG.Net, but this one has other problems too. Up to now, MagickNet is the most precise one, except for this problem.