问:
Getting 404 error when Angular HTML5Mode is true
I have implemented pretty url in angular(switched to html5mode).

When I am refreshing the page I get 404 error.

For example: If I open my app using http://server/, everything works fine,but  when I refersh the page or try open specific page ex http://server/mypage, I get 404 error.

Note:

When compiling my application I am combining templates in javascript.

And after compilation my scripts(with template) goes in build folder
and base tag in index.html is set to "/";.

I am using Angular-ui-router.

Using .net as backend.

Frontend app is total separate from backend & both are deployed in IIS.

Please suggest what could be the possible solution or reason for the error.

Thanks

答:
You are should to check your settings in backend, when i am using html5 history, i have for this my .htaccess file (where you redirect all your requests to your root index.php or index.html file), look my .htaccess:

```<code>RewriteEngine On
  # If an existing asset or directory is requested go to it as it is
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
  RewriteRule ^ - [L]

  # If the requested resource doesn't exist, use index.html
  RewriteRule ^ /index.html
</code>```

if this not help, you are can to read this [article]

Body:
You are should to check your settings in backend, when i am using html5 history, i have for this my .htaccess file (where you redirect all your requests to your root index.php or index.html file), look my .htaccess:

RewriteEngine On
  # If an existing asset or directory is requested go to it as it is
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
  RewriteRule ^ - [L]

  # If the requested resource doesn't exist, use index.html
  RewriteRule ^ /index.html

if this not help, you are can to read this [article]


来源: stackexchange

问:
Full Screen Theme for AppCompat
I would like to know how can I apply full screen theme ( no title bar + no actionbar ) to an activity. I am using AppCompat library from support package v7.

I've tried to applied android:theme="@android:style/Theme.NoTitleBar.Fullscreen" to my specific activity but it crashed. I think it's because my application theme is like this.

```<code><style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
</code>```

I also have tried this

```<code>getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
</code>```

which only hides title bar but not the action bar.
My current workaround is that hiding the actionbar with

```<code>getSupportActionBar().hide();
</code>```

答:
just this ?</p>

```<code><style name="Theme.AppCompat.Light.NoActionBar.FullScreen">
    <item name="android:windowFullscreen">true</item>
</style>
</code>```

ContentLicense: CC BY-SA 3.0

Title: Full Screen Theme for AppCompat

Body:
just this ?

<style name="Theme.AppCompat.Light.NoActionBar.FullScreen">
    <item name="android:windowFullscreen">true</item>
</style>


问:
How to bind the multiple radio button values to controller action
following is my view code, I pass list from controller to view and here I am iterating that list through foreach I want to pass the same view-model list to the action when I submit the form

```<code>@model IEnumerable<AskQuestionViewModel>
.
.
.
<table class="table table-bordered">
 <thead>
   <tr>
     <td>Question</td>
     <td>Yes</td>
     <td>No</td>
     </tr>
 </thead>
 <tbody>
   @foreach (var q in Model)
   {
     <tr>
        <td>@q.Question</td>
        @if (q.Answer == true)
        {
          <td><input type="radio" name="@q.QuestionID" value="true" checked />/td>
        }
        else
        {
          <td><input type="radio" name=@q.QuestionID value="true" required /></td>
        }

        @if (q.Answer == false)
        {
           <td><input type="radio" name=@q.QuestionID value="false" checked /></td>
        }
        else
        {
           <td><input type="radio" name=@q.QuestionID value="false" required /></td>
        }
        </tr>
   }
</code>```

The following is action code

```<code>[HttpPost]
public ActionResult AskQuestions(List<AskQuestionViewModel> askQVM)
{
    ...
}
</code>```

I'm getting null in askQVM

答:
This is what you need for postback.</p>

```<code>    <table class="table table-bordered">
        <thead>
            <tr>
                <td>Question</td>
                <td>Yes</td>
                <td>No</td>
            </tr>
        </thead>
        <tbody>
            @using (Html.BeginForm("AskQuestions", "Questions", FormMethod.Post))
            {

                for (int i = 0; i < Model.Count; i++)
                {
                    var yesOptions = Model[i].Answer ? new { @checked = "checked" } : null;
                    var noOptions = Model[i].Answer ? null : new { @checked = "checked" };
                    <tr>
                        <td>
                            @Model[i].Question
                            @Html.HiddenFor(model=>Model[i].QuestionID)
                            @Html.HiddenFor(model=>Model[i].Question)
                        </td>
                        <td>@Html.RadioButtonFor(model => Model[i].Answer, true, yesOptions)</td>
                        <td>@Html.RadioButtonFor(model => Model[i].Answer, false, noOptions)</td>
                    </tr>
                }
                <button type="submit">Submit</button>
            }
        </tbody>
    </table>
</code>```

Body:
following is my view code, I pass list from controller to view and here I am iterating that list through foreach I want to pass the same view-model list to the action when I submit the form

@model IEnumerable<AskQuestionViewModel>
.
.
.

     Question
     Yes
     No

   @foreach (var q in Model)
   {

        @q.Question
        @if (q.Answer == true)
        {
          <input type="radio" name="@q.QuestionID" value="true" checked />/td>
        }
        else
        {
          <input type="radio" name=@q.QuestionID value="true" required />
        }

        @if (q.Answer == false)
        {
           <input type="radio" name=@q.QuestionID value="false" checked />
        }
        else
        {
           <input type="radio" name=@q.QuestionID value="false" required />
        }

   }

The following is action code

[HttpPost]
public ActionResult AskQuestions(List<AskQuestionViewModel> askQVM)
{
    ...
}

I'm getting null in askQVM

Body:
This is what you need for postback.

    <table class="table table-bordered">
        <thead>
            <tr>
                <td>Question</td>
                <td>Yes</td>
                <td>No</td>
            </tr>
        </thead>
        <tbody>
            @using (Html.BeginForm("AskQuestions", "Questions", FormMethod.Post))
            {

                for (int i = 0; i < Model.Count; i++)
                {
                    var yesOptions = Model[i].Answer ? new { @checked = "checked" } : null;
                    var noOptions = Model[i].Answer ? null : new { @checked = "checked" };
                    <tr>
                        <td>
                            @Model[i].Question
                            @Html.HiddenFor(model=>Model[i].QuestionID)
                            @Html.HiddenFor(model=>Model[i].Question)
                        </td>
                        <td>@Html.RadioButtonFor(model => Model[i].Answer, true, yesOptions)</td>
                        <td>@Html.RadioButtonFor(model => Model[i].Answer, false, noOptions)</td>
                    </tr>
                }
                <button type="submit">Submit</button>
            }
        </tbody>
    </table>


问:
Updating WCF is not working while deployment on IIS
My Issue is not new , In fact many of my pals suffers from it

Coming to the point , Issue is while updating WCF.

What is working :

The code is working fine at locals

What is not working

What I did to do now ?

Do I need to remove all the waste code from IIS ?

Do I need to delete all the websites from IIS that are using same WCF

Do I need to delete OBJ and Bin Folder at locals and again need to try with Rebuild solution and then publish the project .

How can I make previous WCF services to release the port so that new updated one can use it.

Every Single word of help should be appreciable

Thanks in Advance

答:
It seems you did not update your service reference.

You need to update service when you make changes in your WCF service file.
After update the service you need to publish the code then and the it will work.

Here is the snap for update services :


问:
React: flattenChildren(...): Encountered two children with the same key
I know this question has been asked before but I am not sure I understand what's happening here. I have an array of objects that I am mapping in a React component to create a navigation: some element could have children, so I am adding a second .map function for those elements.
Everything works fine but the second child element is not displayed because it "encounters two children with the same key". Confused...could anyone explain why? I am using the title as key which is now unique.

Here is my items array

```<code>let navItems = [
  {
    title: "Home",
    href: "/",
    children: []
  },
  {
    title: "Evaluations",
    href: "/evaluations",
    children: [
      {
       id: 1,
       title: "List all evalutions",
       href: "/"
      },
      {
        id: 2,
        title: "Planner",
        href: "/"
      },
    ]
  }
]
</code>```

And here is the code:

```<code>let items = this.props.items.map((item) => {
  if(item.children.length > 0) {
    return item.children.map((child) => {
      return <li className="menu--item" key={ item.title }>
        <a href={ item.href } className="menu--link">{ item.title }</a>
        <ul className="dropdown">
          <li key={ child.title }><a href="{ child.href}">{ child.title }</a></li>
        </ul>
      </li>
    })
  } else  {
    return <li className="menu--item" key={ item.title }>
      <a href={ item.href } className="menu--link">{ item.title }</a>
    </li>
  }
})
</code>```

答:
You should provide a unique key to each element while you are rendering items in an iteration.

Here, you are using item.title as the key for the children of the item which is same for each child of that item and you are returning an array if item.children.length > 0 and returning an element in else case. I think you should write it like this:

```<code>let items = this.props.items.map((item) => {
  if(item.children.length > 0) {
    return (
      <div key={item.id}>
        {item.children.map((child) => {
          return (
            <li className="menu--item" key={ child.id }>
              <a href={ item.href } className="menu--link">{ item.title }</a>
              <ul className="dropdown">
                <li key={ child.title }><a href="{ child.href}">{ child.title }</a></li>
              </ul>
            </li>
          )
        })}
      </div>
    )
  } else  {
    return <li className="menu--item" key={ item.id }>
      <a href={ item.href } className="menu--link">{ item.title }</a>
    </li>
  }
})
</code>```

and there should be an unique id in each navLink like this:

```<code>let navItems = [
  {
    id: '1',
    title: "Home",
    href: "/",
    children: []
  },
  {
    id: '2',
    title: "Evaluations",
    href: "/evaluations",
    children: [
      {
       id: '2.1',
       title: "List all evalutions",
       href: "/"
      },
      {
        id: '2.2',
        title: "Planner",
        href: "/"
      },
    ]
  }
]
</code>```

Hope, it helps.

Body:
I know this question has been asked before but I am not sure I understand what's happening here. I have an array of objects that I am mapping in a React component to create a navigation: some element could have children, so I am adding a second .map function for those elements.
Everything works fine but the second child element is not displayed because it "encounters two children with the same key". Confused...could anyone explain why? I am using the title as key which is now unique.

Here is my items array

let navItems = [
  {
    title: "Home",
    href: "/",
    children: []
  },
  {
    title: "Evaluations",
    href: "/evaluations",
    children: [
      {
       id: 1,
       title: "List all evalutions",
       href: "/"
      },
      {
        id: 2,
        title: "Planner",
        href: "/"
      },
    ]
  }
]

And here is the code:

let items = this.props.items.map((item) => {
  if(item.children.length > 0) {
    return item.children.map((child) => {
      return

        { item.title }

{ child.title }

    })
  } else  {
    return

      { item.title }

  }
})

Body:
You should provide a unique key to each element while you are rendering items in an iteration.

Here, you are using item.title as the key for the children of the item which is same for each child of that item and you are returning an array if item.children.length > 0 and returning an element in else case. I think you should write it like this:

