问:
iOS GCD global queue priority both 0.5
I met the problem is why the following code print out priority is the same?  Why is this? Thank you very much.

```<code>    print("main:\(Thread.current)")
    print("thread main priorities:\(Thread.current.threadPriority)")

    DispatchQueue.global(qos: .utility).async {
        print("utility:\(Thread.current)")
        print("thread utility priorities:\(Thread.current.threadPriority)")
    }

    DispatchQueue.global(qos: .background).async {
        print("background:\(Thread.current)")
        print("thread background priorities:\(Thread.current.threadPriority)")
    }

    DispatchQueue.global(qos: .userInteractive).async {
        print("userInteractive:\(Thread.current)")
        print("thread userInteractive priorities:\(Thread.current.threadPriority)")
    }

    DispatchQueue.global(qos: .userInitiated).async {
        print("userInitiated:\(Thread.current)")
        print("thread userInitiated priorities:\(Thread.current.threadPriority)")
    }
</code>```

Log:

main:{number = 1, name = main}
thread main priorities:0.5

userInteractive:{number = 3, name = (null)}

utility:{number = 5, name = (null)}

background:{number = 6, name = (null)}

thread userInteractive priorities:0.5

userInitiated:{number = 4, name = (null)}

thread utility priorities:0.5

thread background priorities:0.5

thread userInitiated priorities:0.5

答:
As you can see in the docs:

```<code>@available(iOS 4.0, *)
open var threadPriority: Double // To be deprecated; use qualityOfService below
</code>```

threadPriority is deprecated. Also, Apple's GCD team has been very clear on the Thread - Queue topic. GCD will managed the threads for you. A queue priority is not a thread priority. Take a look at this example, which is the code you posted here, pretty much, I just added the "qos_class_self().rawValue", which is really how you should test the QoS, and not with the "threadPriority".

```<code>print("main:\(Thread.current), Thread main priorities:\(Thread.current.threadPriority), QoS: \(qos_class_self().rawValue)")

DispatchQueue.global(qos: .utility).async {
    print("utility:\(Thread.current), Thread utility priorities:\(Thread.current.threadPriority), QoS: \(qos_class_self().rawValue)")
}

DispatchQueue.global(qos: .background).async {
    print("background:\(Thread.current), Thread background priorities:\(Thread.current.threadPriority), QoS: \(qos_class_self().rawValue)")
}

DispatchQueue.global(qos: .userInteractive).async {
    print("userInteractive:\(Thread.current), Thread userInteractive priorities:\(Thread.current.threadPriority), QoS: \(qos_class_self().rawValue)")
}

DispatchQueue.global(qos: .userInitiated).async {
    print("userInitiated:\(Thread.current), Thread userInitiated priorities:\(Thread.current.threadPriority), QoS: \(qos_class_self().rawValue)")
}
</code>```

I also combined the prints per closure so they don't get scrambled in different lines in the log. This shows you that QoS is maintained, whereas threadPriority is deprecated.

```<code>main:<NSThread: 0x6100000762c0>{number = 1, name = main}, Thread main priorities:0.5, QoS: 33
userInteractive:<NSThread: 0x610000261fc0>{number = 4, name = (null)}, Thread userInteractive priorities:0.5, QoS: 33
utility:<NSThread: 0x618000079100>{number = 3, name = (null)}, Thread utility priorities:0.5, QoS: 17
userInitiated:<NSThread: 0x608000078380>{number = 5, name = (null)}, Thread userInitiated priorities:0.5, QoS: 25
background:<NSThread: 0x610000262000>{number = 6, name = (null)}, Thread background priorities:0.5, QoS: 9
</code>```

So, in the end, the take away is not to think in terms of threads, but to think in terms of Queues, their QoS and knowing that GCD will manage threads for you. Very different concept to what we were used to before Queues came around with GCD.

Title: iOS GCD global queue priority both 0.5

Body:
I met the problem is why the following code print out priority is the same?  Why is this? Thank you very much.

    print("main:\(Thread.current)")
    print("thread main priorities:\(Thread.current.threadPriority)")

    DispatchQueue.global(qos: .utility).async {
        print("utility:\(Thread.current)")
        print("thread utility priorities:\(Thread.current.threadPriority)")
    }

    DispatchQueue.global(qos: .background).async {
        print("background:\(Thread.current)")
        print("thread background priorities:\(Thread.current.threadPriority)")
    }

    DispatchQueue.global(qos: .userInteractive).async {
        print("userInteractive:\(Thread.current)")
        print("thread userInteractive priorities:\(Thread.current.threadPriority)")
    }

    DispatchQueue.global(qos: .userInitiated).async {
        print("userInitiated:\(Thread.current)")
        print("thread userInitiated priorities:\(Thread.current.threadPriority)")
    }

Log:

main:{number = 1, name = main}
thread main priorities:0.5

userInteractive:{number = 3, name = (null)}

utility:{number = 5, name = (null)}

background:{number = 6, name = (null)}

thread userInteractive priorities:0.5

userInitiated:{number = 4, name = (null)}

thread utility priorities:0.5

thread background priorities:0.5

thread userInitiated priorities:0.5

Body:
As you can see in the docs:

@available(iOS 4.0, *)
open var threadPriority: Double // To be deprecated; use qualityOfService below

threadPriority is deprecated. Also, Apple's GCD team has been very clear on the Thread - Queue topic. GCD will managed the threads for you. A queue priority is not a thread priority. Take a look at this example, which is the code you posted here, pretty much, I just added the "qos_class_self().rawValue", which is really how you should test the QoS, and not with the "threadPriority".

print("main:\(Thread.current), Thread main priorities:\(Thread.current.threadPriority), QoS: \(qos_class_self().rawValue)")

DispatchQueue.global(qos: .utility).async {
    print("utility:\(Thread.current), Thread utility priorities:\(Thread.current.threadPriority), QoS: \(qos_class_self().rawValue)")
}

DispatchQueue.global(qos: .background).async {
    print("background:\(Thread.current), Thread background priorities:\(Thread.current.threadPriority), QoS: \(qos_class_self().rawValue)")
}

DispatchQueue.global(qos: .userInteractive).async {
    print("userInteractive:\(Thread.current), Thread userInteractive priorities:\(Thread.current.threadPriority), QoS: \(qos_class_self().rawValue)")
}

DispatchQueue.global(qos: .userInitiated).async {
    print("userInitiated:\(Thread.current), Thread userInitiated priorities:\(Thread.current.threadPriority), QoS: \(qos_class_self().rawValue)")
}

I also combined the prints per closure so they don't get scrambled in different lines in the log. This shows you that QoS is maintained, whereas threadPriority is deprecated.

main:<NSThread: 0x6100000762c0>{number = 1, name = main}, Thread main priorities:0.5, QoS: 33
userInteractive:<NSThread: 0x610000261fc0>{number = 4, name = (null)}, Thread userInteractive priorities:0.5, QoS: 33
utility:<NSThread: 0x618000079100>{number = 3, name = (null)}, Thread utility priorities:0.5, QoS: 17
userInitiated:<NSThread: 0x608000078380>{number = 5, name = (null)}, Thread userInitiated priorities:0.5, QoS: 25
background:<NSThread: 0x610000262000>{number = 6, name = (null)}, Thread background priorities:0.5, QoS: 9

So, in the end, the take away is not to think in terms of threads, but to think in terms of Queues, their QoS and knowing that GCD will manage threads for you. Very different concept to what we were used to before Queues came around with GCD.


来源: stackexchange

问:
How to restrict access to some public websites
I am new to cloud computing. Sorry if this is a silly question. I have created a VM from azure portal. My requirement is not to allow the user using the VM to access public website. Can anyone help me how to achieve this functionality?

Thanks

答:
My requirement is not to allow the user using the VM to access public
  website.

According to your description, you just want user can't access the public website, as we know website common listen on 80 and 443, so we can add outbound rules to deny port 443, 80 and port 8080 to achieve this functionality.

I deny port 80, 443 and 8080, then my VM can't access https://google.com and http://google.com.

Update:

ContentLicense: CC BY-SA 4.0

ContentLicense: CC BY-SA 3.0


问:
python - string to coordinates in a font image
I have this image:
font image

I want to convert a string like: "Açúcar" to coordinates on image

I tried this:

```<code>text = "Açúcar"

strcoord = []
for char in text:
    code = ord(char)
    y = code//16
    x = code%16
    strcoord += [[x,y]]

print(strcoord)
</code>```

and the result is:

[[1, 4], [7, 14], [10, 15], [3, 6], [1, 6], [2, 7]]

but the coordinates of accent are wrong?

there is a fast way to make this?

答:
The order of the characters in your image map does not match the order of unicode character values:  See the 'Basic Latin' and 'Latin 1 Supplement' code pages.  The ord() function is going to use that ordering.

Your image map is using the old IBM 437 mapping.  You can try the following changes to convert the characters to the correct integers for use in your image map.

