问:
PHP- How to validate checkbox and textbox in php?
Screenshot I'm trying to validate a checkbox and multiple textboxes. The textboxes should be disabled at first, and should be enabled only when the checkbox is ticked. Also an alert should pop up if a textbox on the same row of the ticked checkbox is left empty.          </p>

```<code>             <table class="table table-bordered">
    <tr align="center" style="background-color:black; color:white;">
               <tr> <td colspan="8" style="background-color:silver;"><input type="submit" class="btn btn-primary" id="addSPtoCart" name="addSPtoCart" value="Add To Cart" class="button-L" /></td></tr>
                <tr align="center" style="background-color:black; color:white;">
               <td class="border"><span class="table-head"><label>Favorite</label></span></td>
              <td><span class="table-head"><label>Material Code</label></span></td>
              <td><span class="table-head"><label>Material Desc</label></span></td>
              <td><span class="table-head"><label>Chart</label></span></td>
              <td><span class="table-head"><label>Shade</label></span></td>
              <td><span class="table-head"><label><?php echo $month1 ?></label></span></td>
              <td><span class="table-head"><label><?php echo $month2 ?></label></span></td>
              <td><span class="table-head"><label><?php echo $month3 ?></label></span></td>
              <!--<td class="no-border" align="center"><span class="table-head">Action</span></td>-->
             </tr>

    <tr class="abc" align="center">
                  <style>.abc:nth-child(even){background-color: silver;}</style>
                <td><input type="checkbox" name="fav[]" id="fav[]" value="<?php echo $d['materialID']; ?>" /></td>
              <td><label><?php echo $d['materialCode']; ?></label></td>
              <td><label><?php echo $d['materialDesc']; ?></label></td>
              <td><label><?php echo $d['chart']; ?></label></td>
              <td><label><?php echo $d['shade']; ?></label></td>
              <td><input type="text"   class="form-control" style="width:80px; " size ="5" name="qty_1<?php echo $d['materialID'] ?>" id="qty_1<?php echo $d['materialID'] ?>" value =<?php echo $var1 ?> ></td>
              <td><input type="text"   class="form-control" style="width:80px;" size ="5" name="qty_2<?php echo $d['materialID'] ?>" id="qty_2<?php echo $d['materialID'] ?>" value =<?php echo $var2 ?> ></td>
              <td><input type="text"  class="form-control" style="width:80px;" size ="5" name="qty_3<?php echo $d['materialID'] ?>" id="qty_3<?php echo $d['materialID'] ?>" value =<?php echo $var3 ?> ></td>

            <!--  <td class="no-border" align="center"><a href="<?php //echo SITEURL; ?>/salesplan/salesplan-details/?id=<?php //echo $d['mmID']; ?>&mCatID=<?php// echo $_REQUEST["mCatID"];?>  ">View</a></td> -->

            </tr>

               <tr><td colspan="8"><input type="submit" class="btn btn-primary" id="addSPtoCart" name="addSPtoCart" value="Add To Cart" class="button-L" /></td></tr>

</table>

 <script type="text/javascript">
function validateForm() {
    var x = document.forms["frmFav"]["qty_1"].value;
        var y = document.forms["frmFav"]["qty_2"].value;
            var z = document.forms["frmFav"]["qty_3"].value;
            //var a = document.forms["frmFav"]["fav"].value;

    if ((x == "") || (!this.frmFav.fav.checked)) {
        alert("This field cannot be left empty !");
        return false;
    }
}
</script>
</code>```

答:
You should make onclick action for the button to call validateForm() function

```<code><input type="submit" class="btn btn-primary" id="addSPtoCart" name="addSPtoCart" value="Add To Cart" class="button-L" onclick="return validateForm()"/>
</code>```

For enable and disable the textbox, put a disabled attribute first

```<code><td><input type="text"   class="form-control" style="width:80px; " size ="5" name="qty_1<?php echo $d['materialID'] ?>" id="qty_1<?php echo $d['materialID'] ?>" value =<?php echo $var1 ?> disabled></td>
</code>```

And function to trigger enable and disable the box

```<code> function checkboxchange(x){
 var formcontrol = x.parentNode.parentNode.getElementsByClassName("form-control");
 for (var i = 0; i < formcontrol.length; i++){
     if(formcontrol[i].disabled)
        formcontrol[i].disabled = false;
    else
        formcontrol[i].disabled = true;
 }
}
</code>```

And add function call in the checkbox

```<code><td><input type="checkbox" name="fav[]" id="fav[]" value="<?php echo $d['materialID']; ?>" onchange="checkboxchange(this)"/></td>
</code>```

Hope that help

Update to the validateForm() function

```<code>function validateForm() {
var validate = document.querySelectorAll(".form-control:not(:disabled)");
for (var i = 0; i < validate.length; i++){
    if (validate[i].value=="") {
        alert("This field cannot be left empty !");
        return false;
    }
}
}
</code>```

Body:
Screenshot I'm trying to validate a checkbox and multiple textboxes. The textboxes should be disabled at first, and should be enabled only when the checkbox is ticked. Also an alert should pop up if a textbox on the same row of the ticked checkbox is left empty.

 <input type="submit" class="btn btn-primary" id="addSPtoCart" name="addSPtoCart" value="Add To Cart" class="button-L" />

               Favorite
              Material Code
              Material Desc
              Chart
              Shade
              <?php echo $month1 ?>
              <?php echo $month2 ?>
              <?php echo $month3 ?>

                <input type="checkbox" name="fav[]" id="fav[]" value="<?php echo $d['materialID']; ?>" />
              <?php echo $d['materialCode']; ?>
              <?php echo $d['materialDesc']; ?>
              <?php echo $d['chart']; ?>
              <?php echo $d['shade']; ?>
              <input type="text"   class="form-control" style="width:80px; " size ="5" name="qty_1<?php echo $d['materialID'] ?>" id="qty_1<?php echo $d['materialID'] ?>" value =<?php echo $var1 ?> >
              <input type="text"   class="form-control" style="width:80px;" size ="5" name="qty_2<?php echo $d['materialID'] ?>" id="qty_2<?php echo $d['materialID'] ?>" value =<?php echo $var2 ?> >
              <input type="text"  class="form-control" style="width:80px;" size ="5" name="qty_3<?php echo $d['materialID'] ?>" id="qty_3<?php echo $d['materialID'] ?>" value =<?php echo $var3 ?> >

<input type="submit" class="btn btn-primary" id="addSPtoCart" name="addSPtoCart" value="Add To Cart" class="button-L" />

Body:
You should make onclick action for the button to call validateForm() function

<input type="submit" class="btn btn-primary" id="addSPtoCart" name="addSPtoCart" value="Add To Cart" class="button-L" onclick="return validateForm()"/>

For enable and disable the textbox, put a disabled attribute first

<td><input type="text"   class="form-control" style="width:80px; " size ="5" name="qty_1<?php echo $d['materialID'] ?>" id="qty_1<?php echo $d['materialID'] ?>" value =<?php echo $var1 ?> disabled></td>

And function to trigger enable and disable the box

 function checkboxchange(x){
 var formcontrol = x.parentNode.parentNode.getElementsByClassName("form-control");
 for (var i = 0; i < formcontrol.length; i++){
     if(formcontrol[i].disabled)
        formcontrol[i].disabled = false;
    else
        formcontrol[i].disabled = true;
 }
}

And add function call in the checkbox

<td><input type="checkbox" name="fav[]" id="fav[]" value="<?php echo $d['materialID']; ?>" onchange="checkboxchange(this)"/></td>

Hope that help

Update to the validateForm() function

function validateForm() {
var validate = document.querySelectorAll(".form-control:not(:disabled)");
for (var i = 0; i < validate.length; i++){
    if (validate[i].value=="") {
        alert("This field cannot be left empty !");
        return false;
    }
}
}


来源: stackexchange

问:
Date not showing in div
I have View with div where I need to show date

I write this JavaScript code