let items = this.props.items.map((item) => {
  if(item.children.length > 0) {
    return (
      <div key={item.id}>
        {item.children.map((child) => {
          return (
            <li className="menu--item" key={ child.id }>
              <a href={ item.href } className="menu--link">{ item.title }</a>
              <ul className="dropdown">
                <li key={ child.title }><a href="{ child.href}">{ child.title }</a></li>
              </ul>
            </li>
          )
        })}
      </div>
    )
  } else  {
    return <li className="menu--item" key={ item.id }>
      <a href={ item.href } className="menu--link">{ item.title }</a>
    </li>
  }
})

and there should be an unique id in each navLink like this:

let navItems = [
  {
    id: '1',
    title: "Home",
    href: "/",
    children: []
  },
  {
    id: '2',
    title: "Evaluations",
    href: "/evaluations",
    children: [
      {
       id: '2.1',
       title: "List all evalutions",
       href: "/"
      },
      {
        id: '2.2',
        title: "Planner",
        href: "/"
      },
    ]
  }
]

Hope, it helps.


问:
creating a client to call a web service without a wsdl in c#
I need to connect to a web service without knowing the wsdl; the only info I have is a sample request like the one below but I have no idea where to start from to build this xml; for example what is wsse:BinarySecurityToken? and do I have to create also prefixes like "wsu" or "wsse" ???

The info below are from a test server so there are any sensitive data disclosed here.

```<code><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
        <wsse:UsernameToken wsu:Id="Username-123" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsse:Username>gen-emiswebmobile.e-mis.co.uk</wsse:Username>
        </wsse:UsernameToken>
        <wsu:Timestamp wsu:Id="Timestamp-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsu:Created>2017-06-29T22:42:44.870Z</wsu:Created>
            <wsu:Expires>2017-06-29T22:57:44.870Z</wsu:Expires>
        </wsu:Timestamp>
        <wsse:BinarySecurityToken wsu:Id="CertId-4468839874371617328" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">MIIFVjCCBD6gAwIBAgIHTvS0LmWypjANBgkqhkiG9w0BAQsFADCBtDELMAkGA1UEBhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMS0wKwYDVQQLEyRodHRwOi8vY2VydHMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS8xMzAxBgNVBAMTKkdvIERhZGR5IFNlY3VyZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjAeFw0xNDEwMDgwNzMzNDdaFw0xNjEwMDgwNzMzNDdaMEsxITAfBgNVBAsTGERvbWFpbiBDb250cm9sIFZhbGlkYXRlZDEmMCQGA1UEAxMdZ2VuLWVtaXN3ZWJtb2JpbGUuZS1taXMuY28udWswggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzpXaDzByOKYA0C1MCa2fzDzazgiJBqfHh08/kb4cf/8Vceu1mTst1ggVOrvIpTVf+jUmj05OYI1I5gSEUN+mEXOJv/mK5Fmalx+i7lIxRa3xT47KMcbAmmTzr1IY8CQUMGQhW7idDU680R2eO2n5x1q+2icViQb/Ooa23eBWgH+BwxhUqpi2NrvbHC/Xg3A8tkiIeZCsm5eyVbrzQykbFyeAKhX5ZBw+P0EKJB+mvfQ7clmyGbcBwNw3nPWscxOO2w/OYd7bh7VLiRK3Mgz6OYL3fHMc/tDsEXKXL1j+60ZVJXtZNrFykWNFsA14EV+unouf0cUZqi8kDhvG8ae+DAgMBAAGjggHTMIIBzzAMBgNVHRMBAf8EAjAAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAOBgNVHQ8BAf8EBAMCBaAwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nb2RhZGR5LmNvbS9nZGlnMnMxLTg3LmNybDBTBgNVHSAETDBKMEgGC2CGSAGG/W0BBxcBMDkwNwYIKwYBBQUHAgEWK2h0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS8wdgYIKwYBBQUHAQEEajBoMCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5nb2RhZGR5LmNvbS8wQAYIKwYBBQUHMAKGNGh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS9nZGlnMi5jcnQwHwYDVR0jBBgwFoAUQMK9J47MNIMwojPX+2yz8LQsgM4wSwYDVR0RBEQwQoIdZ2VuLWVtaXN3ZWJtb2JpbGUuZS1taXMuY28udWuCIXd3dy5nZW4tZW1pc3dlYm1vYmlsZS5lLW1pcy5jby51azAdBgNVHQ4EFgQUfnm7SRUsh4sUkMHC41QY+Q3ysZ0wDQYJKoZIhvcNAQELBQADggEBAK3zIhwhU3N7bxGjRVTFsQDLvJBjrIeJiRHXTtPF8A/muYJdcapUTcz/cl8mu9hXN3po0WJQii2kttBQD7MAjHlIMDDY6iTDrEorqch0OUSc6tJe6KQlNdeE4Cng11/AlcTBNitxE8aNiC8PUsh4P4Se8jDNoa7ESSgv9MXpHUT+Dfx5wsM4CPkUMhdaQiPQPL4QzbwpphX+hD4DTGGkKR34HR91HLoUap/gOS97ZTUmUBtgOSSKGL+kVrs+HKA6+Zbv55ya0bYFHJikN/5R1XUgZX6l3VZJJvBnmFHETd2I6H/1/VKOiSoD4JNZf7cxfDRmi8cLixE6PdSM41ve6qw=</wsse:BinarySecurityToken>
        <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
            <SignedInfo>
                <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
                <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
                <Reference URI="#Timestamp-1">
                    <Transforms>
                        <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
                    </Transforms>
                    <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
                    <DigestValue>WOHqa2p3/ZcVQ2FU36OEU9gfYaI=</DigestValue>
                </Reference>
            </SignedInfo>
            <SignatureValue>q/ZGfYAacr6Vv/LwfyAwyxXGLVkJ7qXJYkMvrCludwNRaENHNR1LekPwVuMGQ95uoKzk9npEnefHrCD1+JmufKltDtXLIZmhUJNryhOcUHzSoDLjdCAOJ+Ylccf73fhI7uHJr63NlbmV6IVzTrb3RPpfoJDpuDqyrkqS0l4HQI3BkzbDYR3Eo3ce8oUzfZ32xpLTQ/LceI6DsaHMCtimxjhAJDa1NuRDbsosHgxw8MEms1hc5VwR4s2/h6GJEkz5EXegWkm9CBNlpgceaFF7HMUPZqm7PUTHTrsmfN9uEZlp4iaUQrCBPNwsju3dbD1nOxNAxQeGvx5RNL0xvY5emg==</SignatureValue>
            <KeyInfo Id="KeyId-4468839874371617327">
                <wsse:SecurityTokenReference wsu:Id="STRId-3E04823056058230" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                    <wsse:Reference ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" URI="#CertId-4468839874371617328" />
                </wsse:SecurityTokenReference>
            </KeyInfo>
        </Signature>
    </wsse:Security>
    <Action xmlns="http://www.w3.org/2005/08/addressing">MiG</Action>
    <MessageID xmlns="http://www.w3.org/2005/08/addressing">84CF41DA-133A-442D-979B-D76697AF71BF</MessageID>
    <To xmlns="http://www.w3.org/2005/08/addressing">https://185.13.72.96/Miggateway</To>
    <ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
        <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
    </ReplyTo>
</soap:Header>
<soap:Body>
    <q1:migRequest xmlns:q1="http://www.healthcaregateway.co.uk/mig">
        <q1:serviceDefinition>
            <q1:name>MIG.DATAEXTRACTIONSERVICE.EhrExtractRequest</q1:name>
            <q1:version>0.0.2</q1:version>
        </q1:serviceDefinition>
        <q1:serviceHeader>
            <q1:source xmlns:q1="http://www.healthcaregateway.co.uk/mig">
                <q1:identifier>externaldevuser:urn:hgl:addressing:ods:N00001</q1:identifier>
            </q1:source>
            <q1:target xmlns:q1="http://www.healthcaregateway.co.uk/mig">
                <q1:nationalCode>urn:hgl:addressing:ods:A00005</q1:nationalCode>
            </q1:target>
        </q1:serviceHeader>
        <q1:serviceContent>
            <q1:ehrExtractRequestv2-0 xmlns:q1="http://www.healthcaregateway.co.uk/mig">
                <q1:id>4df5cdb1-4a20-42a5-b604-6033eec5224d</q1:id>
                <q1:consent>
                    <q1:value>Given</q1:value>
                </q1:consent>
                <q1:provenance>
                    <q1:creationTime>2013-07-15T14:37:28.7273043Z</q1:creationTime>
                    <q1:system>
                        <q1:id>BED045C0-BC58-4934-8E11-2FC08F730060</q1:id>
                        <q1:name>EMISWebCR1 50002</q1:name>
                    </q1:system>
                </q1:provenance>
                <q1:patient>
                    <q1:primaryIdentifier type="NHS">8888888888</q1:primaryIdentifier>
                </q1:patient>
                <q1:requestSpecification>
                    <q1:id>654d8e02-6b09-4754-a095-968c397db560</q1:id>
                    <q1:responseFormat>OPENHR</q1:responseFormat>
                    <q1:request>
                        <q1:name>scm.diagnosis</q1:name>
                        <q1:includeAssociatedText>true</q1:includeAssociatedText>
                    </q1:request>
                </q1:requestSpecification>
            </q1:ehrExtractRequestv2-0>
        </q1:serviceContent>
    </q1:migRequest>
</soap:Body>
</code>```

答:
There are few ways to connect to a web service. Basically, you use one of the class to "post" the exact xml to the URL.

The common ways are to use WebClient, HttpClient. It is a relatively simple to post an xml to an URL.

If I understand you correctly, you are looking at ways of how to construct the Xml in the exact format required.

One way, we have handled a similar request is by the following approach.

Take the sample xml and convert it to a template

for eg,

```<code><q1:system>
    <q1:id>BED045C0-BC58-4934-8E11-2FC08F730060</q1:id>
    <q1:name>EMISWebCR1 50002</q1:name>
</q1:system>
</code>```

becomes

```<code><q1:system>
    <q1:id>~system_id~</q1:id>
    <q1:name>~system_name~</q1:name>
</q1:system>
</code>```

In the above sample ~system_id~, ~system_name~ are the placeholders. In your application code you do a find and replace with the actual values.

This does look like "low key"... but in the good old days (i.e., before we have  xml everywhere), this was a popular approach :-)

Another more Xml way is to construct a C# class in the exact format. You populate your object with relevant values. Then you serialize your C# class to xml and post it to the URL. There are some popular SO links for this:
Generate C# class from XML

Body:
I need to connect to a web service without knowing the wsdl; the only info I have is a sample request like the one below but I have no idea where to start from to build this xml; for example what is wsse:BinarySecurityToken? and do I have to create also prefixes like "wsu" or "wsse" ???