```<code>text = "Açúcar"

strcoord = []
for char in text:
    code = int(char.encode('ibm437')[0])
    y = code//16
    x = code%16
    strcoord += [[x,y]]

print(strcoord)
</code>```

The encode function returns a byte array, with the integer you want in the 0th position.

This results in [[1, 4], [7, 8], [3, 10], [3, 6], [1, 6], [2, 7]] which should be the coordinates you are looking for.

Body:
I have this image:
font image

I want to convert a string like: "Açúcar" to coordinates on image

I tried this:

text = "Açúcar"

strcoord = []
for char in text:
    code = ord(char)
    y = code//16
    x = code%16
    strcoord += [[x,y]]

print(strcoord)

and the result is:

[[1, 4], [7, 14], [10, 15], [3, 6], [1, 6], [2, 7]]

but the coordinates of accent are wrong?

there is a fast way to make this?

Body:
The order of the characters in your image map does not match the order of unicode character values:  See the 'Basic Latin' and 'Latin 1 Supplement' code pages.  The ord() function is going to use that ordering.

Your image map is using the old IBM 437 mapping.  You can try the following changes to convert the characters to the correct integers for use in your image map.

text = "Açúcar"

strcoord = []
for char in text:
    code = int(char.encode('ibm437')[0])
    y = code//16
    x = code%16
    strcoord += [[x,y]]

print(strcoord)

The encode function returns a byte array, with the integer you want in the 0th position.

This results in [[1, 4], [7, 8], [3, 10], [3, 6], [1, 6], [2, 7]] which should be the coordinates you are looking for.


问:
Crash trying to open Webview - Xamarin.Forms.Platform.Android.WebViewRender+WebClient
I have an issue with Xamarin.Forms

I'm trying to open a webpage in a NavigationModal but it crash with this error message:

Could not load signature of Xamarin.Forms.Platform.Android.WebViewRender+WebClient:OnReceivedError due to: Could not resolve type with token 0100016d (from typeref, class/assembly Android.Webkit.WebResourceError, Mono.Android, Version=0.0.0.0, Culture=neutral, PublickKeyToken=84e04ffcfb79065 type:Android.Webkit.WebResourceError member:

My code is:

```<code>await Navigation.PushModalAsync(new ContactPage()
        {
            Content = new WebView()
            {
                Source = "http://google.com"
            }
        });
</code>```

Using PCL

Target Android version: Android 6.0 (API Level 23)

Minimum Android version: Android 4.4 (API Level 19)

Xamarin.Forms v2.3.5.239-pre (and happend the same issue with other versions)

I'm using Samsung Galaxy S7 edge with Android 6.0 for test

I don't know why is happening because it worked before.

答: After hours I found the target version was pointing to version 5.0. This in Android Project > Options > Application > Compile using... I set to "Use latest platform (7.1)"</p>

Body:
I have an issue with Xamarin.Forms

I'm trying to open a webpage in a NavigationModal but it crash with this error message:

Could not load signature of Xamarin.Forms.Platform.Android.WebViewRender+WebClient:OnReceivedError due to: Could not resolve type with token 0100016d (from typeref, class/assembly Android.Webkit.WebResourceError, Mono.Android, Version=0.0.0.0, Culture=neutral, PublickKeyToken=84e04ffcfb79065 type:Android.Webkit.WebResourceError member:

My code is:

await Navigation.PushModalAsync(new ContactPage()
        {
            Content = new WebView()
            {
                Source = "http://google.com"
            }
        });

Using PCL

Target Android version: Android 6.0 (API Level 23)

Minimum Android version: Android 4.4 (API Level 19)

Xamarin.Forms v2.3.5.239-pre (and happend the same issue with other versions)

I'm using Samsung Galaxy S7 edge with Android 6.0 for test

I don't know why is happening because it worked before.


问:
Scala: NoSuchMethodException when invoking mutable.ArrayBuffer（List，Int)
I want to invoke(List,Int) by reflecting, it's my code:

```<code>class TagCalculation {
  def test(arg1: scala.collection.immutable.$colon$colon[Any],arg2: java.lang.Integer) = "test mix2"
}
val getTest =  new TagCalculation

val arg1 : scala.collection.mutable.ArrayBuffer[Any] = scala.collection.mutable.ArrayBuffer()
arg1 += Array(1,2,3)

arg1 += 4

val argtypes4 = arg1.map(_.getClass)
val method4 = getTest.getClass.getMethod("test", argtypes4: _*)
method4.invoke(getTest,calcParamsArray.asInstanceOf[Seq[Object]]: _*)
</code>```

but method4 would some errors:

scala> val argtypes4 = arg1.map(.getClass) argtypes4:
  scala.collection.mutable.ArrayBuffer[Class[]] = ArrayBuffer(class [I,
  class java.lang.Integer)

scala> val method4 = getTest.getClass.getMethod("test", argtypes4: _*)
  java.lang.NoSuchMethodException: $iwC$$iwC$TagCalculation.test([I,
  java.lang.Integer)    at java.lang.Class.getMethod(Class.java:1678)   at
  $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.(:35)
    at
  $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.(:40)
    at
  $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.(:42)

Any idea to solve this issue?

答:
Array is a different type than :: that is of type List. This change should work</p>

```<code>class TagCalculation {
  def test(arg1: scala.collection.immutable.$colon$colon[Any],arg2: java.lang.Integer) = "test mix2"
}
val getTest =  new TagCalculation

val arg1 : scala.collection.mutable.ArrayBuffer[Any] = scala.collection.mutable.ArrayBuffer()
arg1 += List(1,2,3)

arg1 += 4

val argtypes4 = arg1.map(_.getClass)
val method4 = getTest.getClass.getMethod("test", argtypes4: _*)
method4.invoke(getTest,calcParamsArray.asInstanceOf[Seq[Object]]: _*)
</code>```

Body:
I want to invoke(List,Int) by reflecting, it's my code:

class TagCalculation {
  def test(arg1: scala.collection.immutable.$colon$colon[Any],arg2: java.lang.Integer) = "test mix2"
}
val getTest =  new TagCalculation

val arg1 : scala.collection.mutable.ArrayBuffer[Any] = scala.collection.mutable.ArrayBuffer()
arg1 += Array(1,2,3)

arg1 += 4

val argtypes4 = arg1.map(_.getClass)
val method4 = getTest.getClass.getMethod("test", argtypes4: _*)
method4.invoke(getTest,calcParamsArray.asInstanceOf[Seq[Object]]: _*)

but method4 would some errors:

scala> val argtypes4 = arg1.map(.getClass) argtypes4:
  scala.collection.mutable.ArrayBuffer[Class[]] = ArrayBuffer(class [I,
  class java.lang.Integer)

scala> val method4 = getTest.getClass.getMethod("test", argtypes4: _*)
  java.lang.NoSuchMethodException: $iwC$$iwC$TagCalculation.test([I,
  java.lang.Integer)    at java.lang.Class.getMethod(Class.java:1678)   at
  $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.(:35)
    at
  $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.(:40)
    at
  $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.(:42)

Any idea to solve this issue?

Body:
Array is a different type than :: that is of type List. This change should work

class TagCalculation {
  def test(arg1: scala.collection.immutable.$colon$colon[Any],arg2: java.lang.Integer) = "test mix2"
}
val getTest =  new TagCalculation

val arg1 : scala.collection.mutable.ArrayBuffer[Any] = scala.collection.mutable.ArrayBuffer()
arg1 += List(1,2,3)

arg1 += 4

val argtypes4 = arg1.map(_.getClass)
val method4 = getTest.getClass.getMethod("test", argtypes4: _*)
method4.invoke(getTest,calcParamsArray.asInstanceOf[Seq[Object]]: _*)


问:
call js script on every change state
i have big table with many html items such as select, textbox, radio-button, checkbox. also i have some function. i want to call this function on every change in item. for example select was changed, or some text type in textbox, or click radiobutton. how can i simply subscribes and call my js function? i can insert in any item

onchange='function()'

but may be jquery allow more simly way? any sample?

答:
jQuery's .change() event will work for all types of input elements.

But for efficiency, if you've got a lot of elements, you might want to look into .delegate():

```<code>$('body').delegate('input', 'change', function() {
  // in here, $(this) is the input that has changed
});
</code>```

Delegating is more efficient since it creates only a single handler and makes use of event bubbling.

ContentLicense: CC BY-SA 2.5

Title: call js script on every change state

Body:
jQuery's .change() event will work for all types of input elements.

But for efficiency, if you've got a lot of elements, you might want to look into .delegate():

$('body').delegate('input', 'change', function() {
  // in here, $(this) is the input that has changed
});

Delegating is more efficient since it creates only a single handler and makes use of event bubbling.


问:
Adding error bars on multiple data series using ggplot
I have some data recorded over a period of months from 5 treatments (incl. control). I'm using ggplot to plot the data as a time series and have generated a data frame of the means of the raw data and standard error for each date.

I'm trying to plot all five treatments on the same graph and show the error bars with it. I'm able to a). plot one treatment group and show the error bars and b). plot all five treatments but not show the error bars.

Here's my data (I've only included two treatments to keep things tidy here)

```<code>       dates   c_mean_am  c_se_am    T1_mean_am  T1_se_am
1 2017-01-31   284.135   27.43111     228.935     23.39037
2 2017-02-09   226.944   13.08237     173.241     13.42946
3 2017-02-23   281.135   15.89709     252.665     20.73417
4 2017-03-14   265.655   15.29930     238.225     17.47501
5 2017-04-06   312.785   13.08237     237.485     13.42946
</code>```

c_mean_am = control means

c_se_am = standard error for controls

T1_mean_am = Treatment 1 means

T1_se_am = standard error for Treatment 1

Here's my code to achieve option a) above

```<code>ggplot(summary, aes(x=dates, y=c_mean_am),xlab="Date") +
    geom_point(shape = 19, size = 2,color="blue") +
    geom_line(color="blue") +
    geom_errorbar(aes(x=dates, ymin=c_mean_am-c_se_am, ymax=c_mean_am+c_se_am), color="blue", width=0.25)
</code>```

Here's the code for option b) above

```<code>sp <- ggplot(summary,aes(dates,y = Cond,color=Treatment)) +
    geom_line(aes(y = c_mean_am, color = "Control")) +
    geom_line(aes(y = T1_mean_am, color = "T1")) +
    geom_point(aes(y = c_mean_am, color = "Control")) +
    geom_point(aes(y = T1_mean_am, color = "T1"))

sp2<- sp +
    scale_color_manual(breaks = c("Control", "T1","T2"), values=c("blue", "yellow"))

sp2
</code>```

How can I get the error bars on the second plot using the same colours as the points and lines?

Thanks

AB

答:
Transform your data into long-form first:

```<code>df <- df %>%
 gather(mean_type, mean_val, c_mean_am, T1_mean_am) %>%
 gather(se_type, se_val, c_se_am, T1_se_am)

ggplot(df, aes(dates, mean_val, colour=mean_type)) +
    geom_line() +
    geom_point() +
    geom_errorbar(aes(ymin=mean_val-se_val, ymax=mean_val+se_val))
</code>```

Edit: explanation for tidyr manipulation

```<code>new.dat <- mtcars %>%  # taking mtcars as the starting data.frame
        select(gear, cyl, mpg, qsec) %>%
          # equivalent to mtcars[, c("gear", "cyl", "mpg", "qsec")]; to simplify the example
        gather(key=type, value=val, gear, cyl) %>%
          # convert the data into a long form with 64 rows, with new factor column "type" and numeric column "val". "gear" and "cyl" are removed while "mpg" and "qsec" remain

new.dat[c(1:3, 33:35),]

#     mpg  qsec type val
# 1  21.0 16.46 gear   4
# 2  21.0 17.02 gear   4
# 3  22.8 18.61 gear   4
# 33 21.0 16.46  cyl   6
# 34 21.0 17.02  cyl   6
# 35 22.8 18.61  cyl   4
</code>```

With the long form of data, you can use the new identifier form ("type") for plotting purposes, e.g.

```<code>ggplot(new.dat, aes(val, mpg, fill=type)) +
   geom_col(position="dodge")
</code>```

The long-format is also useful for plotting on different facet, e.g.

```<code>ggplot(new.dat, aes(val, mpg, colour=type)) +
    geom_point() +
    facet_wrap(~type)
</code>```

Body:
I have some data recorded over a period of months from 5 treatments (incl. control). I'm using ggplot to plot the data as a time series and have generated a data frame of the means of the raw data and standard error for each date.

I'm trying to plot all five treatments on the same graph and show the error bars with it. I'm able to a). plot one treatment group and show the error bars and b). plot all five treatments but not show the error bars.