$(document).ready(function() {
  var dateObj = new Date();
  var month = dateObj.getUTCMonth() + 1; //months from 1-12
  var day = dateObj.getUTCDate();
  var year = dateObj.getUTCFullYear();

  newdate = year + "/" + month + "/" + day;
  $("#id").append(newdate);
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="date" style="width: 100%; height: 10%; background:#1d69b4 ">

</div></code>```

答:
You are using wrong selector
Change

```<code>$("#id").append(newdate);
</code>```

to

```<code> $("#date").append(newdate);
</code>```

ContentLicense: CC BY-SA 3.0

Title: Date not showing in div

Body:
You are using wrong selector
Change

$("#id").append(newdate);

to

 $("#date").append(newdate);


问:
split string and store it in another variable in c#
How to Read character after '\':

```<code>string PrName = "software\Plan Mobile";
</code>```

答:
Try this:

```<code>char charToFind = '\';
string PrName = "software\Plan Mobile";

int indexOfChar = PrName.IndexOf(charToFind);

if (indexOfChar >= 0)
{
    string result = PrName.Substring(indexOfChar + 1);
}
</code>```

Output: result = "Plan Mobile"

Body:
How to Read character after '\':

string PrName = "software\Plan Mobile";

Body:
Try this:

char charToFind = '\';
string PrName = "software\Plan Mobile";

int indexOfChar = PrName.IndexOf(charToFind);

if (indexOfChar >= 0)
{
    string result = PrName.Substring(indexOfChar + 1);
}

Output: result = "Plan Mobile"


问:
Get Substring before and after "." full stop, if Not found then get NULL
I wanted to get the substring after and before the ".", For Example

Furniture.Chair  I need furniture in "Category1" column and Chair in "Category2" column but also if the string comes like this :

Furniture. then i need "Null" in "Category2" column. but i unable to do this.
please see the below screen for calarification :

Thanks

答:
```<code>with data (val) as
(
  select 'furniture' from dual union all -- without the dot
  select 'furniture.' from dual union all -- dot at the end
  select '.furniture' from dual union all -- dot at the beginning
  select null from dual union all -- no input
  select 'home owners.home.home' from dual union all -- if more than one dot is found
  select 'health and beauty.skin care' from dual -- words followed by dot followed by words
)
, coll as
(
select
  val,
  -- [^\.]+  any character sequence other than dot (+ is for one or more)
  -- (\.|) find a dot or nothing - eg. 'furniture' with a dot
  -- (([^\.]+)) the outer brackets capture the first group \1;
  --            the first inner brackets capture the second group
  --            the last argument to the regexp_substr below ie. '2' tells
  --            method our interest is in the second group within the match
  --            identified by (([^\.]+)(\.|))
  regexp_substr(val, '(([^\.]+)(\.|))', 1, 1, null, '2') as first,
  regexp_substr(val, '(\.(.*))', 1, 1, null, '2') as the_rest
from data
)
select
  val,
  case when first is null then 'Unknown Category' else first end as first,
  case when first is null then 'Unknown Category' else first end as the_rest
from coll
;
</code>```


答:
I think, you want to split string

```<code>   string s = "software\Plan Mobile";

   // Split string on '\'.
   string[] words = s.Split('\');

   foreach (string word in words)
   {
      Console.WriteLine(word);
   }
</code>```

Output:

```<code>software
Plan mobile
</code>```

Title: split string and store it in another variable in c#

Body:
I think, you want to split string

   string s = "software\Plan Mobile";

   // Split string on '\'.
   string[] words = s.Split('\');

   foreach (string word in words)
   {
      Console.WriteLine(word);
   }

Output:

software
Plan mobile


问:
What's the difference between LAYER_TYPE_NONE and LAYER_TYPE_HARDWARE when animating view with hardware acceleration enabled
According to Android develop guide, display lists will be created for hardware acceleartion view with LAYER_TYPE_NONE, while hardware layer will be created for hardware acceleartion view with LAYER_TYPE_HARDWARE. There is no need for redrawing view when applying rotation animaiton in either approach. So, what's the actual difference bewteen  LAYER_TYPE_NONE and LAYER_TYPE_HARDWARE when animating view with hardware acceleration enabled？</p>

答:
First the view will be redrawn if you are applying rotation animation.

Hardware layers(LAYER_TYPE_HARDWARE) are cached on the GPU, which makes certain operations during animation much faster. Simple transformations (translation, rotation, scaling and alpha) can be rendered quickly with layers.

LAYER_TYPE_HARDWARE uses layers that take up GPU memory and obviously you don't want any memory leaks. Therefore, you should only use hardware layers when necessary, like during animations.

With LAYER_TYPE_NONE, you explicitly want to avoid hardware layer rendering  with hardware acceleration enabled.

For reference, read http://blog.danlew.net/2015/10/20/using-hardware-layers-to-improve-animation-performance/


问:
Getting null values when trying to parse an XML using XPATH in VBScript
I am new to xPath, i am trying to parse a XML given below using XPath in VbScript and I am always getting null value.

```<code><?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-
utility-1.0.xsd">
   <s:Header>
      <o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-
200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1">
         <u:Timestamp u:Id="_0">
            <u:Created>2017-03-30T07:08:12.264Z</u:Created>
            <u:Expires>2017-03-30T07:13:12.264Z</u:Expires>
         </u:Timestamp>
      </o:Security>
   </s:Header>
   <s:Body>
      <RegisterAndInviteParticipantResponse
xmlns="http://www.cubonline.com/CubOnline/WebServices/201207">
         <RegisterAndInviteParticipantResult xmlns:a="http://schemas.datacontract.org/2004/07/Cub.CubOnline.WebServices.DataContracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <a:UserID>322988</a:UserID>
        <a:AccessCode>7EBECBBD</a:AccessCode>
        <a:LogonUrl>https://uat.sonline.com/Online/Standalone/PLogon.aspx?skin=1379+751&lang=en-GB</a:LogonUrl>
        <a:AuthenticatedURL i:nil="true" />
        <a:ReportLinksURL>https://uat.sonline.com/Online/Standalone/XViewReportLinks.aspx?key=091d1e-6cd0-45fd-8c81-61ab70107f34&hash=7DDEDAF4CCDD47E5880F086C62E660F8F45B2C9E&skin=234</a:ReportLinksURL>
        <a:ParticipantScheduleID>791777</a:ParticipantScheduleID>
     </RegisterAndInviteParticipantResult>
  </RegisterAndInviteParticipantResponse>
   </s:Body>
</s:Envelope>
</code>```

Below is my VBScript code:

```<code>Set xmlDoc = Server.CreateObject("Msxml2.DOMDocument.6.0")
xmlDoc.async = False
xmlDoc.resolveExternals = False
xmlDoc.validateOnParse = False

If Not xmlDoc.loadXML(registerParticipantResponse) Then
'//..........do something.
End If

'//=====================================================
'//Try Xpath'ing a few values
'//=====================================================
xmlDoc.setProperty "SelectionLanguage", "XPath"
xmlDoc.setProperty "SelectionNamespaces",
"xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'
xmlns=http://www.cubonline.com/CubOnline/WebServices/201207' xmlns:a='http://schemas.datacontract.org/2004/07/Cub.CubOnline.WebServices.DataContracts' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'"
Dim currNode

Set currNode = xmlDoc.selectSingleNode("//*[local-
name()='RegisterAndInviteParticipantResponse']/@*[local-
name()='RegisterAndInviteParticipantResult']/@*[local-name()='AccessCode']")
accessCode = ""
If Not currNode Is Nothing Then
accessCode = currNode.text
End If
</code>```

Note:I am getting 'accesscode' is null.
So please help me how can access the value of in accesscode through Xpath.

答:
The @ characters should be taken out of the XPath, because these are not attributes but elements:

```<code>"//*[local-name()='RegisterAndInviteParticipantResponse']/
   *[local-name()='RegisterAndInviteParticipantResult']/
   *[local-name()='AccessCode']"
</code>```

However, since you set namespaces for use with XPath in your code, this should be more concise and straightforward:

```<code>"//RegisterAndInviteParticipantResponse/
   RegisterAndInviteParticipantResult/
   a:AccessCode"
</code>```

Here is an example of when @ can be used with the original document (assuming the o prefix would be bound as well explicitly in the code):

```<code>"/s:Envelope/s:Header/o:Security/@s:mustUnderstand"
</code>```

In general, when XPath does not find an element or attribute with the specified name, it will not return an error, but return an empty sequence instead.

Body:
I am new to xPath, i am trying to parse a XML given below using XPath in VbScript and I am always getting null value.

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-
utility-1.0.xsd">
   <s:Header>
      <o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-
200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1">

            2017-03-30T07:08:12.264Z
            2017-03-30T07:13:12.264Z

      </o:Security>
   </s:Header>
   <s:Body>
      <RegisterAndInviteParticipantResponse
xmlns="http://www.cubonline.com/CubOnline/WebServices/201207">
         <RegisterAndInviteParticipantResult xmlns:a="http://schemas.datacontract.org/2004/07/Cub.CubOnline.WebServices.DataContracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        322988
        7EBECBBD
        https://uat.sonline.com/Online/Standalone/PLogon.aspx?skin=1379+751&lang=en-GB

        https://uat.sonline.com/Online/Standalone/XViewReportLinks.aspx?key=091d1e-6cd0-45fd-8c81-61ab70107f34&hash=7DDEDAF4CCDD47E5880F086C62E660F8F45B2C9E&skin=234
        791777
     </RegisterAndInviteParticipantResult>
  </RegisterAndInviteParticipantResponse>
   </s:Body>
</s:Envelope>

Below is my VBScript code:

Set xmlDoc = Server.CreateObject("Msxml2.DOMDocument.6.0")
xmlDoc.async = False
xmlDoc.resolveExternals = False
xmlDoc.validateOnParse = False

If Not xmlDoc.loadXML(registerParticipantResponse) Then
'//..........do something.
End If

'//=====================================================
'//Try Xpath'ing a few values
'//=====================================================
xmlDoc.setProperty "SelectionLanguage", "XPath"
xmlDoc.setProperty "SelectionNamespaces",
"xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'
xmlns=http://www.cubonline.com/CubOnline/WebServices/201207' xmlns:a='http://schemas.datacontract.org/2004/07/Cub.CubOnline.WebServices.DataContracts' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'"
Dim currNode

Set currNode = xmlDoc.selectSingleNode("//*[local-
name()='RegisterAndInviteParticipantResponse']/@*[local-
name()='RegisterAndInviteParticipantResult']/@*[local-name()='AccessCode']")
accessCode = ""
If Not currNode Is Nothing Then
accessCode = currNode.text
End If

Note:I am getting 'accesscode' is null.
So please help me how can access the value of in accesscode through Xpath.

Body:
The @ characters should be taken out of the XPath, because these are not attributes but elements:

"//*[local-name()='RegisterAndInviteParticipantResponse']/
   *[local-name()='RegisterAndInviteParticipantResult']/
   *[local-name()='AccessCode']"

However, since you set namespaces for use with XPath in your code, this should be more concise and straightforward:

"//RegisterAndInviteParticipantResponse/
   RegisterAndInviteParticipantResult/
   a:AccessCode"

Here is an example of when @ can be used with the original document (assuming the o prefix would be bound as well explicitly in the code):

"/s:Envelope/s:Header/o:Security/@s:mustUnderstand"

In general, when XPath does not find an element or attribute with the specified name, it will not return an error, but return an empty sequence instead.


问:
Publishing JAX-RS endpoints with pax-web
I have REST endpoints published in OSGi container (Karaf) using javax.ws.rs annotations. HttpService is created by pax-web, and jax-rs services are published by com.eclipsesource.jaxrs/publisher.

In order to use this publisher, a quite monstrous feature was forged (copied somewhere from internet):

```<code><feature name="jersey-karaf-feature" description="Jersey karaf feature" version="2.2.0">
    <feature prerequisite="false" dependency="true">http</feature>
    <bundle start-level="36">mvn:org.glassfish.jersey.containers/jersey-container-servlet/2.22.2</bundle>
    <bundle start-level="36">mvn:org.glassfish.jersey.media/jersey-media-sse/2.22.2</bundle>
    <bundle start-level="36">mvn:org.glassfish.jersey.media/jersey-media-multipart/2.22.2</bundle>
    <bundle start-level="36" dependency="true">mvn:org.glassfish.jersey.containers/jersey-container-servlet-core/2.22.2</bundle>
    <bundle start-level="36" dependency="true">mvn:org.glassfish.jersey.core/jersey-common/2.22.2</bundle>
    <bundle start-level="36" dependency="true">mvn:org.glassfish.jersey.bundles.repackaged/jersey-guava/2.22.2</bundle>
    <bundle start-level="36" dependency="true">mvn:org.glassfish.jersey.core/jersey-server/2.22.2</bundle>
    <bundle start-level="36" dependency="true">mvn:org.glassfish.jersey.core/jersey-client/2.22.2</bundle>
    <bundle start-level="36" dependency="true">mvn:org.glassfish.jersey.media/jersey-media-jaxb/2.22.2</bundle>
    <bundle start-level="33" dependency="true">mvn:org.glassfish.hk2/hk2-api/2.4.0-b34</bundle>
    <bundle start-level="33" dependency="true">mvn:org.glassfish.hk2/hk2-locator/2.4.0-b34</bundle>
    <bundle start-level="33" dependency="true">mvn:org.glassfish.hk2/hk2-utils/2.4.0-b34</bundle>
    <bundle start-level="33" dependency="true">mvn:org.glassfish.hk2/osgi-resource-locator/1.0.1</bundle>
    <bundle start-level="33" dependency="true">mvn:org.glassfish.hk2.external/javax.inject/2.4.0-b34</bundle>
    <bundle start-level="33" dependency="true">mvn:org.glassfish.hk2.external/aopalliance-repackaged/2.4.0-b34</bundle>
    <bundle dependency="true">mvn:javax.annotation/javax.annotation-api/1.2</bundle>
    <bundle dependency="true">mvn:javax.validation/validation-api/1.1.0.Final</bundle>
    <bundle dependency="true">mvn:javax.ws.rs/javax.ws.rs-api/2.0.1</bundle>
    <bundle dependency="true">mvn:org.javassist/javassist/3.18.1-GA</bundle>
    <bundle dependency="true">mvn:org.jvnet.mimepull/mimepull/1.9.6</bundle>
    <bundle start-level="80">mvn:com.eclipsesource.jaxrs/publisher/5.3.1</bundle>
    <bundle start-level="80">mvn:javax.ws.rs/jsr311-api/1.1.1</bundle>
    <bundle start-level="80">mvn:org.eclipse.persistence/org.eclipse.persistence.moxy/2.6.4</bundle>
    <bundle start-level="80">mvn:org.eclipse.persistence/org.eclipse.persistence.core/2.6.4</bundle>
    <bundle start-level="80">mvn:javax.validation/validation-api/1.1.0.Final</bundle>
    <bundle start-level="80">mvn:org.glassfish/javax.json/1.0.4</bundle>
    <bundle start-level="80">mvn:org.eclipse.persistence/org.eclipse.persistence.jpa/2.6.4</bundle>
    <bundle start-level="80">mvn:org.eclipse.persistence/javax.persistence/2.1.1</bundle>
    <bundle start-level="80">mvn:org.eclipse.persistence/org.eclipse.persistence.asm/2.6.4</bundle>
    <bundle start-level="80">mvn:org.eclipse.persistence/org.eclipse.persistence.jpa.jpql/2.6.4</bundle>
    <bundle start-level="80">mvn:org.eclipse.persistence/org.eclipse.persistence.antlr/2.6.4</bundle>
</feature>
</code>```

It generally works, but when I've tried to register event listener as described in wiki, the listener was never called. Another issue is the amount of libraries in the feature with 'magic numbers' as start levels, and potential problems by platform upgrade.

Do pax-web have a mechanism for publishing jax-rs endpoints, which I could use instead that forged feature? What do I need to activate, so that my endpoints would be published?

答: CXF is an option for publishing REST endpoints. An example can be found at https://github.com/apache/cxf-dosgi/tree/master/samples/rest .</p>

Body:
I have REST endpoints published in OSGi container (Karaf) using javax.ws.rs annotations. HttpService is created by pax-web, and jax-rs services are published by com.eclipsesource.jaxrs/publisher.

In order to use this publisher, a quite monstrous feature was forged (copied somewhere from internet):

<feature name="jersey-karaf-feature" description="Jersey karaf feature" version="2.2.0">
    <feature prerequisite="false" dependency="true">http</feature>
    <bundle start-level="36">mvn:org.glassfish.jersey.containers/jersey-container-servlet/2.22.2</bundle>
    <bundle start-level="36">mvn:org.glassfish.jersey.media/jersey-media-sse/2.22.2</bundle>
    <bundle start-level="36">mvn:org.glassfish.jersey.media/jersey-media-multipart/2.22.2</bundle>
    <bundle start-level="36" dependency="true">mvn:org.glassfish.jersey.containers/jersey-container-servlet-core/2.22.2</bundle>
    <bundle start-level="36" dependency="true">mvn:org.glassfish.jersey.core/jersey-common/2.22.2</bundle>
    <bundle start-level="36" dependency="true">mvn:org.glassfish.jersey.bundles.repackaged/jersey-guava/2.22.2</bundle>
    <bundle start-level="36" dependency="true">mvn:org.glassfish.jersey.core/jersey-server/2.22.2</bundle>
    <bundle start-level="36" dependency="true">mvn:org.glassfish.jersey.core/jersey-client/2.22.2</bundle>
    <bundle start-level="36" dependency="true">mvn:org.glassfish.jersey.media/jersey-media-jaxb/2.22.2</bundle>
    <bundle start-level="33" dependency="true">mvn:org.glassfish.hk2/hk2-api/2.4.0-b34</bundle>
    <bundle start-level="33" dependency="true">mvn:org.glassfish.hk2/hk2-locator/2.4.0-b34</bundle>
    <bundle start-level="33" dependency="true">mvn:org.glassfish.hk2/hk2-utils/2.4.0-b34</bundle>
    <bundle start-level="33" dependency="true">mvn:org.glassfish.hk2/osgi-resource-locator/1.0.1</bundle>
    <bundle start-level="33" dependency="true">mvn:org.glassfish.hk2.external/javax.inject/2.4.0-b34</bundle>
    <bundle start-level="33" dependency="true">mvn:org.glassfish.hk2.external/aopalliance-repackaged/2.4.0-b34</bundle>
    <bundle dependency="true">mvn:javax.annotation/javax.annotation-api/1.2</bundle>
    <bundle dependency="true">mvn:javax.validation/validation-api/1.1.0.Final</bundle>
    <bundle dependency="true">mvn:javax.ws.rs/javax.ws.rs-api/2.0.1</bundle>
    <bundle dependency="true">mvn:org.javassist/javassist/3.18.1-GA</bundle>
    <bundle dependency="true">mvn:org.jvnet.mimepull/mimepull/1.9.6</bundle>
    <bundle start-level="80">mvn:com.eclipsesource.jaxrs/publisher/5.3.1</bundle>
    <bundle start-level="80">mvn:javax.ws.rs/jsr311-api/1.1.1</bundle>
    <bundle start-level="80">mvn:org.eclipse.persistence/org.eclipse.persistence.moxy/2.6.4</bundle>
    <bundle start-level="80">mvn:org.eclipse.persistence/org.eclipse.persistence.core/2.6.4</bundle>
    <bundle start-level="80">mvn:javax.validation/validation-api/1.1.0.Final</bundle>
    <bundle start-level="80">mvn:org.glassfish/javax.json/1.0.4</bundle>
    <bundle start-level="80">mvn:org.eclipse.persistence/org.eclipse.persistence.jpa/2.6.4</bundle>
    <bundle start-level="80">mvn:org.eclipse.persistence/javax.persistence/2.1.1</bundle>
    <bundle start-level="80">mvn:org.eclipse.persistence/org.eclipse.persistence.asm/2.6.4</bundle>
    <bundle start-level="80">mvn:org.eclipse.persistence/org.eclipse.persistence.jpa.jpql/2.6.4</bundle>
    <bundle start-level="80">mvn:org.eclipse.persistence/org.eclipse.persistence.antlr/2.6.4</bundle>
</feature>

It generally works, but when I've tried to register event listener as described in wiki, the listener was never called. Another issue is the amount of libraries in the feature with 'magic numbers' as start levels, and potential problems by platform upgrade.

Do pax-web have a mechanism for publishing jax-rs endpoints, which I could use instead that forged feature? What do I need to activate, so that my endpoints would be published?


问:
PHP POST not saving my data in mysql , checking my api using postman
I am playing around with php, i wish to make a simple api to save my name field in database using chrome postman

The is my php code:

```<code><?php

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type,x-prototype-version,x-requested-with');
header('Cache-Control: max-age=900');
header("Content-Type: application/json"); // tell client that we are sending json data

$servername = "localhost";
$username = "";
$password = "";
$dbname = "";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$dxname  =$_GET['name'];

$sql = "INSERT INTO crudtable(firstname, lastname, email,favjob)
VALUES ('".$dxname."', 'Doe', 'john@example.com','coder')";

if ($conn->query($sql) === TRUE) {
    echo json_encode("New record created successfully");
   // echo "New record created successfully";
} else {
    echo json_encode("Some error");
   // echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>
</code>```

When i am using postman ,
1. the name is not getting saved in db [only hard coded values are being saved]
2. I am not getting echo json_encode("New record created successfully"); once data is saved.

Please help, attaching screenshot of my postman result and how i am passing the name variable

Click here to see the image

答:
You are sending data through post method and you are using GET.

Change:

```<code>$dxname  =$_GET['name'];
</code>```

To

```<code>$dxname  =$_POST['name'];
</code>```

ALso:

```<code>if ($conn->query($sql) === TRUE) {
</code>```

To

```<code>if ($result = $conn->query($sql))
{ echo json_encode("New record created successfully");
   // echo "New record created successfully";
} else {
    echo json_encode("Some error");
   // echo "Error: " . $sql . "<br>" . $conn->error;
}
</code>```

Cannot query MySQL database via PHP

Body:
I am playing around with php, i wish to make a simple api to save my name field in database using chrome postman

The is my php code:

<?php

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type,x-prototype-version,x-requested-with');
header('Cache-Control: max-age=900');
header("Content-Type: application/json"); // tell client that we are sending json data

$servername = "localhost";
$username = "";
$password = "";
$dbname = "";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$dxname  =$_GET['name'];

$sql = "INSERT INTO crudtable(firstname, lastname, email,favjob)
VALUES ('".$dxname."', 'Doe', 'john@example.com','coder')";

if ($conn->query($sql) === TRUE) {
    echo json_encode("New record created successfully");
   // echo "New record created successfully";
} else {
    echo json_encode("Some error");
   // echo "Error: " . $sql . "
" . $conn->error;
}

$conn->close();
?>

When i am using postman ,
1. the name is not getting saved in db [only hard coded values are being saved]
2. I am not getting echo json_encode("New record created successfully"); once data is saved.

Please help, attaching screenshot of my postman result and how i am passing the name variable

Click here to see the image

Body:
You are sending data through post method and you are using GET.

Change:

$dxname  =$_GET['name'];

To

$dxname  =$_POST['name'];

ALso:

if ($conn->query($sql) === TRUE) {

To

if ($result = $conn->query($sql))
{ echo json_encode("New record created successfully");
   // echo "New record created successfully";
} else {
    echo json_encode("Some error");
   // echo "Error: " . $sql . "<br>" . $conn->error;
}

Cannot query MySQL database via PHP


问:
fix scale of multiple hist in MATLAB
hi

I have a MATLAB program in which I draw several histograms. each time the hist is re-scaled (the axes). I want all of the hists to be shown at the same scale.

this is the program:

```<code>clc
close all
PopSize=10^3;
SampleSize=1:100:PopSize;
NumberOfSamples=10^2;
Pop=randn(PopSize);
figure(NumberOfSamples+1);
hist(Pop);
sample=[];
for j=1:100:PopSize
for i=1:1:NumberOfSamples
    Pop=SHUFFLE(Pop);
    sample(i)=mean(Pop(1:j));
end
figure(i+j);
hist(sample);
end
</code>```

答: You can use the AXIS command to both get and set the axis limits.  For instance, after your first plot you could do axvals = axis();, and after each subsequent plot do axis(axvals); to set all the plots to the same limits as the first one.

ContentLicense: CC BY-SA 2.5

Title: fix scale of multiple hist in MATLAB

Body:
hi

I have a MATLAB program in which I draw several histograms. each time the hist is re-scaled (the axes). I want all of the hists to be shown at the same scale.

this is the program:

clc
close all
PopSize=10^3;
SampleSize=1:100:PopSize;
NumberOfSamples=10^2;
Pop=randn(PopSize);
figure(NumberOfSamples+1);
hist(Pop);
sample=[];
for j=1:100:PopSize
for i=1:1:NumberOfSamples
    Pop=SHUFFLE(Pop);
    sample(i)=mean(Pop(1:j));
end
figure(i+j);
hist(sample);
end


问:
Refresh one-to-many relationship after child was added
So I have two entities:

Person.java

```<code>@Entity
@Table(name = "persons")
public class Person {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @OneToMany(mappedBy="person", cascade = CascadeType.REMOVE)
    @JsonIgnoreProperties("person")
    private Set<Address> addresses;

    //getters and setters

}
</code>```

Address.java

```<code>@Entity
@Table(name = "addresses")
public class Address {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @NotNull
    @ManyToOne
    @JoinColumn(name = "person_id", nullable = false)
    @JsonIgnoreProperties("addresses")
    private Person person;
    //getters and setters
}
</code>```

And later on in my code I have a personDb object (already saved in database) and then I add Address:

```<code>Address address = new Address();
address.setPerson(personDb);
address = addressRepository.save(address);
</code>```

and now I have address object with person object attached to it but my personDb still doesn't have any addresses attached to it. Even if I try to get it from database once more:

personRepository.findOne(personDb.getId());

I have null where should be set of addresses. I also tried changing my annotation in Person class to something like this:

```<code>@OneToMany(mappedBy="person", fetch = FetchType.EAGER, cascade = CascadeType.REMOVE)
</code>```

or changing CascadeType to ALL but nothing helps. What can I do to load addresses to my personDb object after they were added to database?

答:
This is not best solution, but try to add also new address to personDB.</p>

```<code>Address address = new Address();
address.setPerson(personDb);
personDB.addAddress(address);
personRepo.save(personDB)
</code>```

Body:
So I have two entities:

Person.java

@Entity
@Table(name = "persons")
public class Person {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @OneToMany(mappedBy="person", cascade = CascadeType.REMOVE)
    @JsonIgnoreProperties("person")
    private Set<Address> addresses;

    //getters and setters

}

Address.java

@Entity
@Table(name = "addresses")
public class Address {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @NotNull
    @ManyToOne
    @JoinColumn(name = "person_id", nullable = false)
    @JsonIgnoreProperties("addresses")
    private Person person;
    //getters and setters
}

And later on in my code I have a personDb object (already saved in database) and then I add Address:

Address address = new Address();
address.setPerson(personDb);
address = addressRepository.save(address);

and now I have address object with person object attached to it but my personDb still doesn't have any addresses attached to it. Even if I try to get it from database once more:

personRepository.findOne(personDb.getId());

I have null where should be set of addresses. I also tried changing my annotation in Person class to something like this:

@OneToMany(mappedBy="person", fetch = FetchType.EAGER, cascade = CascadeType.REMOVE)

or changing CascadeType to ALL but nothing helps. What can I do to load addresses to my personDb object after they were added to database?

Body:
This is not best solution, but try to add also new address to personDB.

Address address = new Address();
address.setPerson(personDb);
personDB.addAddress(address);
personRepo.save(personDB)


问:
Movement of rectangle with tot function
How can I make this rectangle move from the top left down to the bottom right?

```<code>clear all
close all
clc
n=10;
h=1;
for t=0:n-1
    clf;
    axis([0 sum(1:n) 0 sum(1:n)]);
    axis manual
    tot = sum(0:t);
    patch([tot tot+(t+1)*h tot+(t+1)*h tot],[tot tot tot+(t+1)*h tot+(t+1)*h],...
        [2 6 3 7],'EdgeColor','none','FaceAlpha',(1-(t+1)*.7/n));
    pause(1/6)
end
</code>```

Also, try to use this function somewhere.
sum(1:t)-tot-(t+1)*h

答:
You just need to substruct your y coordinates from the total height sum(0:n):

```<code>patch([tot tot+(t+1)*h tot+(t+1)*h tot],...
    sum(0:n)-[tot tot tot+(t+1)*h tot+(t+1)*h],...
    [2 6 3 7],'EdgeColor','none','FaceAlpha',(1-(t+1)*.7/n));
</code>```

Title: Movement of rectangle with tot function

Body:
How can I make this rectangle move from the top left down to the bottom right?

clear all
close all
clc
n=10;
h=1;
for t=0:n-1
    clf;
    axis([0 sum(1:n) 0 sum(1:n)]);
    axis manual
    tot = sum(0:t);
    patch([tot tot+(t+1)*h tot+(t+1)*h tot],[tot tot tot+(t+1)*h tot+(t+1)*h],...
        [2 6 3 7],'EdgeColor','none','FaceAlpha',(1-(t+1)*.7/n));
    pause(1/6)
end

Also, try to use this function somewhere.
sum(1:t)-tot-(t+1)*h

Body:
You just need to substruct your y coordinates from the total height sum(0:n):

patch([tot tot+(t+1)*h tot+(t+1)*h tot],...
    sum(0:n)-[tot tot tot+(t+1)*h tot+(t+1)*h],...
    [2 6 3 7],'EdgeColor','none','FaceAlpha',(1-(t+1)*.7/n));


问:
Browser not opening file:/// under localhost
I am developing a website that reads the folders and files in client's machine and display in HTML table. All i did was working well. But the issue is i create href for files in clients machine and it is not working in browser from localhost.

However i managed to get an addon for chrome and firefox like Local Explorer, Local link etc. But still i cant find a solution for Internet Explorer 11.
Although it is showing the path in path bar of IE 11 it is not responding.

Here i give a sample code for one hyperlink with screenshot in IE 11 browser

```<code>#!C:\Python27\python.exe
print "Content-type:text/html\r\n\r\n"
print """<html>"""
print """<a href="file:///c:/Users/karthvig/Desktop/IDART/testSW/logs/s006.cfg/1490953346.41/summary.log" target="_blank">test</a>"""
print """</html>"""
</code>```

Screenshot of file in browser

I use apache web server for local host and python as language.

I am newbie and please help with a solution. Thanks in advance!!!

答:
IE disables such navigations:
https://msdn.microsoft.com/library/ee330731(v=vs.85).aspx#file_protocol_nav

Try adding the domain to your trusted sites

Body:
I am developing a website that reads the folders and files in client's machine and display in HTML table. All i did was working well. But the issue is i create href for files in clients machine and it is not working in browser from localhost.

However i managed to get an addon for chrome and firefox like Local Explorer, Local link etc. But still i cant find a solution for Internet Explorer 11.
Although it is showing the path in path bar of IE 11 it is not responding.

Here i give a sample code for one hyperlink with screenshot in IE 11 browser

#!C:\Python27\python.exe
print "Content-type:text/html\r\n\r\n"
print """"""
print """test"""
print """"""

Screenshot of file in browser

I use apache web server for local host and python as language.

I am newbie and please help with a solution. Thanks in advance!!!


问:
Foundation / troble with HTML coding
Can anyone help me with my product cart page? I can't find where I'm making a mistake.

.body {
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  min-height: 100vh;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
}

.main {
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
}

.mainWrapper {
  position: relative;
  width: 100%;
  min-width: 320px;
  min-height: 1000px;
  padding: 0;
  margin: 0 !important;
  background: radial-gradient(#303d55, #2f3352);
}

.wrappen_block {
  position: relative;
  width: 100%;
  height: 100%;
}

.mainBackground {
  width: 100%;
  min-height: 1000px;
  background: url("../img/bgRectangl.png") left center no-repeat, url("../img/bgPhons.png") center center no-repeat, url("../img/layer-3-copy-2.png") center center no-repeat, url("../img/mainBg.png") center center no-repeat;
}

.productCard_block {
  position: relative;
  margin: 190px auto 0;
  max-width: 800px;
  min-height: 600px;
  box-shadow: 0 5px 21px rgba(0, 0, 0, 0.08);
  background-color: #fff;
}

/* LEFT SIDE */

.productCard_leftSide {
  position: relative;
  width: 100%;
  min-height: 600px;
}

.productCard_brendBlock {
  width: 100%;
  height: 75px;
  position: absolute;
  top: 0;
  left: 0;
  max-width: 184px;
  max-height: 75px;
  background-color: #272727;
  z-index: 2;
}

.productCard_brendBlock__imageBlock {
  display: block;
  height: 100%;
}

.productCard_brendBlock__imageBlock img {
  position: absolute;
  display: block;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}

.sliderBlock {
  position: relative;
  height: 100%;
  margin-left: 70px;
  margin-top: 89px;
  margin-bottom: 46px;
  overflow: hidden;
}

.sliderBlock_items {
  position: relative;
  display: block;
  width: 100%;
  height: 403px;
}

.sliderBlock_items__itemPhoto {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 2;
  transition: opacity 1s;
}

.sliderBlock_items__showing {
  opacity: 1;
  z-index: 3;
}

.sliderBlock_items:after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: url("../img/decorElements/DecorRectangle.png") 50% 50% no-repeat;
  opacity: 0.2;
  z-index: 4;
}

.sliderBlock_controls {
  width: 100%;
}

.sliderBlock_controls__navigatin {
  margin-top: 8px;
  width: 100%;
}

.sliderBlock_controls__wrapper {
  margin: 1% auto;
  width: 110px;
  height: 20px;
}

.sliderBlock_controls__arrow {
  position: relative;
  width: 24px;
  height: 24px;
  cursor: pointer;
  border: 1px solid #536dfe;
  transition: 300ms all;
  background-color: #0d2660;
  border-radius: 50%;
}

.sliderBlock_controls__arrow:hover {
  background-color: #536dfe;
}

.sliderBlock_controls__arrow i {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 50%;
  left: 50%;
  margin-left: -50%;
  margin-top: -50%;
  color: #fff;
  transition: 300ms all;
  font-weight: bold;
  text-align: center;
  font-size: 20px;
}

.sliderBlock_controls__arrowBackward {
  float: left;
}

.sliderBlock_controls__arrowForward {
  float: right;
}

.sliderBlock_positionControls {
  display: block;
  width: 100%;
  height: 3px;
  margin: 30px auto 0;
}

.sliderBlock_positionControls__paginatorItem {
  float: left;
  width: 18px;
  height: 10px;
  margin-left: 5px;
  background-color: #D7D7D7;
  cursor: pointer;
}

.sliderBlock_positionControls__paginatorItem:first-child {
  margin-left: 31%;
}

.sliderBlock_positionControls__active {
  background-color: #536dfe;
}

/*   RIGHT SIDE */

.productCard_rightSide {
  position: relative;
  padding-top: 34px;
  padding-left: 27px;
  padding-right: 40px;
  width: 100%;
  min-height: 600px;
}

.block_specification {
  float: right;
  margin-top: 8px;
  cursor: pointer;
  color: #536dfe;
  transition: all 0.5s;
}

.block_specification__button {
  display: inline-block;
  margin-right: 7px;
  height: 100%;
  font-size: 17px;
  text-transform: uppercase;
  -webkit-transform: rotate(0);
  -ms-transform: rotate(0);
  transform: rotate(0);
  transition: -webkit-transform 0.5s;
  transition: transform 0.5s;
  transition: transform 0.5s, -webkit-transform 0.5s;
  -webkit-transform-origin: center center;
  -ms-transform-origin: center center;
  transform-origin: center center;
}

.block_specification:hover .block_specification__button__rotate {
  transition: -webkit-transform 0.5s;
  transition: transform 0.5s;
  transition: transform 0.5s, -webkit-transform 0.5s;
  -webkit-transform: rotate(1turn);
  -ms-transform: rotate(1turn);
  transform: rotate(1turn);
}

.block_specification:hover {
  color: #f1425d;
}

.block_specification__text {
  width: 30px;
  height: 11px;
  font-family: 'Titillium Web', sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
}

.block_model {
  display: inline-block;
  color: #263238;
  font-size: 12px;
  opacity: 0.9;
}

.block_name {
  width: 100%;
  color: #263238;
  font-weight: 400;
  line-height: 35px;
}

.block_name__mainName {
  margin: 0;
  padding: 0;
  font-size: 29px;
}

.block_name__addName {
  margin: 0;
  padding: 0;
  font-size: 24px;
}

.block_product {
  position: relative;
  width: 100%;
}

.block_product__advantagesProduct {
  width: 271px;
  height: 41px;
  margin-top: 14px;
  color: #646b6f;
  font-size: 17px;
  line-height: 24px;
}

.block_product__link {
  line-height: 23px;
  color: #536dfe;
}

.block_informationAboutDevice {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.block_descriptionInformation {
  width: 304px;
  height: 104px;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 400;
  line-height: 23px;
  color: #263238;
}

.block_descriptionCharacteristic {
  position: absolute;
  top: 0;
  left: 100%;
  width: 100%;
  height: 100%;
  z-index: 30;
  transition: left, ease-out, 0.5s;
}

.block_descriptionCharacteristic__active {
  left: 0;
}

@-webkit-keyframes moveCharackeristic {
  0% {
    left: 100%;
  }
  100% {
    left: 0;
  }
}

@keyframes moveCharackeristic {
  0% {
    left: 100%;
  }
  100% {
    left: 0;
  }
}

.block_specificationInformation_table {
  position: relative;
  height: 99.9%;
  background-color: #fff;
}

.block_specificationInformation_table tr {
  border-collapse: collapse;
  border: 1px solid #000;
}

.block_specificationInformation_table th {
  border: 1px solid #000;
  font-weight: bold;
}

.block_specificationInformation_table td {
  border-collapse: collapse;
  text-align: center;
  border: 1px solid #000;
}

.block_rating {
  width: 100%;
  margin-top: 33px;
}

fieldset,
label {
  margin: 0;
  padding: 0;
}

.block_rating__stars {
  border: none;
  float: left;
  width: auto;
  margin: 0;
  padding: 0;
}

input[type="checkbox"]+label,
input[type="radio"]+label {
  margin: 0;
}

.block_rating__stars>input {
  display: none;
}

.block_rating__stars>label:before {
  margin: 5px;
  font-size: 15px;
  font-family: FontAwesome;
  display: inline-block;
  content: "\f005";
}

.block_rating__stars>.half:before {
  content: "\f089";
  position: absolute;
}

.block_rating__stars>label {
  color: #c9c9c9;
  float: right;
}

/***** CSS Magic to Highlight Stars on Hover *****/

.block_rating__stars>input:checked~label,
.block_rating__stars:not(:checked)>label:hover,
.block_rating__stars:not(:checked)>label:hover~label {
  color: #fccf47;
}

/* hover previous stars in list */

.block_rating__stars>input:checked+label:hover,
.block_rating__stars>input:checked~label:hover,
.block_rating__stars>label:hover~input:checked~label,
.block_rating__stars>input:checked~label:hover~label {
  color: #FFED85;
}

.block_rating__avarage {
  margin-left: 31px;
  color: #f1425d;
  font-size: 15px;
  line-height: 35px;
}

.block_rating__reviews {
  margin-left: 6px;
  color: #656c6f;
  font-size: 13px;
}

.block_price {
  margin-top: 29px;
  width: 100%;
}

.block_price__currency {
  padding: 0;
  margin: 0;
  vertical-align: top;
  color: #f1425d;
  font-size: 26px;
  font-weight: 600;
}

.block_price__shipping {
  padding: 0;
  margin: 0;
  color: #A2A9AD;
  font-size: 12px;
}

.radio_button {
  position: absolute;
  opacity: 0;
}

.block_goodColor {
  margin-top: 29px;
  width: 100%;
}

.block_goodColor__allColors {
  width: 100%;
  margin-top: 14px;
}

.block_goodColor__radio {
  display: inline-block;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  margin-left: 10% !important;
  background-color: #e8e6e3;
  cursor: pointer;
}

.radio_button:checked+.block_goodColor__radio {
  width: 25px;
  height: 25px;
  box-shadow: 0 0 5px 3px rgba(83, 109, 254, 0.5);
  border: 2px solid #fff;
}

.block_goodColor__black {
  background-color: #3c383a;
}

.block_goodColor__silver {
  background-color: silver;
}

.text_specification {
  padding: 0;
  color: #37474f;
  font-size: 13px;
}

.block_quantity {
  position: relative;
  height: 46px;
  margin-top: 45px;
}

.block_quantity span {
  display: inline-block;
  float: left;
  margin-top: 15px;
  margin-right: 10px;
}

.block_quantity__chooseBlock {
  vertical-align: top;
  height: 100%;
  margin: 0;
  padding: 0;
}

.block_quantity__number {
  display: inline-block;
  float: left;
  width: 52px;
  height: 46px;
  border: 1px solid #ddd;
  font-size: 18px;
}

.block_quantity__number::-webkit-input-placeholder {
  color: #403f40;
  font-size: 18px;
  line-height: 35px;
}

.block_quantity__number::-moz-placeholder {
  color: #403f40;
  font-size: 18px;
  line-height: 35px;
}

.block_quantity__number:-ms-input-placeholder {
  color: #403f40;
  font-size: 18px;
  line-height: 35px;
}

.block_quantity__number::placeholder {
  color: #403f40;
  font-size: 18px;
  line-height: 35px;
}

.block_quantity__button {
  display: inline-block;
  position: relative;
  float: left;
  width: 20px;
  height: 50%;
  margin: 0;
  padding: 0;
  margin-left: 11px;
  font-size: 0;
  cursor: pointer;
}

.block_quantity__button:hover,
.block_quantity__button:focus {
  background-color: transparent;
}

.block_quantity__button:hover:before,
.block_quantity__button:focus:before {
  color: #536dfe;
}

.block_quantity__up:before {
  content: "\f106";
  width: 11px;
  height: 6px;
  font-family: "FontAwesome";
  color: #37474f;
  font-size: 18px;
}

.block_quantity__down:before {
  content: "\f107";
  width: 11px;
  height: 6px;
  font-family: "FontAwesome";
  color: #37474f;
  font-size: 18px;
}

.button.button_addToCard {
  width: 147px;
  height: 46px;
  margin-top: 43px;
  margin-bottom: 0;
  padding: 0;
  color: #fff;
  background-color: #536dfe;
  font-size: 17px;
  transition: all 0.3s;
}

.button.button_addToCard:hover {
  background-color: #0d2660;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.3.1/css/foundation.min.css" rel="stylesheet" />
<main class="main">
  <div class="mainWrapper">
    <div class="mainBackground clearfix">
      <div class="row">
        <div class="column small-centered">
          <div class="productCard_block">
            <div class="row">
              <div class="small-12 large-6 columns">
                <div class="productCard_leftSide clearfix">
                  <div class="productCard_brendBlock">

                      <img src="img/brtendsLogos/logo_sennheiser.png" alt="sennheiser">

                  </div>

                  <div class="sliderBlock">
                    <ul class="sliderBlock_items">
                      <li class="sliderBlock_items__itemPhoto sliderBlock_items__showing">
                        <img src="img/goods/item1/phones1.png" alt="headphones">
                      </li>
                      <li class="sliderBlock_items__itemPhoto">
                        <img src="img/goods/item1/phones2.png" alt="headphones">
                      </li>
                      <li class="sliderBlock_items__itemPhoto">
                        <img src="img/goods/item1/phones3.png" alt="headphones">
                      </li>
                      <li class="sliderBlock_items__itemPhoto">
                        <img src="img/goods/item1/phones4.png" alt="headphones">
                      </li>
                      <li class="sliderBlock_items__itemPhoto">
                        <img src="img/goods/item1/phones5.png" alt="headphones">
                      </li>
                    </ul>

                    <div class="sliderBlock_controls">
                      <div class="sliderBlock_controls__navigatin">
                        <div class="sliderBlock_controls__wrapper">
                          <div class="sliderBlock_controls__arrow sliderBlock_controls__arrowBackward">
                            <i class="fa fa-angle-left" aria-hidden="true"></i>
                          </div>
                          <div class="sliderBlock_controls__arrow sliderBlock_controls__arrowForward">
                            <i class="fa fa-angle-right" aria-hidden="true"></i>
                          </div>
                        </div>
                      </div>

                      <ul class="sliderBlock_positionControls">
                        <li class="sliderBlock_positionControls__paginatorItem sliderBlock_positionControls__active"></li>
                        <li class="sliderBlock_positionControls__paginatorItem"></li>
                        <li class="sliderBlock_positionControls__paginatorItem"></li>
                        <li class="sliderBlock_positionControls__paginatorItem"></li>
                        <li class="sliderBlock_positionControls__paginatorItem"></li>
                      </ul>
                    </div>
                  </div>
                </div>
              </div>
              <div class="small-12 large-6 columns">
                <div class="productCard_rightSide">
                  <div class="block_specification">
                    <div class="block_specification__specificationShow">
                      <i class="fa fa-cog block_specification__button block_specification__button__rotate" aria-hidden="true"></i>
                      <span class="block_specification__text">spec</span>
                    </div>
                    <div class="block_specification__informationShow hide">
                      <i class="fa fa-info-circle block_specification__button block_specification__button__jump" aria-hidden="true"></i>
                      <span class="block_specification__text">inform</span>
                    </div>
                  </div>

                  <p class="block_model">
                    <span class="block_model__text">Model: </span>
                    <span class="block_model__number">505795</span>
                  </p>

                  <div class="block_product">
                    <h2 class="block_name block_name__mainName">MOMENTUM<sup>® </sup></h2>
                    <h2 class="block_name block_name__addName">Wireless Black</h2>

                    <p class="block_product__advantagesProduct">
                      Wireless headphones with integrated microphone
                    </p>

                    <div class="block_informationAboutDevice">

                      <div class="block_descriptionCharacteristic block_descriptionCharacteristic__disActive">
                        <table class="block_specificationInformation_table">
                          <tr>
                            <th>Characteristic</th>
                            <th>Value</th>
                          </tr>
                          <tr>
                            <td>Ear Coupling</td>
                            <td>Around Ear</td>
                          </tr>
                          <tr>
                            <td>Transducer Principle</td>
                            <td>Dynamic, Closed-back</td>
                          </tr>
                          <tr>
                            <td>Frequency Response</td>
                            <td>16Hz – 22kHz</td>
                          </tr>
                          <tr>
                            <td>Sound Pressure Level (SPL)</td>
                            <td>113 dB (Passive: 1 kHz/1 Vrms)</td>
                          </tr>
                          <tr>
                            <td>Total Harmonic Distortion (THD)</td>
                            <td><0.5% (1 kHz, 100 dB SPL)</td>
                          </tr>
                          <tr>
                            <td>Volume Control</td>
                            <td>Earcup control when Bluetooth connected</td>
                          </tr>
                          <tr>
                            <td>Microphone Type</td>
                            <td>Dual omni-directional microphone <br>(2 mic beam forming array)
                            </td>
                          </tr>
                          <tr>
                            <td>Cable / Connector</td>
                            <td>1.4m (Detachable) / 3.5mm Angled</td>
                          </tr>
                          <tr>
                            <td>Weight</td>
                            <td>260g (9.17 oz)</td>
                          </tr>
                        </table>
                      </div>

                      <div class="block_descriptionInformation">
                        <span>Peak performance with active noise cancelation. Sennheiser's new MOMENTUM Wireless
                                                - Closed circumauralheadphone featuring Bluetooth<sup>®</sup>  wireless technology and NoiseGard Hybrid active noise cancelation
                                                </span>
                      </div>

                      <div class="block_rating">
                        <fieldset class="block_rating__stars">
                          <input type="radio" id="star5" name="rating" value="5" /><label class="full" for="star5" title="Awesome - 5 stars"></label>
                          <input type="radio" id="star4half" name="rating" value="4 and a half" /><label class="half" for="star4half" title="Pretty good - 4.5 stars"></label>
                          <input type="radio" id="star4" name="rating" value="4" /><label class="full" for="star4" title="Good - 4 stars"></label>
                          <input type="radio" id="star3half" name="rating" value="3 and a half" /><label class="half" for="star3half" title="Above average - 3.5 stars"></label>
                          <input type="radio" id="star3" name="rating" value="3" /><label class="full" for="star3" title="Average - 3 stars"></label>
                          <input type="radio" id="star2half" name="rating" value="2 and a half" /><label class="half" for="star2half" title="Kinda bad - 2.5 stars"></label>
                          <input type="radio" id="star2" name="rating" value="2" /><label class="full" for="star2" title="Kinda bad - 2 stars"></label>
                          <input type="radio" id="star1half" name="rating" value="1 and a half" /><label class="half" for="star1half" title="Meh - 1.5 stars"></label>
                          <input type="radio" id="star1" name="rating" value="1" /><label class="full" for="star1" title="Sucks big time - 1 star"></label>
                          <input type="radio" id="starhalf" name="rating" value="half" /><label class="half" for="starhalf" title="Sucks big time - 0.5 stars"></label>
                        </fieldset>

                        <span class="block_rating__avarage">4.25</span>
                        <span class="block_rating__reviews">(153 reviews)</span>

                      </div>
                      <div class="row">
                        <div class="large-6 small-12 column">
                          <div class="block_price">
                            <p class="block_price__currency">$499.95</p>
                            <p class="block_price__shipping">Shipping and taxes extra</p>
                          </div>
                          <div class="block_quantity">
                            <span class="text_specification">Quantity</span>
                            <div class="block_quantity__chooseBlock">
                              <input class="block_quantity__number" name="quantityNumber" type="text" min="1" value="1">
                              <button class="block_quantity__button block_quantity__up"></button>
                              <button class="block_quantity__button block_quantity__down"></button>
                            </div>
                          </div>
                        </div>
                        <div class="large-6 small-12 end column">
                          <div class="block_goodColor">
                            <span class="text_specification">Choose your colors:</span>
                            <div class="block_goodColor__allColors">
                              <input type="radio" name="colorOfItem" class="radio_button" id="radioColor" checked/>
                              <label for="radioColor" class="block_goodColor__radio block_goodColor__black"></label>
                              <input type="radio" name="colorOfItem" class="radio_button" id="radioColor2" />
                              <label for="radioColor2" class="block_goodColor__radio block_goodColor__silver"></label>
                            </div>
                          </div>
                          <button class="button button_addToCard">
                                                        Add to Cart
                                                    </button>
                        </div>

                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

</main></code>```

For clarification, I'll show you two photos. On the first photo as it now looks, and on the second, how it should look like

[] Picture with problem1
[]2

答: Thanks for posting such great info to troubleshoot with, but without a little bit more it'll be hard for me to help. Have you thought of installing a chrome extension like Pesticide? It'll help you actually see outlines of what is where so you can figure out what happened. You can right click on elements and left click inspect to then see them in Chrome Developer Tools and actually look at what CSS is applying to them. You can then add in-line styles to style them manually while the window it open to try out solutions before returning to your CSS document and finalizing them (by adding them more permanently). Take caution when using !important though as it's kind of bringing a gun to a knife fight imho. Good luck and feel free to post screens of your site once pesticide is running and drawing boxes.</p>

Title: Foundation / troble with HTML coding

Body:
Can anyone help me with my product cart page? I can't find where I'm making a mistake.

.body {
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  min-height: 100vh;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
}

.main {
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
}

.mainWrapper {
  position: relative;
  width: 100%;
  min-width: 320px;
  min-height: 1000px;
  padding: 0;
  margin: 0 !important;
  background: radial-gradient(#303d55, #2f3352);
}

.wrappen_block {
  position: relative;
  width: 100%;
  height: 100%;
}

.mainBackground {
  width: 100%;
  min-height: 1000px;
  background: url("../img/bgRectangl.png") left center no-repeat, url("../img/bgPhons.png") center center no-repeat, url("../img/layer-3-copy-2.png") center center no-repeat, url("../img/mainBg.png") center center no-repeat;
}

.productCard_block {
  position: relative;
  margin: 190px auto 0;
  max-width: 800px;
  min-height: 600px;
  box-shadow: 0 5px 21px rgba(0, 0, 0, 0.08);
  background-color: #fff;
}

/* LEFT SIDE */

.productCard_leftSide {
  position: relative;
  width: 100%;
  min-height: 600px;
}

.productCard_brendBlock {
  width: 100%;
  height: 75px;
  position: absolute;
  top: 0;
  left: 0;
  max-width: 184px;
  max-height: 75px;
  background-color: #272727;
  z-index: 2;
}

.productCard_brendBlock__imageBlock {
  display: block;
  height: 100%;
}

.productCard_brendBlock__imageBlock img {
  position: absolute;
  display: block;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}

.sliderBlock {
  position: relative;
  height: 100%;
  margin-left: 70px;
  margin-top: 89px;
  margin-bottom: 46px;
  overflow: hidden;
}

.sliderBlock_items {
  position: relative;
  display: block;
  width: 100%;
  height: 403px;
}

.sliderBlock_items__itemPhoto {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 2;
  transition: opacity 1s;
}

.sliderBlock_items__showing {
  opacity: 1;
  z-index: 3;
}

.sliderBlock_items:after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: url("../img/decorElements/DecorRectangle.png") 50% 50% no-repeat;
  opacity: 0.2;
  z-index: 4;
}

.sliderBlock_controls {
  width: 100%;
}

.sliderBlock_controls__navigatin {
  margin-top: 8px;
  width: 100%;
}

.sliderBlock_controls__wrapper {
  margin: 1% auto;
  width: 110px;
  height: 20px;
}

.sliderBlock_controls__arrow {
  position: relative;
  width: 24px;
  height: 24px;
  cursor: pointer;
  border: 1px solid #536dfe;
  transition: 300ms all;
  background-color: #0d2660;
  border-radius: 50%;
}

.sliderBlock_controls__arrow:hover {
  background-color: #536dfe;
}

.sliderBlock_controls__arrow i {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 50%;
  left: 50%;
  margin-left: -50%;
  margin-top: -50%;
  color: #fff;
  transition: 300ms all;
  font-weight: bold;
  text-align: center;
  font-size: 20px;
}

.sliderBlock_controls__arrowBackward {
  float: left;
}

.sliderBlock_controls__arrowForward {
  float: right;
}

.sliderBlock_positionControls {
  display: block;
  width: 100%;
  height: 3px;
  margin: 30px auto 0;
}

.sliderBlock_positionControls__paginatorItem {
  float: left;
  width: 18px;
  height: 10px;
  margin-left: 5px;
  background-color: #D7D7D7;
  cursor: pointer;
}

.sliderBlock_positionControls__paginatorItem:first-child {
  margin-left: 31%;
}

.sliderBlock_positionControls__active {
  background-color: #536dfe;
}

/*   RIGHT SIDE */

.productCard_rightSide {
  position: relative;
  padding-top: 34px;
  padding-left: 27px;
  padding-right: 40px;
  width: 100%;
  min-height: 600px;
}

.block_specification {
  float: right;
  margin-top: 8px;
  cursor: pointer;
  color: #536dfe;
  transition: all 0.5s;
}

.block_specification__button {
  display: inline-block;
  margin-right: 7px;
  height: 100%;
  font-size: 17px;
  text-transform: uppercase;
  -webkit-transform: rotate(0);
  -ms-transform: rotate(0);
  transform: rotate(0);
  transition: -webkit-transform 0.5s;
  transition: transform 0.5s;
  transition: transform 0.5s, -webkit-transform 0.5s;
  -webkit-transform-origin: center center;
  -ms-transform-origin: center center;
  transform-origin: center center;
}

.block_specification:hover .block_specification__button__rotate {
  transition: -webkit-transform 0.5s;
  transition: transform 0.5s;
  transition: transform 0.5s, -webkit-transform 0.5s;
  -webkit-transform: rotate(1turn);
  -ms-transform: rotate(1turn);
  transform: rotate(1turn);
}

.block_specification:hover {
  color: #f1425d;
}

.block_specification__text {
  width: 30px;
  height: 11px;
  font-family: 'Titillium Web', sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
}

.block_model {
  display: inline-block;
  color: #263238;
  font-size: 12px;
  opacity: 0.9;
}

.block_name {
  width: 100%;
  color: #263238;
  font-weight: 400;
  line-height: 35px;
}

.block_name__mainName {
  margin: 0;
  padding: 0;
  font-size: 29px;
}

.block_name__addName {
  margin: 0;
  padding: 0;
  font-size: 24px;
}

.block_product {
  position: relative;
  width: 100%;
}

.block_product__advantagesProduct {
  width: 271px;
  height: 41px;
  margin-top: 14px;
  color: #646b6f;
  font-size: 17px;
  line-height: 24px;
}

.block_product__link {
  line-height: 23px;
  color: #536dfe;
}

.block_informationAboutDevice {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.block_descriptionInformation {
  width: 304px;
  height: 104px;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 400;
  line-height: 23px;
  color: #263238;
}

.block_descriptionCharacteristic {
  position: absolute;
  top: 0;
  left: 100%;
  width: 100%;
  height: 100%;
  z-index: 30;
  transition: left, ease-out, 0.5s;
}

.block_descriptionCharacteristic__active {
  left: 0;
}

@-webkit-keyframes moveCharackeristic {
  0% {
    left: 100%;
  }
  100% {
    left: 0;
  }
}

@keyframes moveCharackeristic {
  0% {
    left: 100%;
  }
  100% {
    left: 0;
  }
}

.block_specificationInformation_table {
  position: relative;
  height: 99.9%;
  background-color: #fff;
}

.block_specificationInformation_table tr {
  border-collapse: collapse;
  border: 1px solid #000;
}

.block_specificationInformation_table th {
  border: 1px solid #000;
  font-weight: bold;
}

.block_specificationInformation_table td {
  border-collapse: collapse;
  text-align: center;
  border: 1px solid #000;
}

.block_rating {
  width: 100%;
  margin-top: 33px;
}

fieldset,
label {
  margin: 0;
  padding: 0;
}

.block_rating__stars {
  border: none;
  float: left;
  width: auto;
  margin: 0;
  padding: 0;
}

input[type="checkbox"]+label,
input[type="radio"]+label {
  margin: 0;
}

.block_rating__stars>input {
  display: none;
}

.block_rating__stars>label:before {
  margin: 5px;
  font-size: 15px;
  font-family: FontAwesome;
  display: inline-block;
  content: "\f005";
}

.block_rating__stars>.half:before {
  content: "\f089";
  position: absolute;
}

.block_rating__stars>label {
  color: #c9c9c9;
  float: right;
}

/***** CSS Magic to Highlight Stars on Hover *****/

.block_rating__stars>input:checked~label,
.block_rating__stars:not(:checked)>label:hover,
.block_rating__stars:not(:checked)>label:hover~label {
  color: #fccf47;
}

/* hover previous stars in list */

.block_rating__stars>input:checked+label:hover,
.block_rating__stars>input:checked~label:hover,
.block_rating__stars>label:hover~input:checked~label,
.block_rating__stars>input:checked~label:hover~label {
  color: #FFED85;
}

.block_rating__avarage {
  margin-left: 31px;
  color: #f1425d;
  font-size: 15px;
  line-height: 35px;
}

.block_rating__reviews {
  margin-left: 6px;
  color: #656c6f;
  font-size: 13px;
}

.block_price {
  margin-top: 29px;
  width: 100%;
}

.block_price__currency {
  padding: 0;
  margin: 0;
  vertical-align: top;
  color: #f1425d;
  font-size: 26px;
  font-weight: 600;
}

.block_price__shipping {
  padding: 0;
  margin: 0;
  color: #A2A9AD;
  font-size: 12px;
}

.radio_button {
  position: absolute;
  opacity: 0;
}

.block_goodColor {
  margin-top: 29px;
  width: 100%;
}

.block_goodColor__allColors {
  width: 100%;
  margin-top: 14px;
}

.block_goodColor__radio {
  display: inline-block;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  margin-left: 10% !important;
  background-color: #e8e6e3;
  cursor: pointer;
}

.radio_button:checked+.block_goodColor__radio {
  width: 25px;
  height: 25px;
  box-shadow: 0 0 5px 3px rgba(83, 109, 254, 0.5);
  border: 2px solid #fff;
}

.block_goodColor__black {
  background-color: #3c383a;
}

.block_goodColor__silver {
  background-color: silver;
}

.text_specification {
  padding: 0;
  color: #37474f;
  font-size: 13px;
}

.block_quantity {
  position: relative;
  height: 46px;
  margin-top: 45px;
}

.block_quantity span {
  display: inline-block;
  float: left;
  margin-top: 15px;
  margin-right: 10px;
}

.block_quantity__chooseBlock {
  vertical-align: top;
  height: 100%;
  margin: 0;
  padding: 0;
}

.block_quantity__number {
  display: inline-block;
  float: left;
  width: 52px;
  height: 46px;
  border: 1px solid #ddd;
  font-size: 18px;
}

.block_quantity__number::-webkit-input-placeholder {
  color: #403f40;
  font-size: 18px;
  line-height: 35px;
}

.block_quantity__number::-moz-placeholder {
  color: #403f40;
  font-size: 18px;
  line-height: 35px;
}

.block_quantity__number:-ms-input-placeholder {
  color: #403f40;
  font-size: 18px;
  line-height: 35px;
}

.block_quantity__number::placeholder {
  color: #403f40;
  font-size: 18px;
  line-height: 35px;
}

.block_quantity__button {
  display: inline-block;
  position: relative;
  float: left;
  width: 20px;
  height: 50%;
  margin: 0;
  padding: 0;
  margin-left: 11px;
  font-size: 0;
  cursor: pointer;
}

.block_quantity__button:hover,
.block_quantity__button:focus {
  background-color: transparent;
}

.block_quantity__button:hover:before,
.block_quantity__button:focus:before {
  color: #536dfe;
}

.block_quantity__up:before {
  content: "\f106";
  width: 11px;
  height: 6px;
  font-family: "FontAwesome";
  color: #37474f;
  font-size: 18px;
}

.block_quantity__down:before {
  content: "\f107";
  width: 11px;
  height: 6px;
  font-family: "FontAwesome";
  color: #37474f;
  font-size: 18px;
}

.button.button_addToCard {
  width: 147px;
  height: 46px;
  margin-top: 43px;
  margin-bottom: 0;
  padding: 0;
  color: #fff;
  background-color: #536dfe;
  font-size: 17px;
  transition: all 0.3s;
}

.button.button_addToCard:hover {
  background-color: #0d2660;
}

<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.3.1/css/foundation.min.css" rel="stylesheet" />

                      spec

                      inform

                    Model:
                    505795

MOMENTUM®

Wireless Black

                      Wireless headphones with integrated microphone

                            Characteristic
                            Value

                            Ear Coupling
                            Around Ear

                            Transducer Principle
                            Dynamic, Closed-back

                            Frequency Response
                            16Hz – 22kHz

                            Sound Pressure Level (SPL)
                            113 dB (Passive: 1 kHz/1 Vrms)

                            Total Harmonic Distortion (THD)
                            <0.5% (1 kHz, 100 dB SPL)

                            Volume Control
                            Earcup control when Bluetooth connected

                            Microphone Type
                            Dual omni-directional microphone
(2 mic beam forming array)

                            Cable / Connector
                            1.4m (Detachable) / 3.5mm Angled

                            Weight
                            260g (9.17 oz)

                        Peak performance with active noise cancelation. Sennheiser's new MOMENTUM Wireless
                                                - Closed circumauralheadphone featuring Bluetooth®  wireless technology and NoiseGard Hybrid active noise cancelation

                        <fieldset class="block_rating__stars">
                          <input type="radio" id="star5" name="rating" value="5" />
                          <input type="radio" id="star4half" name="rating" value="4 and a half" />
                          <input type="radio" id="star4" name="rating" value="4" />
                          <input type="radio" id="star3half" name="rating" value="3 and a half" />
                          <input type="radio" id="star3" name="rating" value="3" />
                          <input type="radio" id="star2half" name="rating" value="2 and a half" />
                          <input type="radio" id="star2" name="rating" value="2" />
                          <input type="radio" id="star1half" name="rating" value="1 and a half" />
                          <input type="radio" id="star1" name="rating" value="1" />
                          <input type="radio" id="starhalf" name="rating" value="half" />
                        </fieldset>

                        4.25
                        (153 reviews)

$499.95

Shipping and taxes extra

                            Quantity

                              <input class="block_quantity__number" name="quantityNumber" type="text" min="1" value="1">
                              <button class="block_quantity__button block_quantity__up"></button>
                              <button class="block_quantity__button block_quantity__down"></button>

                            Choose your colors:

                              <input type="radio" name="colorOfItem" class="radio_button" id="radioColor" checked/>

                              <input type="radio" name="colorOfItem" class="radio_button" id="radioColor2" />

                          <button class="button button_addToCard">
                                                        Add to Cart
                                                    </button>

For clarification, I'll show you two photos. On the first photo as it now looks, and on the second, how it should look like

[] Picture with problem1
[]2


问:
Getting the 'scale' from a CATransform3D
I am creating an iPad app and want to update the user with the current size of a view. I used to be doing this by calculating the scale of a CGAffineTransform and multiplying the xScale by the width (of the related view) and the yScale by the height. I'd like to keep doing this, but I'm no longer doing 2d transformations, and I'm not sure what equation to use to extract the scale information from CATransform3D.

Can you help?

答:
I'm not familiar with the API but CATransform3D looks like a regular 4x4 transformation matrix for doing 3D transformations.

Assuming that it represents nothing more than a combination of scale, rotation and translation, the scale factors can be extracted by calculating the magnitudes of either the rows or columns of the upper left 3x3 depending on whether CATransform3D is row or column major respectively.

For example, if it is row-major, the scale in the x-direction is the square root of ( m11 * m11 ) + ( m12 * m12 ) + ( m13 * m13 ). The y and z scales would similarly be the magnitudes of the second and third rows.

From the documentation for CATransform3DMakeTranslation it appears that CATransform3D is indeed row-major.

ContentLicense: CC BY-SA 4.0


问:
"loading" message doesn't display while processing a copy function
In my Flask application I need to show a "waiting" div while processing a file copy. It seemed to me a trivial task, so I wrote:

server side:

```<code>@cotg.route('/', methods=['POST'])
def startCopy():
    source = request.form.getlist('sourcedisk[]')
    dest= request.form.getlist('destdisk[]')
    action_Copy()
    return render_template('index.html')
</code>```

template side:

```<code> $(document).ready(
        function () {
        $("#wait").hide();
        $('#startcopy').submit(function(event){
            var c = confirm("Are you sure?");
            if (c == true) {
                $("#wait").show();
                }
            return c;
        });
});
</code>```

but it simply doesn't work as expected. The page holds until the action_Copy() function ends without displaying the #wait div.

答:
I am not sure what your "#startcopy" submit event does but the logic here is

get YES from the confirm box

show the #wait div

invoke the submit method

hide the #wait div

try this -

```<code>$(document).ready(function(){
    var c = confirm("Are you sure?");
    if (c == true) {
        $("#wait").show();
        $('#startcopy').submit(function(event){
            $("#wait").hide();
        }
        return c;
    }
});
</code>```

Body:
In my Flask application I need to show a "waiting" div while processing a file copy. It seemed to me a trivial task, so I wrote:

server side:

@cotg.route('/', methods=['POST'])
def startCopy():
    source = request.form.getlist('sourcedisk[]')
    dest= request.form.getlist('destdisk[]')
    action_Copy()
    return render_template('index.html')

template side:

 $(document).ready(
        function () {
        $("#wait").hide();
        $('#startcopy').submit(function(event){
            var c = confirm("Are you sure?");
            if (c == true) {
                $("#wait").show();
                }
            return c;
        });
});

but it simply doesn't work as expected. The page holds until the action_Copy() function ends without displaying the #wait div.

Body:
I am not sure what your "#startcopy" submit event does but the logic here is

get YES from the confirm box

show the #wait div

invoke the submit method

hide the #wait div

try this -

$(document).ready(function(){
    var c = confirm("Are you sure?");
    if (c == true) {
        $("#wait").show();
        $('#startcopy').submit(function(event){
            $("#wait").hide();
        }
        return c;
    }
});


问:
codeigniter: Pagination logic to show 2 lists per page
I am having a pagination page in my controller, i am kind of puzzled in listing 2 data per page on my view. The controller code which i am using is as follows:

```<code>public function newsletter()
{
    $this->load->library('pagination');
    $config = array();

    $config["base_url"] = base_url() . "index.php/welcome/newsletter";
    $this->load->model('newsletter_model');
    $total_row = $this->newsletter_model->record_count();
    $config["total_rows"] = $total_row;
    $config["per_page"] = 2;  // per page 2 records
    $config['use_page_numbers'] = TRUE;
    $config['num_links'] = $total_row;
    $config['cur_tag_open'] = ' <a class="current">';
    $config['cur_tag_close'] = '</a>';

    $config['page_query_string'] = FALSE;
    $config['next_link'] = 'Next';
    $config['prev_link'] = 'Previous';

    $this->pagination->initialize($config);
    if($this->uri->segment(3)){
    $page = ($this->uri->segment(3)) ;
    }
    else{
    $page = 1;
    }
    $this->load->model('newsletter_model');
    $data["results"] = $this->newsletter_model->fetch_data($config["per_page"], $page);
    $str_links = $this->pagination->create_links();
    $data["links"] = explode(' ',$str_links );

    $this->load->model('newsletter_model');
    $this->load->view('newsletter/newsletter',$data);
}
</code>```

With the above code i am getting 2 records per page as i intended, but i could not understand the logic behind the pagination. can anyone explain me the logic worked in codeigniter pagination, with my work itself as it would be handy for me to understand it.

My Model code is as follows:

```<code>  public function fetch_data($limit, $id)
   {

    $this->db->select('*');
    $this->db->from('ins_newsletter');
    $this->db->order_by('nl_id', 'desc');
    $this->db->limit($limit,$id);
    $query = $this->db->get();

    return $query->result_array();

}
public function record_count()
{
    return $this->db->count_all("ins_newsletter");
}
</code>```

答:
CI's Paginator class only generates pagination links for you.

The "record pagination" logic happens here:

```<code>$this->db->limit($limit, $offset);
</code>```

$limit is the number of records to fetch, $offset is the offset of the first row to return.

To fetch the first two records, we will set $limit = 2, $offset = 0

CI translates into SQL like:

```<code>SELECT ...... FROM ins_newsletter LIMIT 0, 2;
</code>```

To fetch record number 3 and 4, we will set $limit = 2, $offset = 2

CI translates into SQL like:

```<code>SELECT ...... FROM ins_newsletter LIMIT 2, 2;
</code>```

Edit:

There is a small bug in your code.

The offset should be 0 for page 1, 2 for page 2, 4 for page 3, 6 for page 4, 8 for page 5...and so on.

```<code>public function fetch_data($limit, $page)
{
    $offset = ($page - 1) * $limit;
    ...
}
</code>```

And I would suggest you to change the second param to $page instead of $id.

Body:
I am having a pagination page in my controller, i am kind of puzzled in listing 2 data per page on my view. The controller code which i am using is as follows:

public function newsletter()
{
    $this->load->library('pagination');
    $config = array();

    $config["base_url"] = base_url() . "index.php/welcome/newsletter";
    $this->load->model('newsletter_model');
    $total_row = $this->newsletter_model->record_count();
    $config["total_rows"] = $total_row;
    $config["per_page"] = 2;  // per page 2 records
    $config['use_page_numbers'] = TRUE;
    $config['num_links'] = $total_row;
    $config['cur_tag_open'] = ' ';
    $config['cur_tag_close'] = '';

    $config['page_query_string'] = FALSE;
    $config['next_link'] = 'Next';
    $config['prev_link'] = 'Previous';

    $this->pagination->initialize($config);
    if($this->uri->segment(3)){
    $page = ($this->uri->segment(3)) ;
    }
    else{
    $page = 1;
    }
    $this->load->model('newsletter_model');
    $data["results"] = $this->newsletter_model->fetch_data($config["per_page"], $page);
    $str_links = $this->pagination->create_links();
    $data["links"] = explode(' ',$str_links );

    $this->load->model('newsletter_model');
    $this->load->view('newsletter/newsletter',$data);
}

With the above code i am getting 2 records per page as i intended, but i could not understand the logic behind the pagination. can anyone explain me the logic worked in codeigniter pagination, with my work itself as it would be handy for me to understand it.

My Model code is as follows:

  public function fetch_data($limit, $id)
   {

    $this->db->select('*');
    $this->db->from('ins_newsletter');
    $this->db->order_by('nl_id', 'desc');
    $this->db->limit($limit,$id);
    $query = $this->db->get();

    return $query->result_array();

}
public function record_count()
{
    return $this->db->count_all("ins_newsletter");
}

Body:
CI's Paginator class only generates pagination links for you.

The "record pagination" logic happens here:

$this->db->limit($limit, $offset);

$limit is the number of records to fetch, $offset is the offset of the first row to return.

To fetch the first two records, we will set $limit = 2, $offset = 0

CI translates into SQL like:

SELECT ...... FROM ins_newsletter LIMIT 0, 2;

To fetch record number 3 and 4, we will set $limit = 2, $offset = 2

CI translates into SQL like:

SELECT ...... FROM ins_newsletter LIMIT 2, 2;

Edit:

There is a small bug in your code.

The offset should be 0 for page 1, 2 for page 2, 4 for page 3, 6 for page 4, 8 for page 5...and so on.

public function fetch_data($limit, $page)
{
    $offset = ($page - 1) * $limit;
    ...
}

And I would suggest you to change the second param to $page instead of $id.


问:
Remove primary key and auto-increment in database using migration in laravel
I have table with primary key and auto-increment field, I want make new migration to drop primary key index and also remove the auto increment field. How can i achieve this.

I created new migration as

```<code>public function up()
{
    Schema::table('tbl_message_read_state', function (Blueprint $table) {

    });
}

/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    Schema::table('tbl_message_read_state', function (Blueprint $table) {

        $table->dropPrimary('message_id');
        $table->unsignedInteger('message_id');
    });
}
</code>```

It gave me error in command as [Illuminate\Database\QueryException]

  SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'message _id' (SQL: alter table tbl_'message_read_state' add 'message_id' int unsigned not null)

Whats Wrong ?????

答:
Drop the primary key:

```<code>$table->dropPrimary( 'id' );
</code>```

Reference

Body:
I have table with primary key and auto-increment field, I want make new migration to drop primary key index and also remove the auto increment field. How can i achieve this.

I created new migration as

public function up()
{
    Schema::table('tbl_message_read_state', function (Blueprint $table) {

    });
}

/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    Schema::table('tbl_message_read_state', function (Blueprint $table) {

        $table->dropPrimary('message_id');
        $table->unsignedInteger('message_id');
    });
}

It gave me error in command as [Illuminate\Database\QueryException]

  SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'message _id' (SQL: alter table tbl_'message_read_state' add 'message_id' int unsigned not null)

Whats Wrong ?????

Body:
Drop the primary key:

$table->dropPrimary( 'id' );

Reference


问:
Python/Django run development server
I'm trying to create a project using Django 1.8.4 and Python 2.7.10, but I can't execute the command python manage.py runserver. I can create the project and apps, but can't run the server.
Please somebody help me, I'm new with Python/Django and I couldn't advance more.
The cmd show the next error when the command is executed.

C:\Users\Efren\SkyDrive\UniCosta\VIII\Ingeniería de Software
  II\Django\PrimerProyecto>python manage.py runserver Performing system
  checks...

System check identified no issues (0 silenced). Unhandled exception in
  thread started by  Traceback (most
  recent call last):

File "C:\Python27\lib\site-packages\django\utils\autoreload.py",
  line 225, in wrapper
      fn(*args, **kwargs)

File
  "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py",
  line 112, in inner_run
      self.check_migrations()

File
  "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py",
  line 164, in check_migrations
      executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])

File
  "C:\Python27\lib\site-packages\django\db\migrations\executor.py", line
  19, in init
      self.loader = MigrationLoader(self.connection)

File "C:\Python27\lib\site-packages\django\db\migrations\loader.py",
  line 47, in init
      self.build_graph()

File "C:\Python27\lib\site-packages\django\db\migrations\loader.py",
  line 182, in build_graph
      self.applied_migrations = recorder.applied_migrations()

File
  "C:\Python27\lib\site-packages\django\db\migrations\recorder.py", line
  59, in applied_migrations
      self.ensure_schema()

File
  "C:\Python27\lib\site-packages\django\db\migrations\recorder.py", line
  49, in ensure_schema
      if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):

File
  "C:\Python27\lib\site-packages\django\db\backends\base\base.py", line
  162, in cursor
      cursor = self.make_debug_cursor(self._cursor())

File
  "C:\Python27\lib\site-packages\django\db\backends\base\base.py", line
  135, in _cursor
      self.ensure_connection()

File
  "C:\Python27\lib\site-packages\django\db\backends\base\base.py", line
  130, in ensure_connection
      self.connect()

File "C:\Python27\lib\site-packages\django\db\utils.py", line 97, in
  exit
      six.reraise(dj_exc_type, dj_exc_value, traceback)

File
  "C:\Python27\lib\site-packages\django\db\backends\base\base.py", line
  130, in ensure_connection
      self.connect()

File
  "C:\Python27\lib\site-packages\django\db\backends\base\base.py", line
  119, in connect
      self.connection = self.get_new_connection(conn_params)

File
  "C:\Python27\lib\site-packages\django\db\backends\sqlite3\base.py",
  line 204, in get_new_connection
      conn = Database.connect(**conn_params)

django.db.utils.OperationalError: unable to open database file

答:
It seems pretty clear that Django is unable to find your database at specified location, reasons can be,

You have created django project using "sudo" or with any other other linux user than your current user, thats why your current user might not have permissions to access that database. You can check permissions of files by typing in your project's root directory,

ls -la

You have configured wrong path for database file in your settings.py

Title: Python/Django run development server


问:
In Django forms, how do I "add" an error into the queue?
```<code>def clean(self):
        cleaned_data = self.cleaned_data
        current_pass = cleaned_data['current_pass']
        new_pass = cleaned_data['new_pass']
        new_pass2 = cleaned_data['new_pass2']
        if current_pass or new_pass or new_pass2:
            if not current_pass:
                raise forms.ValidationError("- You must enter your current password.")
            if not new_pass:
                raise forms.ValidationError("- You must enter a new password.")
            if not new_pass2:
                raise forms.ValidationError("- You must re-confirm your new password.")
        return cleaned_data
</code>```

Right now, I raise my errors. But this means that the other errors won't pop up. it ends the function when I raise the first one. What if I want to have all 3 errors?

答:
By using the clean method, you are doing per-form validation. The validator for the whole form has failed.

For individual fields, you should be using the clean_fieldname methods instead of clean which runs after individual field validation.

If you use the clean_fieldname, you can access the errors in forminstance.errors or forminstance.field.errors

```<code>def clean_current_pass(self):
    data = self.cleaned_data.get('current_pass'):
    if not data:
        raise forms.ValidationError('- You must enter your current password.')
    return data

def clean_new_pass(self):
    data = self.cleaned_data.get('new_pass'):
    if not data:
        raise forms.ValidationError("- You must enter a new password.")
    return data

def clean_new_pass2(self):
    data = self.cleaned_data.get('new_pass2'):
    if not data:
        raise forms.ValidationError('- You must re-confirm your new password.')
    return data
</code>```

{{ myform.errors }} would give you all errors in your template.

Body:
def clean(self):
        cleaned_data = self.cleaned_data
        current_pass = cleaned_data['current_pass']
        new_pass = cleaned_data['new_pass']
        new_pass2 = cleaned_data['new_pass2']
        if current_pass or new_pass or new_pass2:
            if not current_pass:
                raise forms.ValidationError("- You must enter your current password.")
            if not new_pass:
                raise forms.ValidationError("- You must enter a new password.")
            if not new_pass2:
                raise forms.ValidationError("- You must re-confirm your new password.")
        return cleaned_data

Right now, I raise my errors. But this means that the other errors won't pop up. it ends the function when I raise the first one. What if I want to have all 3 errors?

Body:
By using the clean method, you are doing per-form validation. The validator for the whole form has failed.

For individual fields, you should be using the clean_fieldname methods instead of clean which runs after individual field validation.

If you use the clean_fieldname, you can access the errors in forminstance.errors or forminstance.field.errors

def clean_current_pass(self):
    data = self.cleaned_data.get('current_pass'):
    if not data:
        raise forms.ValidationError('- You must enter your current password.')
    return data

def clean_new_pass(self):
    data = self.cleaned_data.get('new_pass'):
    if not data:
        raise forms.ValidationError("- You must enter a new password.")
    return data

def clean_new_pass2(self):
    data = self.cleaned_data.get('new_pass2'):
    if not data:
        raise forms.ValidationError('- You must re-confirm your new password.')
    return data

{{ myform.errors }} would give you all errors in your template.


问:
How to destroy growl div component that hides other stuff
On my jsf page at some point I send a message to the growl component.

```<code><p:growl id="growlLong" for="growlLong" showDetail="true" life="10000" sticky="false"/>
</code>```

Once the 10sec is over, or dismissed by clicking the X, the issue that occurs is the element below the growl is not selectable. By inspecting the components on the page, looks like the actual div stayed there and blocks the content below it.

```<code><?xml version="1.0" encoding="UTF-8"?>
<div class="ui-growl-item">
   <div class="ui-growl-icon-close ui-icon ui-icon-closethick" style="display: none;" />
   <span class="ui-growl-image ui-growl-image-info" />
   <div class="ui-growl-message">
      <span class="ui-growl-title">Success!</span>
      <p>Configuration successfully saved.</p>
   </div>
   <div style="clear: both;" />
</div>
</code>```

So, the question is - how do I make this to go away and keep the content below still usable?

Here is the screenshot of the issue, as seen with "inspect element", blue boxes are existing links, red box is the dismissed growl. Inside the blue box, we can't click the part that is covered by the red box.

答:
This topic might be older but I just recently stumbled upon it:
The reason that the showcase is working but my version was not was that I gave the .ui-growl CSS class a height AND a width. In the showcase, the size of the container is only defined by its content and thus 0 if there are no items to display.

I moved my height definition to .ui-growl-item (which is more appropriate anyhow) and now it's working like a charm.

Body:
On my jsf page at some point I send a message to the growl component.

Once the 10sec is over, or dismissed by clicking the X, the issue that occurs is the element below the growl is not selectable. By inspecting the components on the page, looks like the actual div stayed there and blocks the content below it.

<?xml version="1.0" encoding="UTF-8"?>

      Success!

Configuration successfully saved.

So, the question is - how do I make this to go away and keep the content below still usable?

Here is the screenshot of the issue, as seen with "inspect element", blue boxes are existing links, red box is the dismissed growl. Inside the blue box, we can't click the part that is covered by the red box.