The info below are from a test server so there are any sensitive data disclosed here.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
        <wsse:UsernameToken wsu:Id="Username-123" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsse:Username>gen-emiswebmobile.e-mis.co.uk</wsse:Username>
        </wsse:UsernameToken>
        <wsu:Timestamp wsu:Id="Timestamp-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsu:Created>2017-06-29T22:42:44.870Z</wsu:Created>
            <wsu:Expires>2017-06-29T22:57:44.870Z</wsu:Expires>
        </wsu:Timestamp>
        <wsse:BinarySecurityToken wsu:Id="CertId-4468839874371617328" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">MIIFVjCCBD6gAwIBAgIHTvS0LmWypjANBgkqhkiG9w0BAQsFADCBtDELMAkGA1UEBhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMS0wKwYDVQQLEyRodHRwOi8vY2VydHMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS8xMzAxBgNVBAMTKkdvIERhZGR5IFNlY3VyZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjAeFw0xNDEwMDgwNzMzNDdaFw0xNjEwMDgwNzMzNDdaMEsxITAfBgNVBAsTGERvbWFpbiBDb250cm9sIFZhbGlkYXRlZDEmMCQGA1UEAxMdZ2VuLWVtaXN3ZWJtb2JpbGUuZS1taXMuY28udWswggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzpXaDzByOKYA0C1MCa2fzDzazgiJBqfHh08/kb4cf/8Vceu1mTst1ggVOrvIpTVf+jUmj05OYI1I5gSEUN+mEXOJv/mK5Fmalx+i7lIxRa3xT47KMcbAmmTzr1IY8CQUMGQhW7idDU680R2eO2n5x1q+2icViQb/Ooa23eBWgH+BwxhUqpi2NrvbHC/Xg3A8tkiIeZCsm5eyVbrzQykbFyeAKhX5ZBw+P0EKJB+mvfQ7clmyGbcBwNw3nPWscxOO2w/OYd7bh7VLiRK3Mgz6OYL3fHMc/tDsEXKXL1j+60ZVJXtZNrFykWNFsA14EV+unouf0cUZqi8kDhvG8ae+DAgMBAAGjggHTMIIBzzAMBgNVHRMBAf8EAjAAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAOBgNVHQ8BAf8EBAMCBaAwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nb2RhZGR5LmNvbS9nZGlnMnMxLTg3LmNybDBTBgNVHSAETDBKMEgGC2CGSAGG/W0BBxcBMDkwNwYIKwYBBQUHAgEWK2h0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS8wdgYIKwYBBQUHAQEEajBoMCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5nb2RhZGR5LmNvbS8wQAYIKwYBBQUHMAKGNGh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS9nZGlnMi5jcnQwHwYDVR0jBBgwFoAUQMK9J47MNIMwojPX+2yz8LQsgM4wSwYDVR0RBEQwQoIdZ2VuLWVtaXN3ZWJtb2JpbGUuZS1taXMuY28udWuCIXd3dy5nZW4tZW1pc3dlYm1vYmlsZS5lLW1pcy5jby51azAdBgNVHQ4EFgQUfnm7SRUsh4sUkMHC41QY+Q3ysZ0wDQYJKoZIhvcNAQELBQADggEBAK3zIhwhU3N7bxGjRVTFsQDLvJBjrIeJiRHXTtPF8A/muYJdcapUTcz/cl8mu9hXN3po0WJQii2kttBQD7MAjHlIMDDY6iTDrEorqch0OUSc6tJe6KQlNdeE4Cng11/AlcTBNitxE8aNiC8PUsh4P4Se8jDNoa7ESSgv9MXpHUT+Dfx5wsM4CPkUMhdaQiPQPL4QzbwpphX+hD4DTGGkKR34HR91HLoUap/gOS97ZTUmUBtgOSSKGL+kVrs+HKA6+Zbv55ya0bYFHJikN/5R1XUgZX6l3VZJJvBnmFHETd2I6H/1/VKOiSoD4JNZf7cxfDRmi8cLixE6PdSM41ve6qw=</wsse:BinarySecurityToken>
        <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
            <SignedInfo>
                <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
                <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
                <Reference URI="#Timestamp-1">
                    <Transforms>
                        <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
                    </Transforms>
                    <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
                    <DigestValue>WOHqa2p3/ZcVQ2FU36OEU9gfYaI=</DigestValue>
                </Reference>
            </SignedInfo>
            <SignatureValue>q/ZGfYAacr6Vv/LwfyAwyxXGLVkJ7qXJYkMvrCludwNRaENHNR1LekPwVuMGQ95uoKzk9npEnefHrCD1+JmufKltDtXLIZmhUJNryhOcUHzSoDLjdCAOJ+Ylccf73fhI7uHJr63NlbmV6IVzTrb3RPpfoJDpuDqyrkqS0l4HQI3BkzbDYR3Eo3ce8oUzfZ32xpLTQ/LceI6DsaHMCtimxjhAJDa1NuRDbsosHgxw8MEms1hc5VwR4s2/h6GJEkz5EXegWkm9CBNlpgceaFF7HMUPZqm7PUTHTrsmfN9uEZlp4iaUQrCBPNwsju3dbD1nOxNAxQeGvx5RNL0xvY5emg==</SignatureValue>
            <KeyInfo Id="KeyId-4468839874371617327">
                <wsse:SecurityTokenReference wsu:Id="STRId-3E04823056058230" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                    <wsse:Reference ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" URI="#CertId-4468839874371617328" />
                </wsse:SecurityTokenReference>
            </KeyInfo>
        </Signature>
    </wsse:Security>
    <Action xmlns="http://www.w3.org/2005/08/addressing">MiG</Action>
    <MessageID xmlns="http://www.w3.org/2005/08/addressing">84CF41DA-133A-442D-979B-D76697AF71BF</MessageID>
    <To xmlns="http://www.w3.org/2005/08/addressing">https://185.13.72.96/Miggateway</To>
    <ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
        <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
    </ReplyTo>
</soap:Header>
<soap:Body>
    <q1:migRequest xmlns:q1="http://www.healthcaregateway.co.uk/mig">
        <q1:serviceDefinition>
            <q1:name>MIG.DATAEXTRACTIONSERVICE.EhrExtractRequest</q1:name>
            <q1:version>0.0.2</q1:version>
        </q1:serviceDefinition>
        <q1:serviceHeader>
            <q1:source xmlns:q1="http://www.healthcaregateway.co.uk/mig">
                <q1:identifier>externaldevuser:urn:hgl:addressing:ods:N00001</q1:identifier>
            </q1:source>
            <q1:target xmlns:q1="http://www.healthcaregateway.co.uk/mig">
                <q1:nationalCode>urn:hgl:addressing:ods:A00005</q1:nationalCode>
            </q1:target>
        </q1:serviceHeader>
        <q1:serviceContent>
            <q1:ehrExtractRequestv2-0 xmlns:q1="http://www.healthcaregateway.co.uk/mig">
                <q1:id>4df5cdb1-4a20-42a5-b604-6033eec5224d</q1:id>
                <q1:consent>
                    <q1:value>Given</q1:value>
                </q1:consent>
                <q1:provenance>
                    <q1:creationTime>2013-07-15T14:37:28.7273043Z</q1:creationTime>
                    <q1:system>
                        <q1:id>BED045C0-BC58-4934-8E11-2FC08F730060</q1:id>
                        <q1:name>EMISWebCR1 50002</q1:name>
                    </q1:system>
                </q1:provenance>
                <q1:patient>
                    <q1:primaryIdentifier type="NHS">8888888888</q1:primaryIdentifier>
                </q1:patient>
                <q1:requestSpecification>
                    <q1:id>654d8e02-6b09-4754-a095-968c397db560</q1:id>
                    <q1:responseFormat>OPENHR</q1:responseFormat>
                    <q1:request>
                        <q1:name>scm.diagnosis</q1:name>
                        <q1:includeAssociatedText>true</q1:includeAssociatedText>
                    </q1:request>
                </q1:requestSpecification>
            </q1:ehrExtractRequestv2-0>
        </q1:serviceContent>
    </q1:migRequest>
</soap:Body>

Body:
There are few ways to connect to a web service. Basically, you use one of the class to "post" the exact xml to the URL.

The common ways are to use WebClient, HttpClient. It is a relatively simple to post an xml to an URL.

If I understand you correctly, you are looking at ways of how to construct the Xml in the exact format required.

One way, we have handled a similar request is by the following approach.

Take the sample xml and convert it to a template

for eg,

<q1:system>
    <q1:id>BED045C0-BC58-4934-8E11-2FC08F730060</q1:id>
    <q1:name>EMISWebCR1 50002</q1:name>
</q1:system>

becomes

<q1:system>
    <q1:id>~system_id~</q1:id>
    <q1:name>~system_name~</q1:name>
</q1:system>

In the above sample ~system_id~, ~system_name~ are the placeholders. In your application code you do a find and replace with the actual values.

This does look like "low key"... but in the good old days (i.e., before we have  xml everywhere), this was a popular approach :-)

Another more Xml way is to construct a C# class in the exact format. You populate your object with relevant values. Then you serialize your C# class to xml and post it to the URL. There are some popular SO links for this:
Generate C# class from XML


答:
This is happening because you are mapping over item.children but returning a key with item.title inside. item.title doesn't change within that loop so you end up with 2
 elements with a key of "Evaluations". I suspect that you would want to use map inside
.

```<code>let items = this.props.items.map((item) => {
  if(item.children.length > 0) {
      return <li className="menu--item" key={ item.title }>
        <a href={ item.href } className="menu--link">{ item.title }</a>
        <ul className="dropdown">
          {item.children.map((child) => {
            return <li key={ child.title }><a href="{ child.href}">{ child.title }</a></li>
          })}
        </ul>
      </li>
  } else  {
    return <li className="menu--item" key={ item.title }>
      <a href={ item.href } className="menu--link">{ item.title }</a>
    </li>
  }
})
</code>```

Title: React: flattenChildren(...): Encountered two children with the same key

Body:
This is happening because you are mapping over item.children but returning a key with item.title inside. item.title doesn't change within that loop so you end up with 2 <li> elements with a key of "Evaluations". I suspect that you would want to use map inside <ul className="dropdown">.

let items = this.props.items.map((item) => {
  if(item.children.length > 0) {
      return <li className="menu--item" key={ item.title }>
        <a href={ item.href } className="menu--link">{ item.title }</a>
        <ul className="dropdown">
          {item.children.map((child) => {
            return <li key={ child.title }><a href="{ child.href}">{ child.title }</a></li>
          })}
        </ul>
      </li>
  } else  {
    return <li className="menu--item" key={ item.title }>
      <a href={ item.href } className="menu--link">{ item.title }</a>
    </li>
  }
})


问:
upload several files at once
i'm building a website with very simple cms.
I built a form already with an input type="file" already to upload pictures, but the client wants to upload several files at once. So i've looking for and I found the Uploadify, but also found some bugs and i want to try something else.
Any help??

Thanks in advance ;)

答: one possible way is to upload a zip file via input type="file" and unzip it in the script after the upload</p>

ContentLicense: CC BY-SA 2.5