Here's my data (I've only included two treatments to keep things tidy here)

       dates   c_mean_am  c_se_am    T1_mean_am  T1_se_am
1 2017-01-31   284.135   27.43111     228.935     23.39037
2 2017-02-09   226.944   13.08237     173.241     13.42946
3 2017-02-23   281.135   15.89709     252.665     20.73417
4 2017-03-14   265.655   15.29930     238.225     17.47501
5 2017-04-06   312.785   13.08237     237.485     13.42946

c_mean_am = control means

c_se_am = standard error for controls

T1_mean_am = Treatment 1 means

T1_se_am = standard error for Treatment 1

Here's my code to achieve option a) above

ggplot(summary, aes(x=dates, y=c_mean_am),xlab="Date") +
    geom_point(shape = 19, size = 2,color="blue") +
    geom_line(color="blue") +
    geom_errorbar(aes(x=dates, ymin=c_mean_am-c_se_am, ymax=c_mean_am+c_se_am), color="blue", width=0.25)

Here's the code for option b) above

sp <- ggplot(summary,aes(dates,y = Cond,color=Treatment)) +
    geom_line(aes(y = c_mean_am, color = "Control")) +
    geom_line(aes(y = T1_mean_am, color = "T1")) +
    geom_point(aes(y = c_mean_am, color = "Control")) +
    geom_point(aes(y = T1_mean_am, color = "T1"))

sp2<- sp +
    scale_color_manual(breaks = c("Control", "T1","T2"), values=c("blue", "yellow"))

sp2

How can I get the error bars on the second plot using the same colours as the points and lines?

Thanks

AB

Body:
Transform your data into long-form first:

df <- df %>%
 gather(mean_type, mean_val, c_mean_am, T1_mean_am) %>%
 gather(se_type, se_val, c_se_am, T1_se_am)

ggplot(df, aes(dates, mean_val, colour=mean_type)) +
    geom_line() +
    geom_point() +
    geom_errorbar(aes(ymin=mean_val-se_val, ymax=mean_val+se_val))

Edit: explanation for tidyr manipulation

new.dat <- mtcars %>%  # taking mtcars as the starting data.frame
        select(gear, cyl, mpg, qsec) %>%
          # equivalent to mtcars[, c("gear", "cyl", "mpg", "qsec")]; to simplify the example
        gather(key=type, value=val, gear, cyl) %>%
          # convert the data into a long form with 64 rows, with new factor column "type" and numeric column "val". "gear" and "cyl" are removed while "mpg" and "qsec" remain

new.dat[c(1:3, 33:35),]

#     mpg  qsec type val
# 1  21.0 16.46 gear   4
# 2  21.0 17.02 gear   4
# 3  22.8 18.61 gear   4
# 33 21.0 16.46  cyl   6
# 34 21.0 17.02  cyl   6
# 35 22.8 18.61  cyl   4

With the long form of data, you can use the new identifier form ("type") for plotting purposes, e.g.

ggplot(new.dat, aes(val, mpg, fill=type)) +
   geom_col(position="dodge")

The long-format is also useful for plotting on different facet, e.g.

ggplot(new.dat, aes(val, mpg, colour=type)) +
    geom_point() +
    facet_wrap(~type)


问:
Android Studio is telling me it cannot resolve Toast.show
I put:

```<code>Toast.makeText(
    FunFactsActivity.this,
    "Yay!",
    Toast.LENGTH_SHORT).show();
</code>```

and Android Studio is telling:

Cannot resolve method 'show()'

the code is with a red  below.

答:
If you are trying to Toast your text in the FunFactsActivity then do this:</p>

```<code>Toast.makeText(getApplicationContext(), "Your text", Toast.LENGTH_LONG).show();
</code>```

Body:
I put:

Toast.makeText(
    FunFactsActivity.this,
    "Yay!",
    Toast.LENGTH_SHORT).show();

and Android Studio is telling:

Cannot resolve method 'show()'

the code is with a red  below.

Body:
If you are trying to Toast your text in the FunFactsActivity then do this:

Toast.makeText(getApplicationContext(), "Your text", Toast.LENGTH_LONG).show();


问:
Give default value when viewing data on php
i have try to get data with following code

```<code>$result = $viral->getData("SELECT * FROM preview WHERE id=$id");

foreach ($result as $res) {
  $title = $res['title'];
  $promoted = $res['promoted'];
  $photo = $res['file'];
}
</code>```

and i view query result with this code

```<code><p><?php echo $title;?></p>
</code>```

i want when value $title in database is blank it will automatically replace by my default value.

Can i give default value when variable $title is blank ?

答:
This can be done like this, please try

```<code>$result = $viral->getData("SELECT * FROM preview WHERE id=$id");

foreach ($result as $res) {
  $title = empty($res['title'])? "Your Default Valur or Variable":$res['title'];
  $promoted = $res['promoted'];
  $photo = $res['file'];
}
</code>```

or if you only go with $title variable use this

```<code>empty($title)? "Your Default Valur or Variable":$title;
</code>```