Title: upload several files at once


问:
unable to push new rails to heroku database error
I am trying to push my app to heroku.

My Gemfile looks like below

```<code>source 'https://rubygems.org'

 git_source(:github) do |repo_name|
 repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
 "https://github.com/#{repo_name}.git"
 end

 # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
 gem 'rails', '~> 5.0.1'
 # Use sqlite3 as the database for Active Record
  gem 'sqlite3'
 # Use Puma as the app server
  gem 'puma', '~> 3.0'
 # Use SCSS for stylesheets
  gem 'sass-rails', '~> 5.0'
 # Use Uglifier as compressor for JavaScript assets
  gem 'uglifier', '>= 1.3.0'
 # Use CoffeeScript for .coffee assets and views
  gem 'coffee-rails', '~> 4.2'
 # See https://github.com/rails/execjs#readme for more supported runtimes
 # gem 'therubyracer', platforms: :ruby

 # Use jquery as the JavaScript library
  gem 'jquery-rails'
 # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
  gem 'turbolinks', '~> 5'
 # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
  gem 'jbuilder', '~> 2.5'
 # Use Redis adapter to run Action Cable in production
  # gem 'redis', '~> 3.0'
 # Use ActiveModel has_secure_password
  # gem 'bcrypt', '~> 3.1.7'

 # Use Capistrano for deployment
 # gem 'capistrano-rails', group: :development

 group :development, :test do
 # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platform: :mri
 end

 group :development do
 # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '~> 3.0.5'
 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
 end

# Windows does not include zoneinfo files, so bundle the tzinfo-data
 gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

 gem 'pg'
</code>```

I am not able to push when I do git push heroku master.

Below is the error which I am getting

gem::Ext::BuildError: ERROR: Failed to build gem native extension.

-r remote:        ./siteconf20170706-221-1q194t4.rb extconf.rb remote:        checking for sqlite3.h... no remote:        sqlite3.h is missing. Try
  'brew install sqlite3', remote:        'yum install sqlite-devel' or
  'apt-get install libsqlite3-dev' remote:        and check your shared

shared library is located). remote:        * extconf.rb failed *
  remote:        Could not create Makefile due to some reason, probably
  lack of necessary remote:        libraries and/or headers.  Check the
  mkmf.log file for more details.  You may remote:        need
  remote:        --with-sqlite3-config remote:

  which can remote:        be found here: remote:         remote:

  remote:         remote:        extconf failed, exit code 1 remote:

  remote:        Gem files will remain installed in remote:

  remote:         remote:        An error occurred while installing
  sqlite3 (1.3.13), and
  Bundler cannot
  remote:        continue.
  remote:        Make sure that gem install sqlite3 -v '1.3.13' succeeds
  remote:  !     Failed to install gems via Bundler.

Sorry for the poor format of the question, please suggest what I am missing.

答:
add gem pg to heroku because on posgres is used on heroku.

or do this:

Gemfile

```<code>gem 'sqlite3', group: :development
gem 'pg', group: :production
</code>```

then

```<code>bundle install
</code>```

and push Gemfile and Gemfile.lock to heroku

Body:
I am trying to push my app to heroku.

My Gemfile looks like below

source 'https://rubygems.org'

 git_source(:github) do |repo_name|
 repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
 "https://github.com/#{repo_name}.git"
 end

 # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
 gem 'rails', '~> 5.0.1'
 # Use sqlite3 as the database for Active Record
  gem 'sqlite3'
 # Use Puma as the app server
  gem 'puma', '~> 3.0'
 # Use SCSS for stylesheets
  gem 'sass-rails', '~> 5.0'
 # Use Uglifier as compressor for JavaScript assets
  gem 'uglifier', '>= 1.3.0'
 # Use CoffeeScript for .coffee assets and views
  gem 'coffee-rails', '~> 4.2'
 # See https://github.com/rails/execjs#readme for more supported runtimes
 # gem 'therubyracer', platforms: :ruby

 # Use jquery as the JavaScript library
  gem 'jquery-rails'
 # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
  gem 'turbolinks', '~> 5'
 # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
  gem 'jbuilder', '~> 2.5'
 # Use Redis adapter to run Action Cable in production
  # gem 'redis', '~> 3.0'
 # Use ActiveModel has_secure_password
  # gem 'bcrypt', '~> 3.1.7'

 # Use Capistrano for deployment
 # gem 'capistrano-rails', group: :development

 group :development, :test do
 # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platform: :mri
 end

 group :development do
 # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '~> 3.0.5'
 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
 end

# Windows does not include zoneinfo files, so bundle the tzinfo-data
 gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

 gem 'pg'

I am not able to push when I do git push heroku master.

Below is the error which I am getting

gem::Ext::BuildError: ERROR: Failed to build gem native extension.

-r remote:        ./siteconf20170706-221-1q194t4.rb extconf.rb remote:        checking for sqlite3.h... no remote:        sqlite3.h is missing. Try
  'brew install sqlite3', remote:        'yum install sqlite-devel' or
  'apt-get install libsqlite3-dev' remote:        and check your shared

shared library is located). remote:        * extconf.rb failed *
  remote:        Could not create Makefile due to some reason, probably
  lack of necessary remote:        libraries and/or headers.  Check the
  mkmf.log file for more details.  You may remote:        need
  remote:        --with-sqlite3-config remote:

  which can remote:        be found here: remote:         remote:

  remote:         remote:        extconf failed, exit code 1 remote:

  remote:        Gem files will remain installed in remote:

  remote:         remote:        An error occurred while installing
  sqlite3 (1.3.13), and
  Bundler cannot
  remote:        continue.
  remote:        Make sure that gem install sqlite3 -v '1.3.13' succeeds
  remote:  !     Failed to install gems via Bundler.

Sorry for the poor format of the question, please suggest what I am missing.

Body:
add gem pg to heroku because on posgres is used on heroku.

or do this:

Gemfile

gem 'sqlite3', group: :development
gem 'pg', group: :production

then

bundle install

and push Gemfile and Gemfile.lock to heroku


问:
how to identify or detect scanner from network using java library in spring boot?
I am using ubuntu 16.04, 64 bit OS . I am trying to scan image from scanner. I am trying  since 5 days. I have used Jsane , twain. i have also try to search Jsane and twain dependency for maven project but i was fail.
I have also try to find morena 7, jar and maven dependency. I am not sure which jar and dependency is use for scanning image from scanner. Please suggest me if there is any better way .  I am tired</p>

答:
I have also tried but didn't get so much luck.

I am able to detect printer using javax library

```<code>PrintService _service = PrintServiceLookup.lookupDefaultPrintService();
if (service != null)
{
    String printServiceName = _service.getName();
    System.out.println("Printer Service Name is " + printServiceName);
}
else
{
    System.out.println("No printer service found");
}
</code>```

Body:
I have also tried but didn't get so much luck.

I am able to detect printer using javax library

PrintService _service = PrintServiceLookup.lookupDefaultPrintService();
if (service != null)
{
    String printServiceName = _service.getName();
    System.out.println("Printer Service Name is " + printServiceName);
}
else
{
    System.out.println("No printer service found");
}


问:
PHP - Echoing multiple nested quotes of HTML
I'm attempting to echo the following line of HTML through PHP

```<code>echo "<a class='fa fa-ban fa-2x cancelClass' onClick='cancelClass('$id', '$formattedDate', '$time')'></a><p class='text-center'>".$formattedDate." @ $time</p>";
</code>```

I don't get an error. But the quotes for onClick='cancelClass... don't get parsed properly, which leads to the javascript function not executing.

How it gets color coded in Google Chrome Source View

How it should get color coded (example of another function)

答:
Change it to the following

```<code>echo "<a class=\"fa fa-ban fa-2x cancelClass\" onClick=\"cancelClass('$id', '$formattedDate', '$time')\"></a><p class=\"text-center\">".$formattedDate." @ $time</p>";
</code>```

escaping the attribute double quotes you can have a normalized html

Body:
I'm attempting to echo the following line of HTML through PHP

echo "
".$formattedDate." @ $time
";

I don't get an error. But the quotes for onClick='cancelClass... don't get parsed properly, which leads to the javascript function not executing.

How it gets color coded in Google Chrome Source View

How it should get color coded (example of another function)

Body:
Change it to the following

echo "<a class=\"fa fa-ban fa-2x cancelClass\" onClick=\"cancelClass('$id', '$formattedDate', '$time')\"></a><p class=\"text-center\">".$formattedDate." @ $time</p>";

escaping the attribute double quotes you can have a normalized html


问:
Google Map on Bootstrap Modal is grey - resizing the window makes it appear
I run this function after the page has loaded but no map displayed, just a grey square with the google logo and terms of use button at the bottom:

```<code>initMap() {
    var area = new google.maps.LatLngBounds(
        new google.maps.LatLng(-47.746617, 165.346753),
        new google.maps.LatLng(-33.670946, -179.667808)
    );

    var options = {
        bounds: area,
    zoom: 13
    };
    //this.autocomplete = new google.maps.places.Autocomplete(<HTMLInputElement>this.areaInput.areaInput.nativeElement, options);

       var  map = new google.maps.Map(document.getElementById('map'), {
    center: { lat: -33.8688, lng: 151.2195 },
    zoom: 13
});
google.maps.event.trigger(map, "resize");

}
</code>```

html:

```<code><div id="map"></div>
</code>```

css:

```<code>#map {
        height: 300px;
        overflow: visible;
        width:100%
    }

    #map * {
        overflow: visible;
    }
</code>```

Why is the map just a grey square?

EDIT - When I resize the window, the map appears. Why is this?

How do I make it appear without needing to resize the window?

The map is on a bootstrap modal. The user has to click something to make the modal appear. The map appears but is grey with no actual map until resizing the window manually with the mouse.

EDIT: it is to do with timing. If i hook a button up to resize the map it works when clicking the button.

答:
maybe somebody can benefit from this answer after almost one year :). i had the same problem and i solved it like this:
in the initMap function, i triggered the resize</p>

```<code>    function initMap() {
    var myCenter = new google.maps.LatLng(20.296100, 85.824500);
    var mapProp = { center: myCenter, zoom: 12, scrollwheel: false, draggable: true, mapTypeId: google.maps.MapTypeId.ROADMAP };
    var map = new google.maps.Map(document.getElementById("googleMap"), mapProp);
    var marker = new google.maps.Marker({ position: myCenter });
    marker.setMap(map);

    $('a[href="#apartmentInfo"]').on('shown.bs.tab', function (e) {
        google.maps.event.trigger(map, 'resize');
        map.setCenter(mapProp.center);
    });
};
</code>```

Body:
I run this function after the page has loaded but no map displayed, just a grey square with the google logo and terms of use button at the bottom:

initMap() {
    var area = new google.maps.LatLngBounds(
        new google.maps.LatLng(-47.746617, 165.346753),
        new google.maps.LatLng(-33.670946, -179.667808)
    );

    var options = {
        bounds: area,
    zoom: 13
    };
    //this.autocomplete = new google.maps.places.Autocomplete(<HTMLInputElement>this.areaInput.areaInput.nativeElement, options);

       var  map = new google.maps.Map(document.getElementById('map'), {
    center: { lat: -33.8688, lng: 151.2195 },
    zoom: 13
});
google.maps.event.trigger(map, "resize");

}

html:

css:

#map {
        height: 300px;
        overflow: visible;
        width:100%
    }

    #map * {
        overflow: visible;
    }

Why is the map just a grey square?

EDIT - When I resize the window, the map appears. Why is this?

How do I make it appear without needing to resize the window?

The map is on a bootstrap modal. The user has to click something to make the modal appear. The map appears but is grey with no actual map until resizing the window manually with the mouse.

EDIT: it is to do with timing. If i hook a button up to resize the map it works when clicking the button.

Body:
maybe somebody can benefit from this answer after almost one year :). i had the same problem and i solved it like this:
in the initMap function, i triggered the resize

    function initMap() {
    var myCenter = new google.maps.LatLng(20.296100, 85.824500);
    var mapProp = { center: myCenter, zoom: 12, scrollwheel: false, draggable: true, mapTypeId: google.maps.MapTypeId.ROADMAP };
    var map = new google.maps.Map(document.getElementById("googleMap"), mapProp);
    var marker = new google.maps.Marker({ position: myCenter });
    marker.setMap(map);

    $('a[href="#apartmentInfo"]').on('shown.bs.tab', function (e) {
        google.maps.event.trigger(map, 'resize');
        map.setCenter(mapProp.center);
    });
};


问:
How to disable gae python to check for updates every time I start a server in eclipse?
I just hate seeing this for 20sec every time I run my server: appcfg.py:393] Checking for updates to the SDK.

答:
Create or edit the file .appcfg_nag in your home directory. Edit the first line to be:</p>

```<code>opt_in: false
</code>```

Body:
Create or edit the file .appcfg_nag in your home directory. Edit the first line to be:

opt_in: false


问:
Installing PHP7 and Apache2.4 - php7apache2_4.dll error on Windows 10
Just got on a Windows 10 and after I configured my php.ini and http.conf I went on the command line httpd.exe and got this error message:

```<code>httpd.exe: Syntax error on line 530 of C:/Apache/conf/httpd.conf: Cannot load C:/php/php7apache2_4.dll into server: The specified module could not be found.
</code>```

I KNOW this file is in that folder. I've installed both 64 bits version of PHP and Apache and I don't know what's going on.

答:
Check whether you have installed Thread safe version of PHP. Non Thread safe version will cause this error.

You can download thread safe version of PHP here

Body:
Just got on a Windows 10 and after I configured my php.ini and http.conf I went on the command line httpd.exe and got this error message:

httpd.exe: Syntax error on line 530 of C:/Apache/conf/httpd.conf: Cannot load C:/php/php7apache2_4.dll into server: The specified module could not be found.

I KNOW this file is in that folder. I've installed both 64 bits version of PHP and Apache and I don't know what's going on.


问:
Does D-Bus guarantee message delivery?
I would like to know if D-Bus guarantees message delivery when used directly through the low level C API call dbus_connection_send_with_reply?

More specifically, does it guarantee that a single instance of a messages is delivered to the destination or if it fails that an error reply is returned?

I understand that the receiving application may not issue a reply to a method in which case D-Bus will return an error after a timeout. However, are all other potential failures covered by the D-Bus protocol?

答:
tl;dr:

Delivery can never be guaranteed. However, even if the message is not delivered, you can expect an error reply to say so.

If you use DBUS_TIMEOUT_INFINITE, you might wait forever for a reply. If the function call returns FALSE, there will be no reply. Otherwise, you will get exactly one.

I am an upstream maintainer of D-Bus, the message passing protocol specification, and dbus, the reference implementation of D-Bus.

Terminology: your process calling dbus_connection_send_with_reply() is the client, the process that is expected to reply is the service. Normally there would be a dbus-daemon in between, although connecting directly to a service is possible in specialized situations (if you are doing this, then you should already know you are doing so).

In general, the API guarantee is that if dbus_connection_send_with_reply() succeeds (returns TRUE), you will see exactly one reply, which can either be a successful return (only if the message was delivered) or an error (which can happen whether the message was delivered or not). If it fails due to out-of-memory or other pathological conditions (returns FALSE), you will see exactly no replies. The implementation goes to considerable lengths to ensure this.

Before dbus_connection_send_with_reply() returns, it preallocates the synthetic error message that you will receive if the call times out; if that fails, the message is not sent and dbus_connection_send_with_reply() fails. So even if the dbus-daemon or the transport drops the real (success or error) reply on the floor, you will get the timeout error message eventually. (Reference: git grep _dbus_pending_call_set_timeout_error_unlocked in a copy of the dbus source code)

The one exception to that API guarantee is if you use DBUS_TIMEOUT_INFINITE for the timeout (in which case: you asked for it, you got it). In that case, there are situations where you will never see a reply: either the service never responds but remains on the bus; or, more pathologically, the service never responds and leaves the bus, and the dbus-daemon runs out of memory while attempting to deliver the error reply that it synthesizes as a way to report that there will never be a reply from the service.

Title: Does D-Bus guarantee message delivery?


问:
Picturebox location for X and Y is different then what is being entered in properties
I have 2 picture box's, a hero and an enemy. The hero seems to load fine at the location I specify in the properties of the PictureBox (0,0). However, the enemy picture box I want it to be set to location (90,90), which I do set it to that, but when I run the windows form - for some reason - it is showing the picture form is at location (60,58).

The hero PictureBox is the Green and the Enemy is Orange.

I am wanting to make a simple game and want to move the hero the exact size as the tile he is so that if you move the hero to where the enemy is they should stack up flat on top of each other. I have my form set to a full size of (300,300) and both picture boxes are a size of (30,30). So, they should be able to "move" 10 moves to the left and right - if they are set at a starting position of (0,0). I am not sure if it is my movement method that is messing me up but I also have zero ideas as to why the location of x and y are different when I tried to post it to console to debug this situation- instead of being 90,90 where I placed it on the form and in properties. Ideally I should be able to move 3 to the left and 3 down and be on top of the enemy but it's not at all correct.

Is there any reason why these are not the same? I will attach photos and my source code.

Starting Position

Hero Moving - They are not directly on top of each other but should be

Enemy Properties - to show size and location

Hero Properties - to show size and location

CODE

```<code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Mirage
{
public partial class Form1 : Form
{
Random rand = new Random();

public Form1()
{
    InitializeComponent();
    Console.WriteLine("HERO STARTING LOCATION --- X = : {0} ---- Y = : {1}", pctrBxHero.Location.X, pctrBxHero.Location.Y);
}

private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
    using (Font myFont = new Font("Lucida", 10))
    {
        e.Graphics.DrawString("@", myFont, Brushes.Green, new Point(0, 0));
    }
}

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
    int x = pctrBxHero.Location.X;
    int y = pctrBxHero.Location.Y;

    if (e.KeyCode == Keys.Right) x += 30;
    else if (e.KeyCode == Keys.Left) x -= 30;
    else if (e.KeyCode == Keys.Up) y -= 30;
    else if (e.KeyCode == Keys.Down) y += 30;

    pctrBxHero.Location = new Point(x, y);
    Console.WriteLine("HERO --- X = : {0} ---- Y = : {1}", x, y);
    Console.WriteLine("ENEMY --- X = : {0} ---- Y = : {1}", pctrBxEnemy.Location.X, pctrBxEnemy.Location.Y);
}

private void pictureBox2_Paint_1(object sender, PaintEventArgs e)
{

    using (Font myFont = new Font("Lucida", 10))
    {
        e.Graphics.DrawString("X", myFont, Brushes.Orange, new Point(0, 0));
    }
}
}
}
</code>```

答:
Btw, the properties for the pctrBxEnemy, under the behavior section shows CenterImage. It may reposition your picture box as CenterImage tries to position the image in the center of the client area.

I tried to load your project. It is weird that the position of that enemy is 60,58. Nonetheless, you could override it in the code whilst initialising (as below). Now, when I press 3 down and 3 right - the box completely overlaps.

```<code>public Form1()
    {
        InitializeComponent();
        Console.WriteLine("HERO STARTING LOCATION --- X = : {0} ---- Y = : {1}", pctrBxHero.Location.X, pctrBxHero.Location.Y);
        pctrBxEnemy.Location = new Point(90, 90);
    }
</code>```

Body:
I have 2 picture box's, a hero and an enemy. The hero seems to load fine at the location I specify in the properties of the PictureBox (0,0). However, the enemy picture box I want it to be set to location (90,90), which I do set it to that, but when I run the windows form - for some reason - it is showing the picture form is at location (60,58).

The hero PictureBox is the Green and the Enemy is Orange.

I am wanting to make a simple game and want to move the hero the exact size as the tile he is so that if you move the hero to where the enemy is they should stack up flat on top of each other. I have my form set to a full size of (300,300) and both picture boxes are a size of (30,30). So, they should be able to "move" 10 moves to the left and right - if they are set at a starting position of (0,0). I am not sure if it is my movement method that is messing me up but I also have zero ideas as to why the location of x and y are different when I tried to post it to console to debug this situation- instead of being 90,90 where I placed it on the form and in properties. Ideally I should be able to move 3 to the left and 3 down and be on top of the enemy but it's not at all correct.

Is there any reason why these are not the same? I will attach photos and my source code.

Starting Position

Hero Moving - They are not directly on top of each other but should be

Enemy Properties - to show size and location

Hero Properties - to show size and location

CODE

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Mirage
{
public partial class Form1 : Form
{
Random rand = new Random();

public Form1()
{
    InitializeComponent();
    Console.WriteLine("HERO STARTING LOCATION --- X = : {0} ---- Y = : {1}", pctrBxHero.Location.X, pctrBxHero.Location.Y);
}

private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
    using (Font myFont = new Font("Lucida", 10))
    {
        e.Graphics.DrawString("@", myFont, Brushes.Green, new Point(0, 0));
    }
}

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
    int x = pctrBxHero.Location.X;
    int y = pctrBxHero.Location.Y;

    if (e.KeyCode == Keys.Right) x += 30;
    else if (e.KeyCode == Keys.Left) x -= 30;
    else if (e.KeyCode == Keys.Up) y -= 30;
    else if (e.KeyCode == Keys.Down) y += 30;

    pctrBxHero.Location = new Point(x, y);
    Console.WriteLine("HERO --- X = : {0} ---- Y = : {1}", x, y);
    Console.WriteLine("ENEMY --- X = : {0} ---- Y = : {1}", pctrBxEnemy.Location.X, pctrBxEnemy.Location.Y);
}

private void pictureBox2_Paint_1(object sender, PaintEventArgs e)
{

    using (Font myFont = new Font("Lucida", 10))
    {
        e.Graphics.DrawString("X", myFont, Brushes.Orange, new Point(0, 0));
    }
}
}
}

Body:
Btw, the properties for the pctrBxEnemy, under the behavior section shows CenterImage. It may reposition your picture box as CenterImage tries to position the image in the center of the client area.

I tried to load your project. It is weird that the position of that enemy is 60,58. Nonetheless, you could override it in the code whilst initialising (as below). Now, when I press 3 down and 3 right - the box completely overlaps.

public Form1()
    {
        InitializeComponent();
        Console.WriteLine("HERO STARTING LOCATION --- X = : {0} ---- Y = : {1}", pctrBxHero.Location.X, pctrBxHero.Location.Y);
        pctrBxEnemy.Location = new Point(90, 90);
    }


答:
You need to do something like:</p>

```<code>echo "<a class='fa fa-ban fa-2x cancelClass' onClick=\"cancelClass('".$id."', '".$formattedDate."', '".$time."')\"></a><p class='text-center'>".$formattedDate." @ $time</p>";
</code>```

Title: PHP - Echoing multiple nested quotes of HTML

Body:
You need to do something like:

echo "<a class='fa fa-ban fa-2x cancelClass' onClick=\"cancelClass('".$id."', '".$formattedDate."', '".$time."')\"></a><p class='text-center'>".$formattedDate." @ $time</p>";


问:
how to pull the updated PR of github
I have pulled the PR from github, now someone else updated the PR. Then how can I update the PR in my local ? The following command doesn't work for me.

```<code>git pull upstream pr/2329
fatal: Couldn't find remote ref pr/2329
</code>```

I can see pr/2329 in git branch -r command, and also I can see upstream in git remote -v

答:
```<code>git checkout pr/2329
git pull upstream pull/2329/head
</code>```

pr/2329 is your local branch that you've created for that Pull Request. Switch to it and update from pull request. Pull requests at Github are just branches in pull/ namespace.

Title: how to pull the updated PR of github

Body:
I have pulled the PR from github, now someone else updated the PR. Then how can I update the PR in my local ? The following command doesn't work for me.

git pull upstream pr/2329
fatal: Couldn't find remote ref pr/2329

I can see pr/2329 in git branch -r command, and also I can see upstream in git remote -v

Body:
git checkout pr/2329
git pull upstream pull/2329/head

pr/2329 is your local branch that you've created for that Pull Request. Switch to it and update from pull request. Pull requests at Github are just branches in pull/ namespace.


问:
Exposing properties of an object contained by a control
I have a simple object, could be a struct even, with three properties that I want to expose to the designer. Basically, I want my property to look like the Size or Padding properties of your average control, with an arrow to collapse or expand the properties as a sub-list of the control's properties. However, I cannot find any reference as to how this can be done. Since there are several types of properties with this collapse/extend look and feel I imagine there's something built-in I can use. If I have to implement my own Designer or Editor, forget it; it's not worth it. I doubt that that's the case; there's gotta be some simple attribute I can stick on the property or class that tells the designer to expose the browsable sub-properties.</p>

答: As Hans said, the solution is to implement a custom TypeConverter. Not worth it for me, so I just flattened the object hierarchy and it works well enough for my purposes. Thanks to all who answered.</p>


问:
How to enable TLS v1.2 in Wildfly 10 standalone mode?
Need help to ensure our Wildfly 10 server (installed on Ubuntu 16.04.1 LTS)  supports only TLS v1.2 and above.

How to check current ssl certificate version ?

We have enabled https in our server by editing standalone.xml

```<code>    <security-realms>
        <security-realm name="ManagementRealm">
            <authentication>
                <local default-user="$local" skip-group-loading="true"/>
                <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
            </authentication>
            <authorization map-groups-to-roles="false">
                <properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/>
            </authorization>
        </security-realm>
        <security-realm name="ApplicationRealm">
            <server-identities>
                <ssl>
                    <keystore path="server.keystore" relative-to="jboss.server.config.dir" keystore-password="serverpassword" alias="server" key-password="serverpassword"/>
                </ssl>
            </server-identities>
            <authentication>
                <local default-user="$local" allowed-users="*" skip-group-loading="true"/>
                <properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
            </authentication>
            <authorization>
                <properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
            </authorization>
        </security-realm>
    </security-realms>
    <subsystem xmlns="urn:jboss:domain:security:1.2">
        <security-domains>
            <security-domain name="other" cache-type="default">
                <authentication>
                    <login-module code="Remoting" flag="optional">
                        <module-option name="password-stacking" value="useFirstPass"/>
                    </login-module>
                    <login-module code="RealmDirect" flag="required">
                        <module-option name="password-stacking" value="useFirstPass"/>
                    </login-module>
                </authentication>
            </security-domain>
            <security-domain name="jboss-web-policy" cache-type="default">
                <authorization>
                    <policy-module code="Delegating" flag="required"/>
                </authorization>
            </security-domain>
            <security-domain name="jboss-ejb-policy" cache-type="default">
                <authorization>
                    <policy-module code="Delegating" flag="required"/>
                </authorization>
            </security-domain>
            <security-domain name="jaspitest" cache-type="default">
                <authentication-jaspi>
                    <login-module-stack name="dummy">
                        <login-module code="Dummy" flag="optional"/>
                    </login-module-stack>
                    <auth-module code="Dummy"/>
                </authentication-jaspi>
            </security-domain>
        </security-domains>
    </subsystem>
    <subsystem xmlns="urn:jboss:domain:undertow:3.0">
        <buffer-cache name="default"/>
        <server name="default-server">
            <http-listener name="default" socket-binding="http" redirect-socket="https"/>
            <https-listener name="httpsServer" security-realm="ApplicationRealm" socket-binding="https"/>
            <host name="default-host" alias="localhost">
                <location name="/" handler="welcome-content"/>
                <filter-ref name="server-header"/>
                <filter-ref name="x-powered-by-header"/>
            </host>
        </server>
        <servlet-container name="default">
            <jsp-config/>
            <websockets/>
        </servlet-container>
</code>```

答:
Edit https-listener tag in standalone.xml file. And restart wildfly server.

```<code><https-listener name="httpsServer" security-realm="ApplicationRealm" socket-binding="https" enabled-protocols="TLSv1.2"/>
</code>```

Ensure the same by running TestSSLServer from link.

```<code>TestSSLServer4.exe localhost 8443
</code>```

Body:
Need help to ensure our Wildfly 10 server (installed on Ubuntu 16.04.1 LTS)  supports only TLS v1.2 and above.

How to check current ssl certificate version ?

We have enabled https in our server by editing standalone.xml

    <security-realms>
        <security-realm name="ManagementRealm">
            <authentication>
                <local default-user="$local" skip-group-loading="true"/>
                <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
            </authentication>
            <authorization map-groups-to-roles="false">
                <properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/>
            </authorization>
        </security-realm>
        <security-realm name="ApplicationRealm">
            <server-identities>
                <ssl>
                    <keystore path="server.keystore" relative-to="jboss.server.config.dir" keystore-password="serverpassword" alias="server" key-password="serverpassword"/>
                </ssl>
            </server-identities>
            <authentication>
                <local default-user="$local" allowed-users="*" skip-group-loading="true"/>
                <properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
            </authentication>
            <authorization>
                <properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
            </authorization>
        </security-realm>
    </security-realms>
    <subsystem xmlns="urn:jboss:domain:security:1.2">
        <security-domains>
            <security-domain name="other" cache-type="default">
                <authentication>
                    <login-module code="Remoting" flag="optional">
                        <module-option name="password-stacking" value="useFirstPass"/>
                    </login-module>
                    <login-module code="RealmDirect" flag="required">
                        <module-option name="password-stacking" value="useFirstPass"/>
                    </login-module>
                </authentication>
            </security-domain>
            <security-domain name="jboss-web-policy" cache-type="default">
                <authorization>
                    <policy-module code="Delegating" flag="required"/>
                </authorization>
            </security-domain>
            <security-domain name="jboss-ejb-policy" cache-type="default">
                <authorization>
                    <policy-module code="Delegating" flag="required"/>
                </authorization>
            </security-domain>
            <security-domain name="jaspitest" cache-type="default">
                <authentication-jaspi>
                    <login-module-stack name="dummy">
                        <login-module code="Dummy" flag="optional"/>
                    </login-module-stack>
                    <auth-module code="Dummy"/>
                </authentication-jaspi>
            </security-domain>
        </security-domains>
    </subsystem>
    <subsystem xmlns="urn:jboss:domain:undertow:3.0">
        <buffer-cache name="default"/>
        <server name="default-server">
            <http-listener name="default" socket-binding="http" redirect-socket="https"/>
            <https-listener name="httpsServer" security-realm="ApplicationRealm" socket-binding="https"/>
            <host name="default-host" alias="localhost">
                <location name="/" handler="welcome-content"/>
                <filter-ref name="server-header"/>
                <filter-ref name="x-powered-by-header"/>
            </host>
        </server>
        <servlet-container name="default">
            <jsp-config/>
            <websockets/>
        </servlet-container>

Body:
Edit https-listener tag in standalone.xml file. And restart wildfly server.

<https-listener name="httpsServer" security-realm="ApplicationRealm" socket-binding="https" enabled-protocols="TLSv1.2"/>

Ensure the same by running TestSSLServer from link.

TestSSLServer4.exe localhost 8443


问:
Javascript to reurn boolean value
I need to create a web page as shown below

Below is my current code

function validate() {
  var form = document.getElementsByTagName('form')[0];
  if (form.tickets.value <= form.childrens.value) {
    alert("No of tickets should be greater than the no of children");
    return false;
  } else if (new Date(form.showdate.value) < new Date()) {
    alert("Show date and time should be either current date or future date");
    return false;
  }
  var ticketFare = (form.tickets.value - form.childrens.value) * 200 + form.childrens.value * 100;
  alert("Your approximate ticket amount is " + ticketFare + "INR");
  return true;

}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.item img {
  height: 200px;
  width: 200px;
  -webkit-transition: all 2s ease;
  -moz-transition: all 2s ease;
  -ms-transition: all 2s ease;
  transition: all 2s ease;
}

.item img:hover {
  width: 300px;
  height: 300px;
}</code>```

Movie Ticket Booking

  <form action="thankyou.html" onsubmit="alert(validate());">

        Name
        <input type="text" name="name" placeholder="Enter the name" pattern="[A-za-z\s]+" required>

        Movie Name
        <input type="text" name="moviename" autocomplete="on" list="movies" required>
          <datalist id="movies">
      <option value="Irada"></option>
  <option value="Rangoon"></option>
  <option value="Logan"></option>
  <option value="Fist Fight"></option>
  </datalist>

        Circle
        <input type="text" name="circle" autocomplete="on" list="circles" required>
          <datalist id="circles">
      <option value="Silver"></option>
  <option value="Gold"></option>
  <option value="Platinum"></option>
  </datalist>

        Phone no
        <input type="text" name="phone" placeholder="Enter mobile # here" pattern="[\d]{10}" required>

        Show date and time
        <input type="datetime-local" name="showdate" required>

        No of tickets
        <input type="number" name="tickets" min="1" max="10" required>

        No of children's
        <input type="number" name="childrens" min="1" max="5" required>

        <input type="submit" value="Book My Show">
        <input type="reset" name="reset">

  </form>
```