Body:
i have try to get data with following code

$result = $viral->getData("SELECT * FROM preview WHERE id=$id");

foreach ($result as $res) {
  $title = $res['title'];
  $promoted = $res['promoted'];
  $photo = $res['file'];
}

and i view query result with this code

<?php echo $title;?>

i want when value $title in database is blank it will automatically replace by my default value.

Can i give default value when variable $title is blank ?

Body:
This can be done like this, please try

$result = $viral->getData("SELECT * FROM preview WHERE id=$id");

foreach ($result as $res) {
  $title = empty($res['title'])? "Your Default Valur or Variable":$res['title'];
  $promoted = $res['promoted'];
  $photo = $res['file'];
}

or if you only go with $title variable use this

empty($title)? "Your Default Valur or Variable":$title;


问:
PHP SOAP client not sending parameters when calling function
I'm calling a service to authenticate, the service I'm calling is just "Authenticate" As displayed from __getFunctions:

```<code>[0]=> string(59) "AuthenticateResponse Authenticate(Authenticate $parameters)
</code>```

I'm trying to call it like this:

```<code>$resp = $client->Authenticate(array('user'=>"user", 'password'=>"password"));
</code>```

But then when I check lastrequest it seems as if I was not sending user name or password. So I get the result "Wrong user name or password":

```<code><?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.fsi.co.uk/services/evolution/04/09"><SOAP-ENV:Body><ns1:Authenticate/></SOAP-ENV:Body></SOAP-ENV:Envelope>
</code>```

I also tried formatting this request in different ways:

```<code>$resp = $client->Authenticate($params = array("Authenticate" => $autharr));
</code>```

(Where Auth array is an associative array with user and password)

And even as a class:

```<code>class Authenticate{
    public $user = 'Rawr';
    public $password = 'Mew';
 }
$info = new Authenticate();
$resp = $client->Authenticate($info);
</code>```

But all of them result in the same empty request, and hence in the same "wrong password" result. I believe this error has to do with the way I'm formatting the data, but I'm a bit stuck and everything I have tried from google has failed. So I would appreciate a hint or two here! Thanks!

(WDSL)

```This XML file does not appear to have any style information associated with it. The document tree is shown below.
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:tns="http://www.fsi.co.uk/services/evolution/04/09" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="SecurityService" targetNamespace="http://www.fsi.co.uk/services/evolution/04/09">
<wsdl:types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://www.fsi.co.uk/services/evolution/04/09">
<xsd:element name="Authenticate">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="loginName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q1="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel" minOccurs="0" name="AuthenticateResult" nillable="true" type="q1:AuthenticationDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateDatabase">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="loginName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="databaseName" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateDatabaseResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q2="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel" minOccurs="0" name="AuthenticateDatabaseResult" nillable="true" type="q2:AuthenticationDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="LogOut">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="sessionId" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="LogOutResponse">
<xsd:complexType>
<xsd:sequence/>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateOutlook">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="loginName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateOutlookResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q3="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel" minOccurs="0" name="AuthenticateOutlookResult" nillable="true" type="q3:AuthenticationDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateDatabaseOutlook">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="loginName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="databaseName" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateDatabaseOutlookResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q4="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel" minOccurs="0" name="AuthenticateDatabaseOutlookResult" nillable="true" type="q4:AuthenticationDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateDatabaseByAccountUserType">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="loginName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="databaseName" nillable="true" type="xsd:string"/>
<xsd:element xmlns:q5="http://schemas.datacontract.org/2004/07/Fsi.Platform.Security.Contracts.Entities" minOccurs="0" name="accountUserType" type="q5:AccountUserTypeDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateDatabaseByAccountUserTypeResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q6="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel" minOccurs="0" name="AuthenticateDatabaseByAccountUserTypeResult" nillable="true" type="q6:AuthenticationDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateByAccountUserType">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="loginName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
<xsd:element xmlns:q7="http://schemas.datacontract.org/2004/07/Fsi.Platform.Security.Contracts.Entities" minOccurs="0" name="accountUserType" type="q7:AccountUserTypeDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateByAccountUserTypeResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q8="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel" minOccurs="0" name="AuthenticateByAccountUserTypeResult" nillable="true" type="q8:AuthenticationDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema xmlns:tns="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel">
<xsd:complexType name="AuthenticationDto">
<xsd:complexContent mixed="false">
<xsd:extension xmlns:q9="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.ServiceModel" base="q9:BaseDto">
<xsd:sequence>
<xsd:element xmlns:q10="http://schemas.datacontract.org/2004/07/Fsi.Platform.Security.Contracts.Services" minOccurs="0" name="OperationResult" type="q10:AuthenticationResultCode"/>
<xsd:element minOccurs="0" name="SessionId" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="AuthenticationDto" nillable="true" type="tns:AuthenticationDto"/>
</xsd:schema>
<xsd:schema xmlns:tns="http://schemas.datacontract.org/2004/07/Fsi.Platform.Security.Contracts.Services" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/Fsi.Platform.Security.Contracts.Services">
<xsd:simpleType name="AuthenticationResultCode">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Unknown"/>
<xsd:enumeration value="Succeeded"/>
<xsd:enumeration value="NotAuthenticated">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">4</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="WrongUserNameOrPassword">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">8</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="GeneralFailure">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">16</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="LicensedAreaAccessDenied">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">32</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="ProductNotLicensed">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">64</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="BreachedLicenceEntities">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">128</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="DatabaseInvalidVersion">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">256</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="DatabaseNotAvailable">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">512</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="DatabaseAccessDenied">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">1024</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="FailedMaximumNumberUsersLoggedIn">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">2048</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="UserAlreadyLoggedIn">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">4096</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="SessionExpired">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">8192</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="AccountLockedOut">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">12288</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="PasswordExpired">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">16384</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="AuthenticationResultCode" nillable="true" type="tns:AuthenticationResultCode"/>
</xsd:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/">
<xs:element name="anyType" nillable="true" type="xs:anyType"/>
<xs:element name="anyURI" nillable="true" type="xs:anyURI"/>
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/>
<xs:element name="boolean" nillable="true" type="xs:boolean"/>
<xs:element name="byte" nillable="true" type="xs:byte"/>
<xs:element name="dateTime" nillable="true" type="xs:dateTime"/>
<xs:element name="decimal" nillable="true" type="xs:decimal"/>
<xs:element name="double" nillable="true" type="xs:double"/>
<xs:element name="float" nillable="true" type="xs:float"/>
<xs:element name="int" nillable="true" type="xs:int"/>
<xs:element name="long" nillable="true" type="xs:long"/>
<xs:element name="QName" nillable="true" type="xs:QName"/>
<xs:element name="short" nillable="true" type="xs:short"/>
<xs:element name="string" nillable="true" type="xs:string"/>
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/>
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/>
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/>
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/>
<xs:element name="char" nillable="true" type="tns:char"/>
<xs:simpleType name="char">
<xs:restriction base="xs:int"/>
</xs:simpleType>
<xs:element name="duration" nillable="true" type="tns:duration"/>
<xs:simpleType name="duration">
<xs:restriction base="xs:duration">
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
<xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
<xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="guid" nillable="true" type="tns:guid"/>
<xs:simpleType name="guid">
<xs:restriction base="xs:string">
<xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
</xs:restriction>
</xs:simpleType>
<xs:attribute name="FactoryType" type="xs:QName"/>
<xs:attribute name="Id" type="xs:ID"/>
<xs:attribute name="Ref" type="xs:IDREF"/>
</xs:schema>
<xsd:schema xmlns:tns="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.ServiceModel" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.ServiceModel">
<xsd:complexType name="BaseDto">
<xsd:sequence>
<xsd:element minOccurs="0" name="PrimaryKeyId" type="xsd:long"/>
<xsd:element minOccurs="0" name="PrimaryTableCatalogId" type="xsd:long"/>
<xsd:element minOccurs="0" name="ValidateOnly" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="BaseDto" nillable="true" type="tns:BaseDto"/>
</xsd:schema>
<xsd:schema xmlns:tns="http://schemas.datacontract.org/2004/07/Fsi.Platform.Security.Contracts.Entities" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/Fsi.Platform.Security.Contracts.Entities">
<xsd:simpleType name="AccountUserTypeDto">
<xsd:annotation>
<xsd:appinfo>
<ActualType xmlns="http://schemas.microsoft.com/2003/10/Serialization/" Name="long" Namespace="http://www.w3.org/2001/XMLSchema"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Service">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">2</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="Import">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">8</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="AccountUserTypeDto" nillable="true" type="tns:AccountUserTypeDto"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="SecurityService_Authenticate_InputMessage">
<wsdl:part name="parameters" element="tns:Authenticate"/>
</wsdl:message>
<wsdl:message name="SecurityService_Authenticate_OutputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateResponse"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateDatabase_InputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateDatabase"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateDatabase_OutputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateDatabaseResponse"/>
</wsdl:message>
<wsdl:message name="SecurityService_LogOut_InputMessage">
<wsdl:part name="parameters" element="tns:LogOut"/>
</wsdl:message>
<wsdl:message name="SecurityService_LogOut_OutputMessage">
<wsdl:part name="parameters" element="tns:LogOutResponse"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateOutlook_InputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateOutlook"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateOutlook_OutputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateOutlookResponse"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateDatabaseOutlook_InputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateDatabaseOutlook"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateDatabaseOutlook_OutputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateDatabaseOutlookResponse"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateDatabaseByAccountUserType_InputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateDatabaseByAccountUserType"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateDatabaseByAccountUserType_OutputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateDatabaseByAccountUserTypeResponse"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateByAccountUserType_InputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateByAccountUserType"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateByAccountUserType_OutputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateByAccountUserTypeResponse"/>
</wsdl:message>
<wsdl:portType name="SecurityService">
<wsdl:operation name="Authenticate">
<wsdl:input wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/Authenticate" message="tns:SecurityService_Authenticate_InputMessage"/>
<wsdl:output wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateResponse" message="tns:SecurityService_Authenticate_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="AuthenticateDatabase">
<wsdl:input wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabase" message="tns:SecurityService_AuthenticateDatabase_InputMessage"/>
<wsdl:output wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabaseResponse" message="tns:SecurityService_AuthenticateDatabase_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="LogOut">
<wsdl:input wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/LogOut" message="tns:SecurityService_LogOut_InputMessage"/>
<wsdl:output wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/LogOutResponse" message="tns:SecurityService_LogOut_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="AuthenticateOutlook">
<wsdl:input wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateOutlook" message="tns:SecurityService_AuthenticateOutlook_InputMessage"/>
<wsdl:output wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateOutlookResponse" message="tns:SecurityService_AuthenticateOutlook_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="AuthenticateDatabaseOutlook">
<wsdl:input wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabaseOutlook" message="tns:SecurityService_AuthenticateDatabaseOutlook_InputMessage"/>
<wsdl:output wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabaseOutlookResponse" message="tns:SecurityService_AuthenticateDatabaseOutlook_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="AuthenticateDatabaseByAccountUserType">
<wsdl:input wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabaseByAccountUserType" message="tns:SecurityService_AuthenticateDatabaseByAccountUserType_InputMessage"/>
<wsdl:output wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabaseByAccountUserTypeResponse" message="tns:SecurityService_AuthenticateDatabaseByAccountUserType_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="AuthenticateByAccountUserType">
<wsdl:input wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateByAccountUserType" message="tns:SecurityService_AuthenticateByAccountUserType_InputMessage"/>
<wsdl:output wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateByAccountUserTypeResponse" message="tns:SecurityService_AuthenticateByAccountUserType_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SecurityService" type="tns:SecurityService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Authenticate">
<soap:operation soapAction="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/Authenticate" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="AuthenticateDatabase">
<soap:operation soapAction="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabase" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="LogOut">
<soap:operation soapAction="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/LogOut" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="AuthenticateOutlook">
<soap:operation soapAction="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateOutlook" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="AuthenticateDatabaseOutlook">
<soap:operation soapAction="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabaseOutlook" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="AuthenticateDatabaseByAccountUserType">
<soap:operation soapAction="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabaseByAccountUserType" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="AuthenticateByAccountUserType">
<soap:operation soapAction="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateByAccountUserType" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SecurityService">
<wsdl:port name="SecurityService" binding="tns:SecurityService">
<soap:address location="http://app7-ipg.independent.local/Evolution_FIXD/Services/Basic/SecurityService.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
```