Error:
Have provided all the inputs correctly, but the ticket calculation is wrong or The javaScript method is not returning any boolean value

答:
change form.tickets.value to form.getElementsByAttribute('name','tickets')[0].value

You should do the same to the rest of your form elements (showdate, childrens..)

Title: Javascript to reurn boolean value

Body:
I need to create a web page as shown below

Below is my current code

function validate() {
  var form = document.getElementsByTagName('form')[0];
  if (form.tickets.value <= form.childrens.value) {
    alert("No of tickets should be greater than the no of children");
    return false;
  } else if (new Date(form.showdate.value) < new Date()) {
    alert("Show date and time should be either current date or future date");
    return false;
  }
  var ticketFare = (form.tickets.value - form.childrens.value) * 200 + form.childrens.value * 100;
  alert("Your approximate ticket amount is " + ticketFare + "INR");
  return true;

}

.item img {
  height: 200px;
  width: 200px;
  -webkit-transition: all 2s ease;
  -moz-transition: all 2s ease;
  -ms-transition: all 2s ease;
  transition: all 2s ease;
}

.item img:hover {
  width: 300px;
  height: 300px;
}

Movie Ticket Booking

  <form action="thankyou.html" onsubmit="alert(validate());">

        Name
        <input type="text" name="name" placeholder="Enter the name" pattern="[A-za-z\s]+" required>

        Movie Name
        <input type="text" name="moviename" autocomplete="on" list="movies" required>
          <datalist id="movies">
      <option value="Irada"></option>
  <option value="Rangoon"></option>
  <option value="Logan"></option>
  <option value="Fist Fight"></option>
  </datalist>

        Circle
        <input type="text" name="circle" autocomplete="on" list="circles" required>
          <datalist id="circles">
      <option value="Silver"></option>
  <option value="Gold"></option>
  <option value="Platinum"></option>
  </datalist>

        Phone no
        <input type="text" name="phone" placeholder="Enter mobile # here" pattern="[\d]{10}" required>

        Show date and time
        <input type="datetime-local" name="showdate" required>

        No of tickets
        <input type="number" name="tickets" min="1" max="10" required>

        No of children's
        <input type="number" name="childrens" min="1" max="5" required>

        <input type="submit" value="Book My Show">
        <input type="reset" name="reset">

  </form>

Error:
Have provided all the inputs correctly, but the ticket calculation is wrong or The javaScript method is not returning any boolean value


答:
They do get parsed properly, however you specified the wrong ones to use. Javascript can't differentiate between the quotes to wrap your string variables and the quotes to wrap the "onclick" value, it thinks the onclick ends too early.

To differentiate them you'll have to escape them then. using \" for the ones inside the brackets.

```<code>echo "<a class='fa fa-ban fa-2x cancelClass' onClick='cancelClass(\"$id\", \"$formattedDate\", \"$time\")'></a><p class='text-center'>".$formattedDate." @ $time</p>";
</code>```

should do the trick.

Alternatively, don't use echo for the whole string, simply output most of it direct:

```<code>?> //temporarily stop interpreting the file as PHP, so the next bit will be output directly as raw HTML
<a class='fa fa-ban fa-2x cancelClass' onClick='cancelClass("<?php echo $id;?>", "<?php echo $formattedDate; ?>", "<?php echo $time;?>")'></a><p class='text-center'>".$formattedDate." @ $time</p>
<?php //continue with PHP
</code>```

Body:
They do get parsed properly, however you specified the wrong ones to use. Javascript can't differentiate between the quotes to wrap your string variables and the quotes to wrap the "onclick" value, it thinks the onclick ends too early.

To differentiate them you'll have to escape them then. using \" for the ones inside the brackets.

echo "<a class='fa fa-ban fa-2x cancelClass' onClick='cancelClass(\"$id\", \"$formattedDate\", \"$time\")'></a><p class='text-center'>".$formattedDate." @ $time</p>";

should do the trick.

Alternatively, don't use echo for the whole string, simply output most of it direct:

?> //temporarily stop interpreting the file as PHP, so the next bit will be output directly as raw HTML
<a class='fa fa-ban fa-2x cancelClass' onClick='cancelClass("<?php echo $id;?>", "<?php echo $formattedDate; ?>", "<?php echo $time;?>")'></a><p class='text-center'>".$formattedDate." @ $time</p>
<?php //continue with PHP


问:
Accessing Parameters mapped by @RequestMapping for Tracing
I am currently working on a monitoring application using Spring Cloud Sleuth. Currently I try to collect as much information about my requests as possible.

To keep the approach as scalable as possible I use GenericFilterBeans and HandlerInterceptorAdapter to access information from the requests sent to the REST-API.

I am struggling with getting parameters of a REST-call where the parameters are mapped from the URL like in the following code snippet:

```<code>  @RequestMapping(
            value = {"/{service}/{route_id}/book", "/accounting-core-service/{service}/{route_id}/book"},
            method = RequestMethod.GET)
    @ResponseBody
    public ModelAndView book(@PathVariable(value="service") String serviceName,
                             @PathVariable(value = "route_id") int routeId,
                             HttpServletResponse response) {
    /*Do something*/
}
</code>```

The question is not, whether it is good practice or not to write it like so. The question is whether there is an approach similar to Filter or Interceptor (or the proper use of them) to access those parameters.

A requirement is, that it can be applied easily to an application by adding very few lines of code. Annotating every Method call manually or manually inserting the code to write the parameters into the trace from within the method is not feasible for me.

If you need more information feel free to ask. I will provide you with all information you need to help me with my problem.