答:
From the comments, now that you've got the WSDL I see this in it:

```<code><xsd:element name="Authenticate">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="loginName" nillable="true" type="xsd:string"/>
            <xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>
</code>```

So you could try this for your auth:

```<code>$resp = $client->Authenticate(array("loginName"=> $username, "password" => $password));
</code>```

Of course you'll need to supply a valid $username and $password to that service, though.

Body:
I'm calling a service to authenticate, the service I'm calling is just "Authenticate" As displayed from __getFunctions:

[0]=> string(59) "AuthenticateResponse Authenticate(Authenticate $parameters)

I'm trying to call it like this:

$resp = $client->Authenticate(array('user'=>"user", 'password'=>"password"));

But then when I check lastrequest it seems as if I was not sending user name or password. So I get the result "Wrong user name or password":

<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.fsi.co.uk/services/evolution/04/09"><SOAP-ENV:Body><ns1:Authenticate/></SOAP-ENV:Body></SOAP-ENV:Envelope>

I also tried formatting this request in different ways:

$resp = $client->Authenticate($params = array("Authenticate" => $autharr));

(Where Auth array is an associative array with user and password)

And even as a class:

class Authenticate{
    public $user = 'Rawr';
    public $password = 'Mew';
 }
$info = new Authenticate();
$resp = $client->Authenticate($info);

But all of them result in the same empty request, and hence in the same "wrong password" result. I believe this error has to do with the way I'm formatting the data, but I'm a bit stuck and everything I have tried from google has failed. So I would appreciate a hint or two here! Thanks!

(WDSL)

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:tns="http://www.fsi.co.uk/services/evolution/04/09" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="SecurityService" targetNamespace="http://www.fsi.co.uk/services/evolution/04/09">
<wsdl:types>
<xsd:schema elementFormDefault="qualified" targetNamespace="http://www.fsi.co.uk/services/evolution/04/09">
<xsd:element name="Authenticate">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="loginName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q1="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel" minOccurs="0" name="AuthenticateResult" nillable="true" type="q1:AuthenticationDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateDatabase">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="loginName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="databaseName" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateDatabaseResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q2="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel" minOccurs="0" name="AuthenticateDatabaseResult" nillable="true" type="q2:AuthenticationDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="LogOut">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="sessionId" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="LogOutResponse">
<xsd:complexType>
<xsd:sequence/>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateOutlook">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="loginName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateOutlookResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q3="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel" minOccurs="0" name="AuthenticateOutlookResult" nillable="true" type="q3:AuthenticationDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateDatabaseOutlook">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="loginName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="databaseName" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateDatabaseOutlookResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q4="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel" minOccurs="0" name="AuthenticateDatabaseOutlookResult" nillable="true" type="q4:AuthenticationDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateDatabaseByAccountUserType">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="loginName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="databaseName" nillable="true" type="xsd:string"/>
<xsd:element xmlns:q5="http://schemas.datacontract.org/2004/07/Fsi.Platform.Security.Contracts.Entities" minOccurs="0" name="accountUserType" type="q5:AccountUserTypeDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateDatabaseByAccountUserTypeResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q6="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel" minOccurs="0" name="AuthenticateDatabaseByAccountUserTypeResult" nillable="true" type="q6:AuthenticationDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateByAccountUserType">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="loginName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
<xsd:element xmlns:q7="http://schemas.datacontract.org/2004/07/Fsi.Platform.Security.Contracts.Entities" minOccurs="0" name="accountUserType" type="q7:AccountUserTypeDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="AuthenticateByAccountUserTypeResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q8="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel" minOccurs="0" name="AuthenticateByAccountUserTypeResult" nillable="true" type="q8:AuthenticationDto"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema xmlns:tns="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.Entities.ServiceModel">
<xsd:complexType name="AuthenticationDto">
<xsd:complexContent mixed="false">
<xsd:extension xmlns:q9="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.ServiceModel" base="q9:BaseDto">
<xsd:sequence>
<xsd:element xmlns:q10="http://schemas.datacontract.org/2004/07/Fsi.Platform.Security.Contracts.Services" minOccurs="0" name="OperationResult" type="q10:AuthenticationResultCode"/>
<xsd:element minOccurs="0" name="SessionId" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="AuthenticationDto" nillable="true" type="tns:AuthenticationDto"/>
</xsd:schema>
<xsd:schema xmlns:tns="http://schemas.datacontract.org/2004/07/Fsi.Platform.Security.Contracts.Services" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/Fsi.Platform.Security.Contracts.Services">
<xsd:simpleType name="AuthenticationResultCode">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Unknown"/>
<xsd:enumeration value="Succeeded"/>
<xsd:enumeration value="NotAuthenticated">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">4</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="WrongUserNameOrPassword">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">8</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="GeneralFailure">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">16</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="LicensedAreaAccessDenied">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">32</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="ProductNotLicensed">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">64</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="BreachedLicenceEntities">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">128</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="DatabaseInvalidVersion">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">256</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="DatabaseNotAvailable">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">512</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="DatabaseAccessDenied">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">1024</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="FailedMaximumNumberUsersLoggedIn">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">2048</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="UserAlreadyLoggedIn">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">4096</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="SessionExpired">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">8192</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="AccountLockedOut">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">12288</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="PasswordExpired">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">16384</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="AuthenticationResultCode" nillable="true" type="tns:AuthenticationResultCode"/>
</xsd:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/">
<xs:element name="anyType" nillable="true" type="xs:anyType"/>
<xs:element name="anyURI" nillable="true" type="xs:anyURI"/>
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/>
<xs:element name="boolean" nillable="true" type="xs:boolean"/>
<xs:element name="byte" nillable="true" type="xs:byte"/>
<xs:element name="dateTime" nillable="true" type="xs:dateTime"/>
<xs:element name="decimal" nillable="true" type="xs:decimal"/>
<xs:element name="double" nillable="true" type="xs:double"/>
<xs:element name="float" nillable="true" type="xs:float"/>
<xs:element name="int" nillable="true" type="xs:int"/>
<xs:element name="long" nillable="true" type="xs:long"/>
<xs:element name="QName" nillable="true" type="xs:QName"/>
<xs:element name="short" nillable="true" type="xs:short"/>
<xs:element name="string" nillable="true" type="xs:string"/>
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/>
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/>
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/>
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/>
<xs:element name="char" nillable="true" type="tns:char"/>
<xs:simpleType name="char">
<xs:restriction base="xs:int"/>
</xs:simpleType>
<xs:element name="duration" nillable="true" type="tns:duration"/>
<xs:simpleType name="duration">
<xs:restriction base="xs:duration">
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
<xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
<xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="guid" nillable="true" type="tns:guid"/>
<xs:simpleType name="guid">
<xs:restriction base="xs:string">
<xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
</xs:restriction>
</xs:simpleType>
<xs:attribute name="FactoryType" type="xs:QName"/>
<xs:attribute name="Id" type="xs:ID"/>
<xs:attribute name="Ref" type="xs:IDREF"/>
</xs:schema>
<xsd:schema xmlns:tns="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.ServiceModel" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/Fsi.Platform.Contracts.ServiceModel">
<xsd:complexType name="BaseDto">
<xsd:sequence>
<xsd:element minOccurs="0" name="PrimaryKeyId" type="xsd:long"/>
<xsd:element minOccurs="0" name="PrimaryTableCatalogId" type="xsd:long"/>
<xsd:element minOccurs="0" name="ValidateOnly" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="BaseDto" nillable="true" type="tns:BaseDto"/>
</xsd:schema>
<xsd:schema xmlns:tns="http://schemas.datacontract.org/2004/07/Fsi.Platform.Security.Contracts.Entities" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/Fsi.Platform.Security.Contracts.Entities">
<xsd:simpleType name="AccountUserTypeDto">
<xsd:annotation>
<xsd:appinfo>
<ActualType xmlns="http://schemas.microsoft.com/2003/10/Serialization/" Name="long" Namespace="http://www.w3.org/2001/XMLSchema"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Service">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">2</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="Import">
<xsd:annotation>
<xsd:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">8</EnumerationValue>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="AccountUserTypeDto" nillable="true" type="tns:AccountUserTypeDto"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="SecurityService_Authenticate_InputMessage">
<wsdl:part name="parameters" element="tns:Authenticate"/>
</wsdl:message>
<wsdl:message name="SecurityService_Authenticate_OutputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateResponse"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateDatabase_InputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateDatabase"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateDatabase_OutputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateDatabaseResponse"/>
</wsdl:message>
<wsdl:message name="SecurityService_LogOut_InputMessage">
<wsdl:part name="parameters" element="tns:LogOut"/>
</wsdl:message>
<wsdl:message name="SecurityService_LogOut_OutputMessage">
<wsdl:part name="parameters" element="tns:LogOutResponse"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateOutlook_InputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateOutlook"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateOutlook_OutputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateOutlookResponse"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateDatabaseOutlook_InputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateDatabaseOutlook"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateDatabaseOutlook_OutputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateDatabaseOutlookResponse"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateDatabaseByAccountUserType_InputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateDatabaseByAccountUserType"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateDatabaseByAccountUserType_OutputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateDatabaseByAccountUserTypeResponse"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateByAccountUserType_InputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateByAccountUserType"/>
</wsdl:message>
<wsdl:message name="SecurityService_AuthenticateByAccountUserType_OutputMessage">
<wsdl:part name="parameters" element="tns:AuthenticateByAccountUserTypeResponse"/>
</wsdl:message>
<wsdl:portType name="SecurityService">
<wsdl:operation name="Authenticate">
<wsdl:input wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/Authenticate" message="tns:SecurityService_Authenticate_InputMessage"/>
<wsdl:output wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateResponse" message="tns:SecurityService_Authenticate_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="AuthenticateDatabase">
<wsdl:input wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabase" message="tns:SecurityService_AuthenticateDatabase_InputMessage"/>
<wsdl:output wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabaseResponse" message="tns:SecurityService_AuthenticateDatabase_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="LogOut">
<wsdl:input wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/LogOut" message="tns:SecurityService_LogOut_InputMessage"/>
<wsdl:output wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/LogOutResponse" message="tns:SecurityService_LogOut_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="AuthenticateOutlook">
<wsdl:input wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateOutlook" message="tns:SecurityService_AuthenticateOutlook_InputMessage"/>
<wsdl:output wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateOutlookResponse" message="tns:SecurityService_AuthenticateOutlook_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="AuthenticateDatabaseOutlook">
<wsdl:input wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabaseOutlook" message="tns:SecurityService_AuthenticateDatabaseOutlook_InputMessage"/>
<wsdl:output wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabaseOutlookResponse" message="tns:SecurityService_AuthenticateDatabaseOutlook_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="AuthenticateDatabaseByAccountUserType">
<wsdl:input wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabaseByAccountUserType" message="tns:SecurityService_AuthenticateDatabaseByAccountUserType_InputMessage"/>
<wsdl:output wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabaseByAccountUserTypeResponse" message="tns:SecurityService_AuthenticateDatabaseByAccountUserType_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="AuthenticateByAccountUserType">
<wsdl:input wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateByAccountUserType" message="tns:SecurityService_AuthenticateByAccountUserType_InputMessage"/>
<wsdl:output wsaw:Action="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateByAccountUserTypeResponse" message="tns:SecurityService_AuthenticateByAccountUserType_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SecurityService" type="tns:SecurityService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Authenticate">
<soap:operation soapAction="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/Authenticate" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="AuthenticateDatabase">
<soap:operation soapAction="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabase" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="LogOut">
<soap:operation soapAction="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/LogOut" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="AuthenticateOutlook">
<soap:operation soapAction="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateOutlook" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="AuthenticateDatabaseOutlook">
<soap:operation soapAction="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabaseOutlook" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="AuthenticateDatabaseByAccountUserType">
<soap:operation soapAction="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateDatabaseByAccountUserType" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="AuthenticateByAccountUserType">
<soap:operation soapAction="http://www.fsi.co.uk/services/evolution/04/09/SecurityService/AuthenticateByAccountUserType" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SecurityService">
<wsdl:port name="SecurityService" binding="tns:SecurityService">
<soap:address location="http://app7-ipg.independent.local/Evolution_FIXD/Services/Basic/SecurityService.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Body:
From the comments, now that you've got the WSDL I see this in it:

<xsd:element name="Authenticate">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element minOccurs="0" name="loginName" nillable="true" type="xsd:string"/>
            <xsd:element minOccurs="0" name="password" nillable="true" type="xsd:string"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>

So you could try this for your auth:

$resp = $client->Authenticate(array("loginName"=> $username, "password" => $password));

Of course you'll need to supply a valid $username and $password to that service, though.


问:
image not taking full width on mobile
I am using bootstrap in my webpage and when I view my page on a small screen, ex iPhone7, the image in it gets very very small, I tried using @media but it is not working, can someone please tell me, what I am missing
here is my code for the CSS and html</p>

```<code><img src="example" style="width: 40%; margin: 0 auto" class="img-responsive img-center" alt="Responsive image">

@media (max-width: 768px) {
            .img-responsive {
                width: 100%;
            }
        }
</code>```

答:
Try your very best to avoid inline styling. You need a default width for the .img-responsive class, and a media query to target smaller screen for a 100% width.

https://codepen.io/anon/pen/awzvVB

```<code><img src="example" class="img-responsive img-center" alt="Responsive image">

.img-center {
  margin: 0 auto;
}
.img-responsive {
  width: 40%;
}

@media only screen and (max-width: 768px) {
  .img-responsive {
    width: 100%;
  }
}
</code>```

BTW, you will need to set the image as a block element (display: block) in order to center it with margin: 0 auto.

Title: image not taking full width on mobile

Body:
I am using bootstrap in my webpage and when I view my page on a small screen, ex iPhone7, the image in it gets very very small, I tried using @media but it is not working, can someone please tell me, what I am missing
here is my code for the CSS and html