答:
Although not officially supported (as it's not written in the reference documentation), Spring MVC holds that information as request attributes.

You could create your own HandlerInterceptor, ordered right after the Sleuth one, and get that information from the request like this:

```<code>// "/{service}/{route_id}/book"
String matchingPattern = (String) request
                    .getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
// "service" => "fooService", "route_id" => "42"
Map<String, String> templateVariables = (Map<String, String>) request
                    .getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
</code>```

Note, the template variables are already decoded at that point, which is probably what you want anyway.

Body:
I am currently working on a monitoring application using Spring Cloud Sleuth. Currently I try to collect as much information about my requests as possible.

To keep the approach as scalable as possible I use GenericFilterBeans and HandlerInterceptorAdapter to access information from the requests sent to the REST-API.

I am struggling with getting parameters of a REST-call where the parameters are mapped from the URL like in the following code snippet:

  @RequestMapping(
            value = {"/{service}/{route_id}/book", "/accounting-core-service/{service}/{route_id}/book"},
            method = RequestMethod.GET)
    @ResponseBody
    public ModelAndView book(@PathVariable(value="service") String serviceName,
                             @PathVariable(value = "route_id") int routeId,
                             HttpServletResponse response) {
    /*Do something*/
}

The question is not, whether it is good practice or not to write it like so. The question is whether there is an approach similar to Filter or Interceptor (or the proper use of them) to access those parameters.

A requirement is, that it can be applied easily to an application by adding very few lines of code. Annotating every Method call manually or manually inserting the code to write the parameters into the trace from within the method is not feasible for me.

If you need more information feel free to ask. I will provide you with all information you need to help me with my problem.

Body:
Although not officially supported (as it's not written in the reference documentation), Spring MVC holds that information as request attributes.

You could create your own HandlerInterceptor, ordered right after the Sleuth one, and get that information from the request like this:

// "/{service}/{route_id}/book"
String matchingPattern = (String) request
                    .getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
// "service" => "fooService", "route_id" => "42"
Map<String, String> templateVariables = (Map<String, String>) request
                    .getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);

Note, the template variables are already decoded at that point, which is probably what you want anyway.


问:
POI Format Error XPages
When I try to create an excel then out some value in it I get this error.
Pricee is defined before as double. I checked value is correct. I do not know where to look?

```<code>cell = row.createCell(6);
setCellStyle();
cell.setCellType(Cell.CELL_TYPE_NUMERIC);       cellStyle.setDataFormat(createHelper.createDataFormat().getFormat("#,##0.00"));
cell.setCellValue(pricee);
</code>```

ERROR:

```<code>com.ibm.jscript.InterpretException: Script interpreter error, line=1329, col=35: Ambiguity when calling setDataFormat(int) and setDataFormat(short)
</code>```

答:
SSJS marshalles untyped JS to typed Java. It works reasonably well, but not 100%. Best is to create a Java bean you call from SSJS and hand over the document or collection as parameter. </p>

<p>Makes your life easier, since you can test and debug on local command line. </p>

Title: POI Format Error XPages

Body:
When I try to create an excel then out some value in it I get this error.
Pricee is defined before as double. I checked value is correct. I do not know where to look?

cell = row.createCell(6);
setCellStyle();
cell.setCellType(Cell.CELL_TYPE_NUMERIC);       cellStyle.setDataFormat(createHelper.createDataFormat().getFormat("#,##0.00"));
cell.setCellValue(pricee);

ERROR:

com.ibm.jscript.InterpretException: Script interpreter error, line=1329, col=35: Ambiguity when calling setDataFormat(int) and setDataFormat(short)

Body:
SSJS marshalles untyped JS to typed Java. It works reasonably well, but not 100%. Best is to create a Java bean you call from SSJS and hand over the document or collection as parameter.

Makes your life easier, since you can test and debug on local command line.


问:
Iphone - The executable was signed with invalid entitlements
I am trying to load an application on my iphone and this is the error I am receiving. Does anyone know how to fix this. I have searched the forums and S.O. and I cannot find the answer.

The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile.

答: Well....after a few hours I figured out the problem. I included the Entitlements.plist into my build setting and it worked. Now my question is why did it work once I included this???</p>


问:
How to plot the sorted coefficients for a lm()/glm() regression model in R?
Let's say I were to execute a regression model in R:

```<code>library(data.table)
mtcars = as.data.table(mtcars)
dt = colSums(mtcars)

> dt
     mpg      cyl     disp       hp     drat       wt     qsec       vs
 642.900  198.000 7383.100 4694.000  115.090  102.952  571.160   14.000
      am     gear     carb
  13.000  118.000   90.000

model = lm(formula=mpg~cyl, data=dt)
</code>```

The way I would plot the coefficients of this model would be to use the following function, from Extract regression coefficient values

:

```<code>plot_coeffs <- function(mlr_model) {
  coeffs <- coefficients(mlr_model)
  mp <- barplot(coeffs, col="#3F97D0", xaxt='n', main="Regression Coefficients")
  lablist <- names(coeffs)
  text(mp, par("usr")[3], labels = lablist, srt = 45, adj = c(1.1,1.1), xpd = TRUE, cex=0.6)
}
</code>```

plot_coeffs(model)

However, this plot will not plot the coefficients in a sorted manner, e.g. greatest to least in descending order.

I have tried using order(coeffs) in the above function, but this doesn't seem to work. How does one easily plot the coefficients in decreasing order?

答:
you can order the coefficients and then plot the data:</p>

```<code>model = lm(formula=mpg~cyl, data=mtcars)

coeffs <- coefficients(model)
coeffsord <- coeffs[order(coeffs)]

barplot(coeffsord, col="#3F97D0", xaxt='n', main="Regression Coefficients")
text(1:2, labels = names(coeffsord), srt = 45, adj = c(1.1,1.1), xpd = TRUE, cex=0.6)
</code>```

Body:
Let's say I were to execute a regression model in R:

library(data.table)
mtcars = as.data.table(mtcars)
dt = colSums(mtcars)

> dt
     mpg      cyl     disp       hp     drat       wt     qsec       vs
 642.900  198.000 7383.100 4694.000  115.090  102.952  571.160   14.000
      am     gear     carb
  13.000  118.000   90.000

model = lm(formula=mpg~cyl, data=dt)

The way I would plot the coefficients of this model would be to use the following function, from Extract regression coefficient values

:

plot_coeffs <- function(mlr_model) {
  coeffs <- coefficients(mlr_model)
  mp <- barplot(coeffs, col="#3F97D0", xaxt='n', main="Regression Coefficients")
  lablist <- names(coeffs)
  text(mp, par("usr")[3], labels = lablist, srt = 45, adj = c(1.1,1.1), xpd = TRUE, cex=0.6)
}

plot_coeffs(model)

However, this plot will not plot the coefficients in a sorted manner, e.g. greatest to least in descending order.

I have tried using order(coeffs) in the above function, but this doesn't seem to work. How does one easily plot the coefficients in decreasing order?

Body:
you can order the coefficients and then plot the data:

model = lm(formula=mpg~cyl, data=mtcars)

coeffs <- coefficients(model)
coeffsord <- coeffs[order(coeffs)]

barplot(coeffsord, col="#3F97D0", xaxt='n', main="Regression Coefficients")
text(1:2, labels = names(coeffsord), srt = 45, adj = c(1.1,1.1), xpd = TRUE, cex=0.6)


问:
How to parse XML output into single line
I am trying to setup a PHP code to use a XML API to contact Kunaki to get shipping prices. I try to parse the response via this code but get no output.

<?php
$context  = stream_context_create(array('http' => array('header' => 'Accept: application/xml')));
$url = 'http://kunaki.com/HTTPService.ASP?RequestType=ShippingOptions&State_Province=NY&PostalCode=11204&Country=United+States&ProductId=PX0012345&Quantity=1&ProductId=PX04444444&Quantity=1&ResponseType=xml ';

$xml = file_get_contents($url, false, $context);
$xml = simplexml_load_string($xml);
echo $xml->Description[3]->Description;
//print_r($xml); Debug line to make sure xml is outputing
?>
```

<p>I am not sure what I am doing wrong, any help would be appreciated to figure out how to output this.</p>

<p>This is the output I get in XML</p>

<pre class="lang-php prettyprint-override"><code>SimpleXMLElement Object (
    [ErrorCode] => 0
    [ErrorText] => success
    [Option] => Array (
        [0] => SimpleXMLElement Object (
            [Description] => USPS First Class Mail
            [DeliveryTime] => 2-5 business days
            [Price] => 0.66
        )
        [1] => SimpleXMLElement Object (
            [Description] => UPS Ground
            [DeliveryTime] => 1-5 business days
            [Price] => 17.17
        )
        [2] => SimpleXMLElement Object (
            [Description] => UPS 2nd Day Air
            [DeliveryTime] => 2 business days
            [Price] => 30.42
        )
        [3] => SimpleXMLElement Object (
            [Description] => UPS Next Day Air Saver
            [DeliveryTime] => 1 business day
            [Price] => 50.17
        )
    )
)
</code>```

答:
I Finally Figured this out, after sleeping on it. What I was doing wrong was I had 2 $xml in the code.   When I changed it to $xml2  it fixed the problem. Here is the final code to help anyone if needed.</p>

```<code><?php
$context  = stream_context_create(array('http' => array('header' => 'Accept: application/xml')));
$url = 'http://kunaki.com/HTTPService.ASP?RequestType=ShippingOptions&State_Province=NY&PostalCode=11204&Country=United+States&ProductId=PX0012345&Quantity=1&ProductId=PX04444444&Quantity=1&ResponseType=xml ';
file_put_contents('output.xml', ob_get_contents());
$xml = file_get_contents($url, false, $context);
$xml2 = simplexml_load_string($xml);
foreach ($xml2->Option as $opt) {
    print "<br>";
    echo $value = (string)$opt->DeliveryTime." will cost - ".(string)$opt->Price;

}
?>
</code>```

Body:
I am trying to setup a PHP code to use a XML API to contact Kunaki to get shipping prices. I try to parse the response via this code but get no output.

<?php
$context  = stream_context_create(array('http' => array('header' => 'Accept: application/xml')));
$url = 'http://kunaki.com/HTTPService.ASP?RequestType=ShippingOptions&State_Province=NY&PostalCode=11204&Country=United+States&ProductId=PX0012345&Quantity=1&ProductId=PX04444444&Quantity=1&ResponseType=xml ';

$xml = file_get_contents($url, false, $context);
$xml = simplexml_load_string($xml);
echo $xml->Description[3]->Description;
//print_r($xml); Debug line to make sure xml is outputing
?>

I am not sure what I am doing wrong, any help would be appreciated to figure out how to output this.

This is the output I get in XML

SimpleXMLElement Object (
    [ErrorCode] => 0
    [ErrorText] => success
    [Option] => Array (
        [0] => SimpleXMLElement Object (
            [Description] => USPS First Class Mail
            [DeliveryTime] => 2-5 business days
            [Price] => 0.66
        )
        [1] => SimpleXMLElement Object (
            [Description] => UPS Ground
            [DeliveryTime] => 1-5 business days
            [Price] => 17.17
        )
        [2] => SimpleXMLElement Object (
            [Description] => UPS 2nd Day Air
            [DeliveryTime] => 2 business days
            [Price] => 30.42
        )
        [3] => SimpleXMLElement Object (
            [Description] => UPS Next Day Air Saver
            [DeliveryTime] => 1 business day
            [Price] => 50.17
        )
    )
)

Body:
I Finally Figured this out, after sleeping on it. What I was doing wrong was I had 2 $xml in the code.   When I changed it to $xml2  it fixed the problem. Here is the final code to help anyone if needed.

<?php
$context  = stream_context_create(array('http' => array('header' => 'Accept: application/xml')));
$url = 'http://kunaki.com/HTTPService.ASP?RequestType=ShippingOptions&State_Province=NY&PostalCode=11204&Country=United+States&ProductId=PX0012345&Quantity=1&ProductId=PX04444444&Quantity=1&ResponseType=xml ';
file_put_contents('output.xml', ob_get_contents());
$xml = file_get_contents($url, false, $context);
$xml2 = simplexml_load_string($xml);
foreach ($xml2->Option as $opt) {
    print "<br>";
    echo $value = (string)$opt->DeliveryTime." will cost - ".(string)$opt->Price;

}
?>


问:
Drools multiple flows sequential execution
Scenario:

I want to execute multiple Drools flow one after another.

That is, I've one input, I'll pass it to on my first DRL/XLS file. Output of this first flow will act as input to second DRL.

My question is, does DROOLS have the facility to execute one flow after another in sequence. If so, how?

Till now, I'm guessing to do it via Java code only, which I want to avoid.

Thank You

答:
Using Rule Flow, you have lots of flexibility of execution of sequence, and if you want re execute/reuse the same rules from the current execution thread that also can be possible using rule flow.

There  is a rule flow group property which is use to activate the rule(s) at a particulate time of execution. Passing output of first flow to another flow can be achieved by declaring your input parameter and set them.

You may use BPMN editor plugin in eclipse to achieve this functionality.


问:
Search string in QTextEdit on typing
I have a QTextEdit on the screen, with text in it. I want to be able to type a search string, and have the cursor move to the next occurrence of that string in the QTextEdit - but without my typing actually going into the text edit. If the QTextEdit has focus, the stuff I type goes into it, and if it doesn't have focus then there is no cursor. Can anyone help please?

答:
You have two possibilities:

Reimplement QTextEdit::keyPressEvent to capture the entered text without displaying it. As an alternative, you can use an event filter, which has the advantage that you do not have to subclass QTextEdit.

or

Create a (small) search box widget (eg. QLineEdit on top of your QTextEdit), which you give focus instead of your main QTextEdit. In this way, the current search string is fed back to the user.

Note that I prefer the second option, because of the visual feedback.

Title: Search string in QTextEdit on typing


问:
What is crontab directory path?
Guys i am testing if cron runs correctly in my docker debian container.

I've set up crontab

```<code>* * * * * /bin/echo "it works!" >> test.log
</code>```

But i can't find this file anywhere.

I tried

```<code>* * * * * /bin/echo "it works!" >> /var/log/test.log
</code>```

not luck too.

What is ">>" function's writes to path?

答:
'>>' redirects output to a file appending the redirected output at the end.

So it should be in /var/log/test.log

Your error should be in the cron settings.

This link really helped me the beginnnig

Title: What is crontab directory path?

Body:
Guys i am testing if cron runs correctly in my docker debian container.

I've set up crontab

* * * * * /bin/echo "it works!" >> test.log

But i can't find this file anywhere.

I tried

* * * * * /bin/echo "it works!" >> /var/log/test.log

not luck too.

What is ">>" function's writes to path?


问:
How should I use OpenID to authenticate to WCF Data Services from a Windows Phone 7 app?
I have a Windows Phone application which is reading and writing data from a WCF Data Services service which is hosted in and ASP.NET MVC 3 application.

I can configure both client and server as necessary. I'd like to use OpenID if practical, and once a user is authenticated on the phone they should be able to browse through data which is associated with their OpenID.

How should I configure client and server to make that work?

答:
OpenID is an awkward choice. It sounds like the user already has data associated with their account, which means that the user would have to login to the server at some point in time to set up this data, and then login to the app with the same credentials to access this data. The issue is that of securely verifying that the client app has indeed authenticated the user in question. Assuming that the client app (somehow) has the user's OpenID is not enough because the server can't implicitly trust what the client app tells it.

Off the top of my head, I'd say, what could be done with OpenID is as follows.

First, set up OpenID authentication on the server. Then, when the client app needs to authenticate, it should use the WebBrowser control to point to a server URL that, in turn, lets the user authenticate with their OpenID provider, and points the browser back to the server with the authentication info. At this point, the client app is unaware of the user's authentication status, but the server knows who they are. Now, the server can generate a single-use auth key for the client to use. It can redirect to a special URL with that key in it, at which point the client detects said URL, extracts the key, hides the WebBrowser control, and uses that key to talk to the server. I believe that would be a secure way to do such authentication, but like I said, this is just off the top of my head.