@media (max-width: 768px) {
            .img-responsive {
                width: 100%;
            }
        }

Body:
Try your very best to avoid inline styling. You need a default width for the .img-responsive class, and a media query to target smaller screen for a 100% width.

https://codepen.io/anon/pen/awzvVB

<img src="example" class="img-responsive img-center" alt="Responsive image">

.img-center {
  margin: 0 auto;
}
.img-responsive {
  width: 40%;
}

@media only screen and (max-width: 768px) {
  .img-responsive {
    width: 100%;
  }
}

BTW, you will need to set the image as a block element (display: block) in order to center it with margin: 0 auto.


问:
explode a csv in python
I have an excel file with 200 rows, 2 of which have comma separated values in them. If I output them to tab-separated, it would look like this:

```<code>col1  col2
a     b,c
d     e,f,g
</code>```

I need to explode to get a dataframe like this, exploding 200 rows into ~4,000:

```<code>col1  col2
a     b
a     c
d     e
d     f
d     g
</code>```

I don't see any explode functionality in pandas and haven't been able to figure out how to do this having the columns of comma-separated values uneven in length - not sure how split would work here.

Help me stack-overflow, you're my only hope. Thanks!

答:
Let's use pd.DataFrame, .str.split, stack:

```<code>df_out = (pd.DataFrame(df.col2.str.split(',').tolist(), index=df.col1)
      .stack()
      .reset_index()
      .drop('level_1',axis=1)
      .rename(columns={0:'col2'}))
</code>```

Output:

```<code>  col1 col2
0    a    b
1    a    c
2    d    e
3    d    f
4    d    g
</code>```

Title: explode a csv in python

Body:
I have an excel file with 200 rows, 2 of which have comma separated values in them. If I output them to tab-separated, it would look like this:

col1  col2
a     b,c
d     e,f,g

I need to explode to get a dataframe like this, exploding 200 rows into ~4,000:

col1  col2
a     b
a     c
d     e
d     f
d     g

I don't see any explode functionality in pandas and haven't been able to figure out how to do this having the columns of comma-separated values uneven in length - not sure how split would work here.

Help me stack-overflow, you're my only hope. Thanks!

Body:
Let's use pd.DataFrame, .str.split, stack:

df_out = (pd.DataFrame(df.col2.str.split(',').tolist(), index=df.col1)
      .stack()
      .reset_index()
      .drop('level_1',axis=1)
      .rename(columns={0:'col2'}))

Output:

  col1 col2
0    a    b
1    a    c
2    d    e
3    d    f
4    d    g


问:
Python modifying CSV data
I have a file which looks like this(i.e random combination of 2 /3 consecutive rows) :

```<code>String A
String B
String C
<Blank Row>
String D
String E
<Blank Row>
String F
String G
String H
<Blank Row>
String I
String J
String K
<Blank Row>
String L
String M
</code>```

I want the output file to remove the middle row when there are 3 consecutive rows and transpose the 2 remaining row. IN case there are only 2 rows, they should be transposed. The final result should look like this.

```<code>String A,String C
String D,String E
String F,String H
String I,String K
String L,String M
</code>```

Any pointers how to get this done?

答:
In order to rotate: you know all lines have a new line at the end

```<code>with open("PATH TO FILE.txt", r) as file:
    input = file.read()
    input.replace("\n", "")
</code>```

for the lines that only have white spaces, or to identify them. SO far:

```<code>   with open("PATH TO FILE.txt", r) as file:
        input = file.read()
        if not line.strip():
           input.replace("\n", "")
</code>```

and you can keep a count or do a while loop so you count until you hit the line with only white spaces and while counting put each line in a list or something,
if you counted 3 grab the first and the third, otherwise grab both. Remember to reset the count

Title: Python modifying CSV data

Body:
I have a file which looks like this(i.e random combination of 2 /3 consecutive rows) :

String A
String B
String C
<Blank Row>
String D
String E
<Blank Row>
String F
String G
String H
<Blank Row>
String I
String J
String K
<Blank Row>
String L
String M

I want the output file to remove the middle row when there are 3 consecutive rows and transpose the 2 remaining row. IN case there are only 2 rows, they should be transposed. The final result should look like this.

String A,String C
String D,String E
String F,String H
String I,String K
String L,String M

Any pointers how to get this done?

Body:
In order to rotate: you know all lines have a new line at the end

with open("PATH TO FILE.txt", r) as file:
    input = file.read()
    input.replace("\n", "")

for the lines that only have white spaces, or to identify them. SO far:

   with open("PATH TO FILE.txt", r) as file:
        input = file.read()
        if not line.strip():
           input.replace("\n", "")

and you can keep a count or do a while loop so you count until you hit the line with only white spaces and while counting put each line in a list or something,
if you counted 3 grab the first and the third, otherwise grab both. Remember to reset the count


问:
Limit users on nginx using wildcard
I'm starting a work with Nginx to reverse proxy my app for internet access outside my customer's network.

I managed to make it work, limiting the URLs that need to be exposed etc, but one thing is still due to finish my work.

I want to limit user access based on the username. But instead of creating an if for every user I want to block, I would like to use a wildcard because all the users I want to block ends with a specific string: @saspw

Sample of my /etc/nginx/conf.d/reverseproxy.conf

```<code>server  {
  listen  80;   # Proxy trafic for SAS Visual Analytics Transport Services on HTTP
  server_name  mcdonalds-va-reverseproxy.cons.sashq-r.openstack.sas.com;
  if ($remote_user = '*@saspw'){
      return 401;
  }
  location  /SASVisualAnalyticsTransport {
    proxy_pass  https://mtbis.mcdonalds.com.au:8343/SASVisualAnalyticsTransport/;
  }
}
</code>```

In the $remote_user if, I would like that all users with its username ending in @saspw get a 401 error, (which I will change to a 404 later).

It does only work if I put the whole username, like joe@saspw. Using a wildcard (*,?) does not work.

Is there a way to make $remote_user solve wildcards that way?

Thank you,
Joe

答:
Use map nginx module

```<code>map $remote_user $is_denied {
    default 0;
    "~.*@saspw" 1;
}

server  {
  listen  80;   # Proxy trafic for SAS Visual Analytics Transport Services on HTTP
  server_name  mcdonalds-va-reverseproxy.cons.sashq-r.openstack.sas.com;
  if ($is_denied){
      return 401;
  }
  location  /SASVisualAnalyticsTransport {
    proxy_pass  https://mtbis.mcdonalds.com.au:8343/SASVisualAnalyticsTransport/;
  }
}
</code>```

It lets you to use regexes. Note that map must be outside server directive.

Title: Limit users on nginx using wildcard

Body:
I'm starting a work with Nginx to reverse proxy my app for internet access outside my customer's network.

I managed to make it work, limiting the URLs that need to be exposed etc, but one thing is still due to finish my work.

I want to limit user access based on the username. But instead of creating an if for every user I want to block, I would like to use a wildcard because all the users I want to block ends with a specific string: @saspw

Sample of my /etc/nginx/conf.d/reverseproxy.conf

server  {
  listen  80;   # Proxy trafic for SAS Visual Analytics Transport Services on HTTP
  server_name  mcdonalds-va-reverseproxy.cons.sashq-r.openstack.sas.com;
  if ($remote_user = '*@saspw'){
      return 401;
  }
  location  /SASVisualAnalyticsTransport {
    proxy_pass  https://mtbis.mcdonalds.com.au:8343/SASVisualAnalyticsTransport/;
  }
}

In the $remote_user if, I would like that all users with its username ending in @saspw get a 401 error, (which I will change to a 404 later).

It does only work if I put the whole username, like joe@saspw. Using a wildcard (*,?) does not work.

Is there a way to make $remote_user solve wildcards that way?

Thank you,
Joe

Body:
Use map nginx module

map $remote_user $is_denied {
    default 0;
    "~.*@saspw" 1;
}

server  {
  listen  80;   # Proxy trafic for SAS Visual Analytics Transport Services on HTTP
  server_name  mcdonalds-va-reverseproxy.cons.sashq-r.openstack.sas.com;
  if ($is_denied){
      return 401;
  }
  location  /SASVisualAnalyticsTransport {
    proxy_pass  https://mtbis.mcdonalds.com.au:8343/SASVisualAnalyticsTransport/;
  }
}

It lets you to use regexes. Note that map must be outside server directive.


问:
What does "Error starting process" could mean in my case?
I was learning C++ coding on Eclipse and I made a little Cash Register program and help you calculate how much change you should give in dollars and quarters and dimes and pennies.

When I tried to run it, it always gives me this error message:

'Launching XXX.exe' has encountered a problem. Error Starting process.

Here is my code:

```<code>#include <iostream>
using namespace std;

double askprice(double&);

int main()
{
// Todo place code here
    double price;
    double total=0;
    char answer='y';
    double cashin;
    double change;
    int dollar;
    int qt;
    int dm;
    int ct;

    cout<<"Do you have more items? y/n"<<endl;
    cin>>answer;
    while (answer == 'y')
    {
        askprice(price);
        total=total+price;

    }
    cout<<"How much do you pay?"<<endl;
    cin>>cashin;
    change=cashin-total;
    dollar = change;
    int intchange = change*100;
    qt = intchange%100/25;
    dm = intchange*100%25/10;
    ct = intchange*100%10;

    cout<<"Your change is "<<dollar<<" dollars "<<qt<<" quarters "<<dm<<" dimes and "<<ct<<" cents."<<endl;

return (0);
}

double askprice(double price)
{
    cout<<"Enter the price of your item"<<endl;
    cin>>price;
    return price;
}
</code>```

(here as image if you prefer)

Does anyone can give me an incentive about what could I do wrong here?

答:
After a long time struggling with my code, I did find lots of problems with it. Thanks to @Arthur, @Jesper Juhl, @Algirdas Preidžius and @Dr t. I have a lot to learn. Thank you guys.

But the error message turned out to be unrelated to the code itself. I fixed the bugs in my code, created a new project and copied the code into the new project. And it ran perfectly. After checking the "Run Configuration" of my original code, I found that in the "C/C++ Application:" it was the directory of my c++ source file, where it should be (I erased the directory and typed manually)"Debug/Cash register.exe". "Cash register" is the name of my project. And the error message disappeared. I still don't know exactly the logic behind it. But the problem was solved. If someone would like to explain it to me, I would appreciate it. Thanks again to this amazing community.

Body:
I was learning C++ coding on Eclipse and I made a little Cash Register program and help you calculate how much change you should give in dollars and quarters and dimes and pennies.

When I tried to run it, it always gives me this error message:

'Launching XXX.exe' has encountered a problem. Error Starting process.

Here is my code:

#include <iostream>
using namespace std;

double askprice(double&);

int main()
{
// Todo place code here
    double price;
    double total=0;
    char answer='y';
    double cashin;
    double change;
    int dollar;
    int qt;
    int dm;
    int ct;

    cout<<"Do you have more items? y/n"<<endl;
    cin>>answer;
    while (answer == 'y')
    {
        askprice(price);
        total=total+price;

    }
    cout<<"How much do you pay?"<<endl;
    cin>>cashin;
    change=cashin-total;
    dollar = change;
    int intchange = change*100;
    qt = intchange%100/25;
    dm = intchange*100%25/10;
    ct = intchange*100%10;

    cout<<"Your change is "<<dollar<<" dollars "<<qt<<" quarters "<<dm<<" dimes and "<<ct<<" cents."<<endl;

return (0);
}

double askprice(double price)
{
    cout<<"Enter the price of your item"<<endl;
    cin>>price;
    return price;
}

(here as image if you prefer)

Does anyone can give me an incentive about what could I do wrong here?


问:
I'm trying to write a recursive static method with a helper in order to reverse a string. Why am I getting "stack overflow?"
So as the title says, I want to write a static method in Java that takes a String (like "hello!") and reverses it using a helper recursive method. However, I get stack overflow errors. My code is:

```<code>  public static String reverse2(String text){
    return reverseHelp(text, "", text.length()-1);
  }

  public static String reverseHelp(String text, String newString, int index) {
    if(index <= 0){
      return newString;
    }
    else
    {
      index = text.length()-1;
      return newString = text.charAt(index) + reverseHelp(text, newString, index - 1);
    }

  }
</code>```

What I'm trying to do is append the last character to the new string. How can I get this to work?

答: You're setting index to text.length() - 1 every time. You're not actually taking in the value of your index (you pass it as a parameter, but then you overwrite it each time). Since you're not actually changing the length of your string, you're never going to be able to break out of the recursive function, hence a stack overflow error.</p>

Body:
So as the title says, I want to write a static method in Java that takes a String (like "hello!") and reverses it using a helper recursive method. However, I get stack overflow errors. My code is:

  public static String reverse2(String text){
    return reverseHelp(text, "", text.length()-1);
  }

  public static String reverseHelp(String text, String newString, int index) {
    if(index <= 0){
      return newString;
    }
    else
    {
      index = text.length()-1;
      return newString = text.charAt(index) + reverseHelp(text, newString, index - 1);
    }

  }

What I'm trying to do is append the last character to the new string. How can I get this to work?


问:
removing duplicates from a bool list
I am trying to get a word in a list that is followed by a word with a ''.'' in it. for example, if this is a list

```<code>test_list = ["hello", "how", "are.", "you"]
</code>```

it would select the word ''you'' I have managed to pull this off but I am trying to ensure that I do not get duplicate words.
Here is what I have so far

```<code>list = []
i = 0
bool = False
words = sent.split()
for word in words:
    if bool:
        list.append(word)
        bool = False
   # the bellow if statment seems to make everything worse instead of fixing the duplicate problem
    if "." in word and word not in list:
        bool = True
return list
</code>```

答:
In the itertools recipes is the definition of pairwise which is useful to iterating a list 2 at a time:

```<code>def pairwise(iterable):
    a, b = it.tee(iterable)
    next(b, None)
    return a, b
</code>```

You can use this to create a list of words that follow a word ending in '.':

```<code>words = [n for m, n in zip(*pairwise(l)) if m[-1] == '.']
</code>```

Remove duplicates:

```<code>seen = set()
results = [x for x in words if not (x in seen or seen.add(x))]
</code>```

Title: removing duplicates from a bool list

Body:
I am trying to get a word in a list that is followed by a word with a ''.'' in it. for example, if this is a list

test_list = ["hello", "how", "are.", "you"]

it would select the word ''you'' I have managed to pull this off but I am trying to ensure that I do not get duplicate words.
Here is what I have so far

list = []
i = 0
bool = False
words = sent.split()
for word in words:
    if bool:
        list.append(word)
        bool = False
   # the bellow if statment seems to make everything worse instead of fixing the duplicate problem
    if "." in word and word not in list:
        bool = True
return list

Body:
In the itertools recipes is the definition of pairwise which is useful to iterating a list 2 at a time:

def pairwise(iterable):
    a, b = it.tee(iterable)
    next(b, None)
    return a, b

You can use this to create a list of words that follow a word ending in '.':

words = [n for m, n in zip(*pairwise(l)) if m[-1] == '.']

Remove duplicates:

seen = set()
results = [x for x in words if not (x in seen or seen.add(x))]


问:
How do I prevent cassandra get command displaying values in hex
I'm just beginning with Cassandra and I have the peculiar problem that whenever I retrieve a value is returns in hex (please see below).  I've googled for this without success.  I'd appreciate any help that may be forthcoming.  Thanks!  </p>

```<code>[default@MyKeyspace] set User['hirsch']['email'] = 'swhirsch@nyc.rr.com';
Value inserted.
[default@MyKeyspace] get User['hirsch']['email'];
=> (column=656d61696c, value=7377686972736368406e79632e72722e636f6d, timestamp=1292294713343000)
</code>```

答:
Tell cassandra what kind of data are in your column values:

update column family User with column_metadata=[{column_name: email, validation_class: UTF8Type}];

Body:
I'm just beginning with Cassandra and I have the peculiar problem that whenever I retrieve a value is returns in hex (please see below).  I've googled for this without success.  I'd appreciate any help that may be forthcoming.  Thanks!

[default@MyKeyspace] set User['hirsch']['email'] = 'swhirsch@nyc.rr.com';
Value inserted.
[default@MyKeyspace] get User['hirsch']['email'];
=> (column=656d61696c, value=7377686972736368406e79632e72722e636f6d, timestamp=1292294713343000)


问:
Jenkins :: Dynamic String Parameter
I have a parameterized project with one Choice Parameter param1 and a regular String Parameter param2 with a default value.
I would like to know how to dynamically change the default value of param2 according to param1 selection?

I heard about Active Choices Plugin and it looks good but the plugin is no longer available in the Jenkins update center because of vulnerability issue...

Is there something equivalent ?

Thanks!

答:
I haven't seen any alternative. The Active Choices Plugin depends on the Scriptler Plugin, which was pulled for security reasons. You can, at your own risk, still install and use these plugins, ignoring the security concerns (see top of the Scriptler Plugin page), by bypassing the update center like this:

Active Choices Plugin: Get the 1.5.3 hpi from https://repo.jenkins-ci.org/releases/org/biouno/uno-choice/ (the Jenkins project Maven repository) and upload it to jenkins per the advanced plugin installation instructions.

Scriptler Plugin: Get the 2.9 hpi from https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/scriptler/2.9/ and upload it to jenkins per the advanced plugin installation instructions.

This info was had from the comments at the bottom of the Active Choices Plugin page. I suspect any updates or announcements of a new secure version will land there first, though there is also this closed "bug".

Title: Jenkins :: Dynamic String Parameter