问:
Git changes to a visual studio .csproj file don't reflect as changes to the origin. Why?

On master branch, I did a git pull to get the latest changes to master

Then I did git checkout -b new_branch

On this branch I deleted a few lines to a .csproj file

The diff showed the correct change, i.e.

zach@DESKTOP...:<path>$ git diff master, showed:

```<code>diff --git a/<path>.csproj
index 58a5da4..8062eb5 100644
--- a/<path>.csproj
+++ b/<path>.csproj
@@ -79,9 +79,6 @@
     <None Include="App.config">
       <SubType>Designer</SubType>
     </None>
-    <None Include="env-config.json">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="<path>.csproj">
</code>```

Then I ran git add .

Then I ran git commit -m "new changes added"

Then I ran git push

At this point I expected to be prompted to --set-upstream a path. But instead I got back a message that said everything was up-to-date.

Looking at the source on Bitbucket, neither the new branch with the recently committed change, nor the change itself in the master branch appeared.

Why is this?

I should note that I'm using the Windows 10 implementation of bash (i.e. a virtualized Ubuntu 14.04 machine), but changes to regular source code seem to work fine.

I'm also running Windows 10 Home on an Apple by Bootcamp.

答:
Have you verified your gitignore file to be sure it's not ignoring csproj files?

If it's there you'll want to remove it, a csproj file should definitely go to the repository.

Body:
On master branch, I did a git pull to get the latest changes to master

Then I did git checkout -b new_branch

On this branch I deleted a few lines to a .csproj file

The diff showed the correct change, i.e.

zach@DESKTOP...:<path>$ git diff master, showed:

diff --git a/<path>.csproj
index 58a5da4..8062eb5 100644
--- a/<path>.csproj
+++ b/<path>.csproj
@@ -79,9 +79,6 @@
     <None Include="App.config">
       <SubType>Designer</SubType>
     </None>
-    <None Include="env-config.json">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="<path>.csproj">

Then I ran git add .

Then I ran git commit -m "new changes added"

Then I ran git push

At this point I expected to be prompted to --set-upstream a path. But instead I got back a message that said everything was up-to-date.

Looking at the source on Bitbucket, neither the new branch with the recently committed change, nor the change itself in the master branch appeared.

Why is this?

I should note that I'm using the Windows 10 implementation of bash (i.e. a virtualized Ubuntu 14.04 machine), but changes to regular source code seem to work fine.

I'm also running Windows 10 Home on an Apple by Bootcamp.


来源: stackexchange

问:
Pseudo elemnt "before" onhover does not work
Hi I want to create a faq page, I found a sample and tried to customize it and learn from it. Whenever I hover over the menu items, a little green rectangle should appear on the left side of the menu. But this does not happen in my code, am I missing anything?
The HTML Code:

jQuery(document).ready(function($) {
  //update these values if you change these breakpoints in the style.css file (or _layout.scss if you use SASS)
  var MqM = 768,
    MqL = 1024;

  var faqsSections = $('.cd-faq-group'),
    faqTrigger = $('.cd-faq-trigger'),
    faqsContainer = $('.cd-faq-items'),
    faqsCategoriesContainer = $('.cd-faq-categories'),
    faqsCategories = faqsCategoriesContainer.find('a'),
    closeFaqsContainer = $('.cd-close-panel');

  //select a faq section
  faqsCategories.on('click', function(event) {
    event.preventDefault();
    var selectedHref = $(this).attr('href'),
      target = $(selectedHref);
    if ($(window).width() < MqM) {
      faqsContainer.scrollTop(0).addClass('slide-in').children('ul').removeClass('selected').end().children(selectedHref).addClass('selected');
      closeFaqsContainer.addClass('move-left');
      $('body').addClass('cd-overlay');
    } else {
      $('body,html').animate({
        'scrollTop': target.offset().top - 19
      }, 200);
    }
  });

  //close faq lateral panel - mobile only
  $('body').bind('click touchstart', function(event) {
    if ($(event.target).is('body.cd-overlay') || $(event.target).is('.cd-close-panel')) {
      closePanel(event);
    }
  });
  faqsContainer.on('swiperight', function(event) {
    closePanel(event);
  });

  //show faq content clicking on faqTrigger
  faqTrigger.on('click', function(event) {
    event.preventDefault();
    $(this).next('.cd-faq-content').slideToggle(200).end().parent('li').toggleClass('content-visible');
  });

  //update category sidebar while scrolling
  $(window).on('scroll', function() {
    if ($(window).width() > MqL) {
      (!window.requestAnimationFrame) ? updateCategory(): window.requestAnimationFrame(updateCategory);
    }
  });

  $(window).on('resize', function() {
    if ($(window).width() <= MqL) {
      faqsCategoriesContainer.removeClass('is-fixed').css({
        '-moz-transform': 'translateY(0)',
        '-webkit-transform': 'translateY(0)',
        '-ms-transform': 'translateY(0)',
        '-o-transform': 'translateY(0)',
        'transform': 'translateY(0)',
      });
    }
    if (faqsCategoriesContainer.hasClass('is-fixed')) {
      faqsCategoriesContainer.css({
        'left': faqsContainer.offset().left,
      });
    }
  });

  function closePanel(e) {
    e.preventDefault();
    faqsContainer.removeClass('slide-in').find('li').show();
    closeFaqsContainer.removeClass('move-left');
    $('body').removeClass('cd-overlay');
  }

  function updateCategory() {
    updateCategoryPosition();
    updateSelectedCategory();
  }

  function updateCategoryPosition() {
    var top = $('.cd-faq').offset().top,
      height = jQuery('.cd-faq').height() - jQuery('.cd-faq-categories').height(),
      margin = 20;
    if (top - margin <= $(window).scrollTop() && top - margin + height > $(window).scrollTop()) {
      var leftValue = faqsCategoriesContainer.offset().left,
        widthValue = faqsCategoriesContainer.width();
      faqsCategoriesContainer.addClass('is-fixed').css({
        'left': leftValue,
        'top': margin,
        '-moz-transform': 'translateZ(0)',
        '-webkit-transform': 'translateZ(0)',
        '-ms-transform': 'translateZ(0)',
        '-o-transform': 'translateZ(0)',
        'transform': 'translateZ(0)',
      });
    } else if (top - margin + height <= $(window).scrollTop()) {
      var delta = top - margin + height - $(window).scrollTop();
      faqsCategoriesContainer.css({
        '-moz-transform': 'translateZ(0) translateY(' + delta + 'px)',
        '-webkit-transform': 'translateZ(0) translateY(' + delta + 'px)',
        '-ms-transform': 'translateZ(0) translateY(' + delta + 'px)',
        '-o-transform': 'translateZ(0) translateY(' + delta + 'px)',
        'transform': 'translateZ(0) translateY(' + delta + 'px)',
      });
    } else {
      faqsCategoriesContainer.removeClass('is-fixed').css({
        'left': 0,
        'top': 0,
      });
    }
  }

  function updateSelectedCategory() {
    faqsSections.each(function() {
      var actual = $(this),
        margin = parseInt($('.cd-faq-title').eq(1).css('marginTop').replace('px', '')),
        activeCategory = $('.cd-faq-categories a[href="#' + actual.attr('id') + '"]'),
        topSection = (activeCategory.parent('li').is(':first-child')) ? 0 : Math.round(actual.offset().top);

      if ((topSection - 20 <= $(window).scrollTop()) && (Math.round(actual.offset().top) + actual.height() + margin - 20 > $(window).scrollTop())) {
        activeCategory.addClass('selected');
      } else {
        activeCategory.removeClass('selected');
      }
    });
  }
});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>/* --------------------------------

Primary style

-------------------------------- */
*, *::after, *::before {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

*::after, *::before {
  content: '';
}

body {
  font-size: 100%;
  font-family: "Open Sans", sans-serif;
  color: #4e5359;
  background-color: #f3f3f5;
}
body::after {
  /* overlay layer visible on small devices when the right panel slides in */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(78, 83, 89, 0.8);
  visibility: hidden;
  opacity: 0;
  -webkit-transition: opacity .3s 0s, visibility 0s .3s;
  -moz-transition: opacity .3s 0s, visibility 0s .3s;
  transition: opacity .3s 0s, visibility 0s .3s;
}
body.cd-overlay::after {
  visibility: visible;
  opacity: 1;
  -webkit-transition: opacity .3s 0s, visibility 0s 0s;
  -moz-transition: opacity .3s 0s, visibility 0s 0s;
  transition: opacity .3s 0s, visibility 0s 0s;
}
@media only screen and (min-width: 768px) {
  body::after {
    display: none;
  }
}

a {
  color: #a9c056;
  text-decoration: none;
}

/* --------------------------------

Main components

-------------------------------- */
header {
  position: relative;
  height: 180px;
  line-height: 180px;
  text-align: center;
  background-color: #a9c056;
}
header h1 {
  color: #ffffff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 20px;
  font-size: 1.25rem;
}
@media only screen and (min-width: 1024px) {
  header {
    height: 240px;
    line-height: 240px;
  }
  header h1 {
    font-size: 36px;
    font-size: 2.25rem;
    font-weight: 300;
  }
}

.cd-faq {
  width: 90%;
  max-width: 1024px;
  margin: 2em auto;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}
.cd-faq:after {
  content: "";
  display: table;
  clear: both;
}
@media only screen and (min-width: 768px) {
  .cd-faq {
    position: relative;
    margin: 4em auto;
    box-shadow: none;
  }
}

.cd-faq-categories a {
  position: relative;
  display: block;
  overflow: hidden;
  height: 50px;
  line-height: 50px;
  padding: 0 28px 0 16px;
  background-color: #4e5359;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #ffffff;
  white-space: nowrap;
  border-bottom: 1px solid #555b61;
  text-overflow: ellipsis;
}
.cd-faq-categories a::before, .cd-faq-categories a::after {
  /* plus icon on the right */
  position: absolute;
  top: 50%;
  right: 16px;
  display: inline-block;
  height: 1px;
  width: 10px;
  background-color: #7f868e;
}
.cd-faq-categories a::after {
  -webkit-transform: rotate(90deg);
  -moz-transform: rotate(90deg);
  -ms-transform: rotate(90deg);
  -o-transform: rotate(90deg);
  transform: rotate(90deg);
}
.cd-faq-categories li:last-child a {
  border-bottom: none;
}
@media only screen and (min-width: 768px) {
  .cd-faq-categories {
    width: 20%;
    float: left;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  }
  .cd-faq-categories a {
    font-size: 13px;
    font-size: 0.8125rem;
    font-weight: 600;
    padding-left: 24px;
    padding: 0 24px;
    -webkit-transition: background 0.2s, padding 0.2s;
    -moz-transition: background 0.2s, padding 0.2s;
    transition: background 0.2s, padding 0.2s;
  }
  .cd-faq-categories a::before, .cd-faq-categories a::after {
    display: none;
  }
  .no-touch .cd-faq-categories a:hover {
    background: #555b61;
  }
  .no-js .cd-faq-categories {
    width: 100%;
    margin-bottom: 2em;
  }
}
@media only screen and (min-width: 1024px) {
  .cd-faq-categories {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    z-index: 2;
  }
  .cd-faq-categories a::before {
    /* decorative rectangle on the left visible for the selected item */
    display: block;
    top: 0;
    right: auto;
    left: 0;
    height: 100%;
    width: 3px;
    background-color: #a9c056;
    opacity: 0;
    -webkit-transition: opacity 0.2s;
    -moz-transition: opacity 0.2s;
    transition: opacity 0.2s;
  }
  .cd-faq-categories .selected {
    background: #42464b !important;
  }
  .cd-faq-categories .selected::before {
    opacity: 1;
  }
  .cd-faq-categories.is-fixed {
    /* top and left value assigned in jQuery */
    position: fixed;
  }
  .no-js .cd-faq-categories {
    position: relative;
  }
}

.cd-faq-items {
  position: fixed;
  height: 100%;
  width: 90%;
  top: 0;
  right: 0;
  background: #ffffff;
  padding: 0 5% 1em;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 1;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(0) translateX(100%);
  -moz-transform: translateZ(0) translateX(100%);
  -ms-transform: translateZ(0) translateX(100%);
  -o-transform: translateZ(0) translateX(100%);
  transform: translateZ(0) translateX(100%);
  -webkit-transition: -webkit-transform .3s;
  -moz-transition: -moz-transform .3s;
  transition: transform .3s;
}
.cd-faq-items.slide-in {
  -webkit-transform: translateZ(0) translateX(0%);
  -moz-transform: translateZ(0) translateX(0%);
  -ms-transform: translateZ(0) translateX(0%);
  -o-transform: translateZ(0) translateX(0%);
  transform: translateZ(0) translateX(0%);
}
.no-js .cd-faq-items {
  position: static;
  height: auto;
  width: 100%;
  -webkit-transform: translateX(0);
  -moz-transform: translateX(0);
  -ms-transform: translateX(0);
  -o-transform: translateX(0);
  transform: translateX(0);
}
@media only screen and (min-width: 768px) {
  .cd-faq-items {
    position: static;
    height: auto;
    width: 78%;
    float: right;
    overflow: visible;
    -webkit-transform: translateZ(0) translateX(0);
    -moz-transform: translateZ(0) translateX(0);
    -ms-transform: translateZ(0) translateX(0);
    -o-transform: translateZ(0) translateX(0);
    transform: translateZ(0) translateX(0);
    padding: 0;
    background: transparent;
  }
}
@media only screen and (min-width: 1024px) {
  .cd-faq-items {
    float: none;
    width: 100%;
    padding-left: 220px;
  }
  .no-js .cd-faq-items {
    padding-left: 0;
  }
}

.cd-close-panel {
  position: fixed;
  top: 5px;
  right: -100%;
  display: block;
  height: 40px;
  width: 40px;
  overflow: hidden;
  text-indent: 100%;
  white-space: nowrap;
  z-index: 2;
  /* Force Hardware Acceleration in WebKit */
  -webkit-transform: translateZ(0);
  -moz-transform: translateZ(0);
  -ms-transform: translateZ(0);
  -o-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transition: right 0.4s;
  -moz-transition: right 0.4s;
  transition: right 0.4s;
}
.cd-close-panel::before, .cd-close-panel::after {
  /* close icon in CSS */
  position: absolute;
  top: 16px;
  left: 12px;
  display: inline-block;
  height: 3px;
  width: 18px;
  background: #6c7d8e;
}
.cd-close-panel::before {
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  -o-transform: rotate(45deg);
  transform: rotate(45deg);
}
.cd-close-panel::after {
  -webkit-transform: rotate(-45deg);
  -moz-transform: rotate(-45deg);
  -ms-transform: rotate(-45deg);
  -o-transform: rotate(-45deg);
  transform: rotate(-45deg);
}
.cd-close-panel.move-left {
  right: 2%;
}
@media only screen and (min-width: 768px) {
  .cd-close-panel {
    display: none;
  }
}

.cd-faq-group {
  /* hide group not selected */
  display: none;
}
.cd-faq-group.selected {
  display: block;
}
.cd-faq-group .cd-faq-title {
  background: transparent;
  box-shadow: none;
  margin: 1em 0;
}
.no-touch .cd-faq-group .cd-faq-title:hover {
  box-shadow: none;
}
.cd-faq-group .cd-faq-title h2 {
  text-transform: uppercase;
  font-size: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #bbbbc7;
}
.no-js .cd-faq-group {
  display: block;
}
@media only screen and (min-width: 768px) {
  .cd-faq-group {
    /* all groups visible */
    display: block;
  }
  .cd-faq-group > li {
    background: #ffffff;
    margin-bottom: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    -webkit-transition: box-shadow 0.2s;
    -moz-transition: box-shadow 0.2s;
    transition: box-shadow 0.2s;
  }
  .no-touch .cd-faq-group > li:hover {
    box-shadow: 0 1px 10px rgba(108, 125, 142, 0.3);
  }
  .cd-faq-group .cd-faq-title {
    margin: 2em 0 1em;
  }
  .cd-faq-group:first-child .cd-faq-title {
    margin-top: 0;
  }
}

.cd-faq-trigger {
  position: relative;
  display: block;
  margin: 1.6em 0 .4em;
  line-height: 1.2;
}
@media only screen and (min-width: 768px) {
  .cd-faq-trigger {
    font-size: 24px;
    font-size: 1.5rem;
    font-weight: 300;
    margin: 0;
    padding: 24px 72px 24px 24px;
  }
  .cd-faq-trigger::before, .cd-faq-trigger::after {
    /* arrow icon on the right */
    position: absolute;
    right: 24px;
    top: 50%;
    height: 2px;
    width: 13px;
    background: #cfdca0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transition-property: -webkit-transform;
    -moz-transition-property: -moz-transform;
    transition-property: transform;
    -webkit-transition-duration: 0.2s;
    -moz-transition-duration: 0.2s;
    transition-duration: 0.2s;
  }
  .cd-faq-trigger::before {
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg);
    right: 32px;
  }
  .cd-faq-trigger::after {
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);
  }
  .content-visible .cd-faq-trigger::before {
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);
  }
  .content-visible .cd-faq-trigger::after {
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg);
  }
}

.cd-faq-content p {
  font-size: 14px;
  font-size: 0.875rem;
  line-height: 1.4;
  color: #6c7d8e;
}
@media only screen and (min-width: 768px) {
  .cd-faq-content {
    display: none;
    padding: 0 24px 30px;
  }
  .cd-faq-content p {
    line-height: 1.6;
  }
  .no-js .cd-faq-content {
    display: block;
  }
}</code>```

<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Title</title>

  <link rel="stylesheet" href="style.css">

Basics

Mobile

Account

Basics

        How do I change my password?

Lorem .

Mobile

        How does syncing work?

Lorem

        Close

```

答:
Check out this codepen example.  Just as Michael has mentioned, you need to adhere the pseudo-selector with hover.

Ex.

```<code>.element:before:hover{transform:rotateX(180deg);}
</code>```

https://codepen.io/larrygeams/pen/pdchG

ContentLicense: CC BY-SA 3.0

Body:
Hi I want to create a faq page, I found a sample and tried to customize it and learn from it. Whenever I hover over the menu items, a little green rectangle should appear on the left side of the menu. But this does not happen in my code, am I missing anything?
The HTML Code:

jQuery(document).ready(function($) {
  //update these values if you change these breakpoints in the style.css file (or _layout.scss if you use SASS)
  var MqM = 768,
    MqL = 1024;

  var faqsSections = $('.cd-faq-group'),
    faqTrigger = $('.cd-faq-trigger'),
    faqsContainer = $('.cd-faq-items'),
    faqsCategoriesContainer = $('.cd-faq-categories'),
    faqsCategories = faqsCategoriesContainer.find('a'),
    closeFaqsContainer = $('.cd-close-panel');

  //select a faq section
  faqsCategories.on('click', function(event) {
    event.preventDefault();
    var selectedHref = $(this).attr('href'),
      target = $(selectedHref);
    if ($(window).width() < MqM) {
      faqsContainer.scrollTop(0).addClass('slide-in').children('ul').removeClass('selected').end().children(selectedHref).addClass('selected');
      closeFaqsContainer.addClass('move-left');
      $('body').addClass('cd-overlay');
    } else {
      $('body,html').animate({
        'scrollTop': target.offset().top - 19
      }, 200);
    }
  });

  //close faq lateral panel - mobile only
  $('body').bind('click touchstart', function(event) {
    if ($(event.target).is('body.cd-overlay') || $(event.target).is('.cd-close-panel')) {
      closePanel(event);
    }
  });
  faqsContainer.on('swiperight', function(event) {
    closePanel(event);
  });

  //show faq content clicking on faqTrigger
  faqTrigger.on('click', function(event) {
    event.preventDefault();
    $(this).next('.cd-faq-content').slideToggle(200).end().parent('li').toggleClass('content-visible');
  });

  //update category sidebar while scrolling
  $(window).on('scroll', function() {
    if ($(window).width() > MqL) {
      (!window.requestAnimationFrame) ? updateCategory(): window.requestAnimationFrame(updateCategory);
    }
  });

  $(window).on('resize', function() {
    if ($(window).width() <= MqL) {
      faqsCategoriesContainer.removeClass('is-fixed').css({
        '-moz-transform': 'translateY(0)',
        '-webkit-transform': 'translateY(0)',
        '-ms-transform': 'translateY(0)',
        '-o-transform': 'translateY(0)',
        'transform': 'translateY(0)',
      });
    }
    if (faqsCategoriesContainer.hasClass('is-fixed')) {
      faqsCategoriesContainer.css({
        'left': faqsContainer.offset().left,
      });
    }
  });

  function closePanel(e) {
    e.preventDefault();
    faqsContainer.removeClass('slide-in').find('li').show();
    closeFaqsContainer.removeClass('move-left');
    $('body').removeClass('cd-overlay');
  }

  function updateCategory() {
    updateCategoryPosition();
    updateSelectedCategory();
  }

  function updateCategoryPosition() {
    var top = $('.cd-faq').offset().top,
      height = jQuery('.cd-faq').height() - jQuery('.cd-faq-categories').height(),
      margin = 20;
    if (top - margin <= $(window).scrollTop() && top - margin + height > $(window).scrollTop()) {
      var leftValue = faqsCategoriesContainer.offset().left,
        widthValue = faqsCategoriesContainer.width();
      faqsCategoriesContainer.addClass('is-fixed').css({
        'left': leftValue,
        'top': margin,
        '-moz-transform': 'translateZ(0)',
        '-webkit-transform': 'translateZ(0)',
        '-ms-transform': 'translateZ(0)',
        '-o-transform': 'translateZ(0)',
        'transform': 'translateZ(0)',
      });
    } else if (top - margin + height <= $(window).scrollTop()) {
      var delta = top - margin + height - $(window).scrollTop();
      faqsCategoriesContainer.css({
        '-moz-transform': 'translateZ(0) translateY(' + delta + 'px)',
        '-webkit-transform': 'translateZ(0) translateY(' + delta + 'px)',
        '-ms-transform': 'translateZ(0) translateY(' + delta + 'px)',
        '-o-transform': 'translateZ(0) translateY(' + delta + 'px)',
        'transform': 'translateZ(0) translateY(' + delta + 'px)',
      });
    } else {
      faqsCategoriesContainer.removeClass('is-fixed').css({
        'left': 0,
        'top': 0,
      });
    }
  }

  function updateSelectedCategory() {
    faqsSections.each(function() {
      var actual = $(this),
        margin = parseInt($('.cd-faq-title').eq(1).css('marginTop').replace('px', '')),
        activeCategory = $('.cd-faq-categories a[href="#' + actual.attr('id') + '"]'),
        topSection = (activeCategory.parent('li').is(':first-child')) ? 0 : Math.round(actual.offset().top);

      if ((topSection - 20 <= $(window).scrollTop()) && (Math.round(actual.offset().top) + actual.height() + margin - 20 > $(window).scrollTop())) {
        activeCategory.addClass('selected');
      } else {
        activeCategory.removeClass('selected');
      }
    });
  }
});

/* --------------------------------

Primary style

-------------------------------- */
*, *::after, *::before {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

*::after, *::before {
  content: '';
}

body {
  font-size: 100%;
  font-family: "Open Sans", sans-serif;
  color: #4e5359;
  background-color: #f3f3f5;
}
body::after {
  /* overlay layer visible on small devices when the right panel slides in */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(78, 83, 89, 0.8);
  visibility: hidden;
  opacity: 0;
  -webkit-transition: opacity .3s 0s, visibility 0s .3s;
  -moz-transition: opacity .3s 0s, visibility 0s .3s;
  transition: opacity .3s 0s, visibility 0s .3s;
}
body.cd-overlay::after {
  visibility: visible;
  opacity: 1;
  -webkit-transition: opacity .3s 0s, visibility 0s 0s;
  -moz-transition: opacity .3s 0s, visibility 0s 0s;
  transition: opacity .3s 0s, visibility 0s 0s;
}
@media only screen and (min-width: 768px) {
  body::after {
    display: none;
  }
}

a {
  color: #a9c056;
  text-decoration: none;
}

/* --------------------------------

Main components

-------------------------------- */
header {
  position: relative;
  height: 180px;
  line-height: 180px;
  text-align: center;
  background-color: #a9c056;
}
header h1 {
  color: #ffffff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 20px;
  font-size: 1.25rem;
}
@media only screen and (min-width: 1024px) {
  header {
    height: 240px;
    line-height: 240px;
  }
  header h1 {
    font-size: 36px;
    font-size: 2.25rem;
    font-weight: 300;
  }
}

.cd-faq {
  width: 90%;
  max-width: 1024px;
  margin: 2em auto;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}
.cd-faq:after {
  content: "";
  display: table;
  clear: both;
}
@media only screen and (min-width: 768px) {
  .cd-faq {
    position: relative;
    margin: 4em auto;
    box-shadow: none;
  }
}

.cd-faq-categories a {
  position: relative;
  display: block;
  overflow: hidden;
  height: 50px;
  line-height: 50px;
  padding: 0 28px 0 16px;
  background-color: #4e5359;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #ffffff;
  white-space: nowrap;
  border-bottom: 1px solid #555b61;
  text-overflow: ellipsis;
}
.cd-faq-categories a::before, .cd-faq-categories a::after {
  /* plus icon on the right */
  position: absolute;
  top: 50%;
  right: 16px;
  display: inline-block;
  height: 1px;
  width: 10px;
  background-color: #7f868e;
}
.cd-faq-categories a::after {
  -webkit-transform: rotate(90deg);
  -moz-transform: rotate(90deg);
  -ms-transform: rotate(90deg);
  -o-transform: rotate(90deg);
  transform: rotate(90deg);
}
.cd-faq-categories li:last-child a {
  border-bottom: none;
}
@media only screen and (min-width: 768px) {
  .cd-faq-categories {
    width: 20%;
    float: left;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  }
  .cd-faq-categories a {
    font-size: 13px;
    font-size: 0.8125rem;
    font-weight: 600;
    padding-left: 24px;
    padding: 0 24px;
    -webkit-transition: background 0.2s, padding 0.2s;
    -moz-transition: background 0.2s, padding 0.2s;
    transition: background 0.2s, padding 0.2s;
  }
  .cd-faq-categories a::before, .cd-faq-categories a::after {
    display: none;
  }
  .no-touch .cd-faq-categories a:hover {
    background: #555b61;
  }
  .no-js .cd-faq-categories {
    width: 100%;
    margin-bottom: 2em;
  }
}
@media only screen and (min-width: 1024px) {
  .cd-faq-categories {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    z-index: 2;
  }
  .cd-faq-categories a::before {
    /* decorative rectangle on the left visible for the selected item */
    display: block;
    top: 0;
    right: auto;
    left: 0;
    height: 100%;
    width: 3px;
    background-color: #a9c056;
    opacity: 0;
    -webkit-transition: opacity 0.2s;
    -moz-transition: opacity 0.2s;
    transition: opacity 0.2s;
  }
  .cd-faq-categories .selected {
    background: #42464b !important;
  }
  .cd-faq-categories .selected::before {
    opacity: 1;
  }
  .cd-faq-categories.is-fixed {
    /* top and left value assigned in jQuery */
    position: fixed;
  }
  .no-js .cd-faq-categories {
    position: relative;
  }
}

.cd-faq-items {
  position: fixed;
  height: 100%;
  width: 90%;
  top: 0;
  right: 0;
  background: #ffffff;
  padding: 0 5% 1em;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 1;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(0) translateX(100%);
  -moz-transform: translateZ(0) translateX(100%);
  -ms-transform: translateZ(0) translateX(100%);
  -o-transform: translateZ(0) translateX(100%);
  transform: translateZ(0) translateX(100%);
  -webkit-transition: -webkit-transform .3s;
  -moz-transition: -moz-transform .3s;
  transition: transform .3s;
}
.cd-faq-items.slide-in {
  -webkit-transform: translateZ(0) translateX(0%);
  -moz-transform: translateZ(0) translateX(0%);
  -ms-transform: translateZ(0) translateX(0%);
  -o-transform: translateZ(0) translateX(0%);
  transform: translateZ(0) translateX(0%);
}
.no-js .cd-faq-items {
  position: static;
  height: auto;
  width: 100%;
  -webkit-transform: translateX(0);
  -moz-transform: translateX(0);
  -ms-transform: translateX(0);
  -o-transform: translateX(0);
  transform: translateX(0);
}
@media only screen and (min-width: 768px) {
  .cd-faq-items {
    position: static;
    height: auto;
    width: 78%;
    float: right;
    overflow: visible;
    -webkit-transform: translateZ(0) translateX(0);
    -moz-transform: translateZ(0) translateX(0);
    -ms-transform: translateZ(0) translateX(0);
    -o-transform: translateZ(0) translateX(0);
    transform: translateZ(0) translateX(0);
    padding: 0;
    background: transparent;
  }
}
@media only screen and (min-width: 1024px) {
  .cd-faq-items {
    float: none;
    width: 100%;
    padding-left: 220px;
  }
  .no-js .cd-faq-items {
    padding-left: 0;
  }
}

.cd-close-panel {
  position: fixed;
  top: 5px;
  right: -100%;
  display: block;
  height: 40px;
  width: 40px;
  overflow: hidden;
  text-indent: 100%;
  white-space: nowrap;
  z-index: 2;
  /* Force Hardware Acceleration in WebKit */
  -webkit-transform: translateZ(0);
  -moz-transform: translateZ(0);
  -ms-transform: translateZ(0);
  -o-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transition: right 0.4s;
  -moz-transition: right 0.4s;
  transition: right 0.4s;
}
.cd-close-panel::before, .cd-close-panel::after {
  /* close icon in CSS */
  position: absolute;
  top: 16px;
  left: 12px;
  display: inline-block;
  height: 3px;
  width: 18px;
  background: #6c7d8e;
}
.cd-close-panel::before {
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  -o-transform: rotate(45deg);
  transform: rotate(45deg);
}
.cd-close-panel::after {
  -webkit-transform: rotate(-45deg);
  -moz-transform: rotate(-45deg);
  -ms-transform: rotate(-45deg);
  -o-transform: rotate(-45deg);
  transform: rotate(-45deg);
}
.cd-close-panel.move-left {
  right: 2%;
}
@media only screen and (min-width: 768px) {
  .cd-close-panel {
    display: none;
  }
}

.cd-faq-group {
  /* hide group not selected */
  display: none;
}
.cd-faq-group.selected {
  display: block;
}
.cd-faq-group .cd-faq-title {
  background: transparent;
  box-shadow: none;
  margin: 1em 0;
}
.no-touch .cd-faq-group .cd-faq-title:hover {
  box-shadow: none;
}
.cd-faq-group .cd-faq-title h2 {
  text-transform: uppercase;
  font-size: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #bbbbc7;
}
.no-js .cd-faq-group {
  display: block;
}
@media only screen and (min-width: 768px) {
  .cd-faq-group {
    /* all groups visible */
    display: block;
  }
  .cd-faq-group > li {
    background: #ffffff;
    margin-bottom: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    -webkit-transition: box-shadow 0.2s;
    -moz-transition: box-shadow 0.2s;
    transition: box-shadow 0.2s;
  }
  .no-touch .cd-faq-group > li:hover {
    box-shadow: 0 1px 10px rgba(108, 125, 142, 0.3);
  }
  .cd-faq-group .cd-faq-title {
    margin: 2em 0 1em;
  }
  .cd-faq-group:first-child .cd-faq-title {
    margin-top: 0;
  }
}

.cd-faq-trigger {
  position: relative;
  display: block;
  margin: 1.6em 0 .4em;
  line-height: 1.2;
}
@media only screen and (min-width: 768px) {
  .cd-faq-trigger {
    font-size: 24px;
    font-size: 1.5rem;
    font-weight: 300;
    margin: 0;
    padding: 24px 72px 24px 24px;
  }
  .cd-faq-trigger::before, .cd-faq-trigger::after {
    /* arrow icon on the right */
    position: absolute;
    right: 24px;
    top: 50%;
    height: 2px;
    width: 13px;
    background: #cfdca0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transition-property: -webkit-transform;
    -moz-transition-property: -moz-transform;
    transition-property: transform;
    -webkit-transition-duration: 0.2s;
    -moz-transition-duration: 0.2s;
    transition-duration: 0.2s;
  }
  .cd-faq-trigger::before {
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg);
    right: 32px;
  }
  .cd-faq-trigger::after {
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);
  }
  .content-visible .cd-faq-trigger::before {
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);
  }
  .content-visible .cd-faq-trigger::after {
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg);
  }
}

.cd-faq-content p {
  font-size: 14px;
  font-size: 0.875rem;
  line-height: 1.4;
  color: #6c7d8e;
}
@media only screen and (min-width: 768px) {
  .cd-faq-content {
    display: none;
    padding: 0 24px 30px;
  }
  .cd-faq-content p {
    line-height: 1.6;
  }
  .no-js .cd-faq-content {
    display: block;
  }
}

<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Title</title>

  <link rel="stylesheet" href="style.css">

Basics

Mobile

Account

Basics

        How do I change my password?

Lorem .

Mobile

        How does syncing work?

Lorem

        Close

Body:
Check out this codepen example.  Just as Michael has mentioned, you need to adhere the pseudo-selector with hover.

Ex.

.element:before:hover{transform:rotateX(180deg);}

https://codepen.io/larrygeams/pen/pdchG


问:
Bash/Linux if elif else issue
Currently working on my bash skills. I've done a few activites based on if/elif/else given to me to my tutor but can't put my finger on the one below.

Basically I'm tasked with outputting the following based on the input of a grade.
 Less than 40% = Fail 40% to 59% = Pass 60% to 69% = Merit 70% and above = Distinction

It seems to get caught on the first elif, presents the grade as merit for anything below 70 and doesn't check the others, it gives the same result when I change the order too.

```<code>echo "Please enter your grade"
read GRADE
echo

     if [ $GRADE -ge 70 ]; then
         echo "Well done, you got a distinction"

    elif [ $GRADE -ge 60 ] || [ $GRADE -le 69 ]; then
          echo "Well done, you got a merit"
    elif [ $GRADE -ge 40 ] || [ $GRADE -le 59 ]; then
          echo "Well done, you got a pass"
    else
          echo "Unfortunately you failed"
      fi
</code>```

答:
A bit unusual solution</p>

```<code>#bash 4.0+
while read -r -p 'Grade? (h-help)> ' grade
do
    case "$grade" in
        q) echo "quitting..." ; exit 0 ;;
        h) echo "Enter numeric value (0..100) or q for quit" ;&
        '') continue ;;
        *[!0-9]*) echo "Must be numeric value" ; continue ;;
    esac
    case 1 in
        $((grade > 100)) ) echo "impossible" ;;
        $((grade >= 70)) ) echo "distinction" ;;
        $((grade >= 60)) ) echo "merit" ;;
        $((grade >= 40)) ) echo "pass" ;;
                        *) echo "fail" ;;
    esac
done
</code>```

Title: Bash/Linux if elif else issue

Body:
Currently working on my bash skills. I've done a few activites based on if/elif/else given to me to my tutor but can't put my finger on the one below.

Basically I'm tasked with outputting the following based on the input of a grade.
 Less than 40% = Fail 40% to 59% = Pass 60% to 69% = Merit 70% and above = Distinction

It seems to get caught on the first elif, presents the grade as merit for anything below 70 and doesn't check the others, it gives the same result when I change the order too.

echo "Please enter your grade"
read GRADE
echo

     if [ $GRADE -ge 70 ]; then
         echo "Well done, you got a distinction"

    elif [ $GRADE -ge 60 ] || [ $GRADE -le 69 ]; then
          echo "Well done, you got a merit"
    elif [ $GRADE -ge 40 ] || [ $GRADE -le 59 ]; then
          echo "Well done, you got a pass"
    else
          echo "Unfortunately you failed"
      fi

Body:
A bit unusual solution

#bash 4.0+
while read -r -p 'Grade? (h-help)> ' grade
do
    case "$grade" in
        q) echo "quitting..." ; exit 0 ;;
        h) echo "Enter numeric value (0..100) or q for quit" ;&
        '') continue ;;
        *[!0-9]*) echo "Must be numeric value" ; continue ;;
    esac
    case 1 in
        $((grade > 100)) ) echo "impossible" ;;
        $((grade >= 70)) ) echo "distinction" ;;
        $((grade >= 60)) ) echo "merit" ;;
        $((grade >= 40)) ) echo "pass" ;;
                        *) echo "fail" ;;
    esac
done


问:
'laravel' is not recognized as an internal or external command?
I am trying to install laravel on windows.
after downloading laravel via composer

I tried to run laravel new command but I get this error:

```<code>'laravel' is not recognized as an internal or external command, operable program or batch file.
</code>```

I changed the environment variables but still cant run the command unless I go to the path and run it from there.

答:
Instead of adding a new variable, you have to add the path to laravel to the PATH variable:

```<code><old value of path variable>; C:\vendor\bin
</code>```

Body:
I am trying to install laravel on windows.
after downloading laravel via composer

I tried to run laravel new command but I get this error:

'laravel' is not recognized as an internal or external command, operable program or batch file.

I changed the environment variables but still cant run the command unless I go to the path and run it from there.

Body:
Instead of adding a new variable, you have to add the path to laravel to the PATH variable:

<old value of path variable>; C:\vendor\bin


问:
To assign var to name attribute of input tag using javascript
Here I am trying to store medicines given by doctor via html form.
By taking an input as text in cells of a dynamic table, I want to append some counter to the name tag of the input cell by using javascript but unable to do so.I want to create new input tag with attr name as prsc+counter-value
so can u please help me

```<code><table id="myTable">
  <tr>
    <td><input type="text" name="prsc0"></td>
  </tr>
  <tr>
    <td><input type="text" name="prsc1"></td>
  </tr>
  <tr>
    <td><input type="text" name="prsc2"></td>
  </tr>
</code>```

```<code><button onclick="myCreateFunction()">Create row</button>
<button onclick="myDeleteFunction()">Delete row</button>

<script>
 var counter=3;
 function myCreateFunction() {
     var table = document.getElementById("myTable");
     var row = table.insertRow(0);
     var cell1 = row.insertCell(0);
     counter=counter+1;
     var presc="prsc"+""+counter;
     cell1.innerHTML = '<input type="text" name=presc>';

 }

function myDeleteFunction() {
    document.getElementById("myTable").deleteRow(0);
}
</script>
</code>```

答:
```<code>function counter (){
     for(i=0; i<document.querySelectorAll('input').length; i++){
        document.querySelectorAll('input')[i].name=`prsc${i}`;
     }
}
</code>```

Body:
Here I am trying to store medicines given by doctor via html form.
By taking an input as text in cells of a dynamic table, I want to append some counter to the name tag of the input cell by using javascript but unable to do so.I want to create new input tag with attr name as prsc+counter-value
so can u please help me

    <input type="text" name="prsc0">

    <input type="text" name="prsc1">

    <input type="text" name="prsc2">

<button onclick="myCreateFunction()">Create row</button>
<button onclick="myDeleteFunction()">Delete row</button>


问:
mySql select unique number for every 3 records
I'm trying to get a unique number in 'row' column for every {variable} 3 records. (So I know we have these 3 skus on the first row etc.)

Like this:

```<code>line    sku   row
1       aaa   1
2       abb   1
3       abc   1
4       acc   2
5       acb   2
6       aab   2
7       acc   3
8       acb   3
9       aab   3
</code>```

So what I have is the following

```<code>SET @rank=0;
SET @rows=3;

 select @rank:=@rank+1 AS line, sku, mod( @rank+1, @rows) 'row'
</code>```

But column 'row' is not as expected.

Thank you

答:
Here give this a go. If i have understood you problem correctly.</p>

```<code>SET @rank = 0;
SET @rows = 3;
SET @count = 0;

select @rank:=@rank+1 AS line, sku, IF(mod(@rank+1,@rows)=2, @count:=@count+1, @count) AS 'row'
</code>```

Body:
I'm trying to get a unique number in 'row' column for every {variable} 3 records. (So I know we have these 3 skus on the first row etc.)

Like this:

line    sku   row
1       aaa   1
2       abb   1
3       abc   1
4       acc   2
5       acb   2
6       aab   2
7       acc   3
8       acb   3
9       aab   3

So what I have is the following

SET @rank=0;
SET @rows=3;

 select @rank:=@rank+1 AS line, sku, mod( @rank+1, @rows) 'row'

But column 'row' is not as expected.

Thank you

Body:
Here give this a go. If i have understood you problem correctly.

SET @rank = 0;
SET @rows = 3;
SET @count = 0;

select @rank:=@rank+1 AS line, sku, IF(mod(@rank+1,@rows)=2, @count:=@count+1, @count) AS 'row'


问:
filtering a list of text strings by a list of word strings
i have a list of strings, each consisting out of several words called happenings.
A second list called mostcom20 contains strings which each consist only out of one word.

My goal is to filter out all strings of the first list that do not contain at least one word of the second list.

I have:

```<code>happenings=["i have a dog","i want a dog","i like cats","i m hungry"]
mostcom20=["dog","cat"]
</code>```

as a results i want a list like:

```<code>newlist=["i have a dog","i want a dog","i like cats"]
</code>```

This is the code i have:

```<code>newlist=[]
for s in happenings:
    for n in s.split():
        if n in mostcom20:
            newlist.append(s)
newlist
</code>```

It doesnt give an error message.
It returns an empty list.
Anyone an idea why?
Thank you for the help!

答:
You might want to use a short regular expression in conjunction with filter():

```<code>import re

happenings = ["i have a dog cat dog","i want a dog","i like cats","i m hungry"]
mostcom20 = ["dog","cat"]

rx = re.compile(r'{}'.format('|'.join(mostcom20)))
filtered = list(filter(lambda x: rx.search(x), happenings))
print(filtered)
# ['i have a dog cat dog', 'i want a dog', 'i like cats']
</code>```

Body:
i have a list of strings, each consisting out of several words called happenings.
A second list called mostcom20 contains strings which each consist only out of one word.

My goal is to filter out all strings of the first list that do not contain at least one word of the second list.

I have:

happenings=["i have a dog","i want a dog","i like cats","i m hungry"]
mostcom20=["dog","cat"]

as a results i want a list like:

newlist=["i have a dog","i want a dog","i like cats"]

This is the code i have:

newlist=[]
for s in happenings:
    for n in s.split():
        if n in mostcom20:
            newlist.append(s)
newlist

It doesnt give an error message.
It returns an empty list.
Anyone an idea why?
Thank you for the help!

Body:
You might want to use a short regular expression in conjunction with filter():

import re

happenings = ["i have a dog cat dog","i want a dog","i like cats","i m hungry"]
mostcom20 = ["dog","cat"]

rx = re.compile(r'{}'.format('|'.join(mostcom20)))
filtered = list(filter(lambda x: rx.search(x), happenings))
print(filtered)
# ['i have a dog cat dog', 'i want a dog', 'i like cats']


问:
error importing my CSV data to neo4j Java heap space
I am getting "Java Heap Space" error when importing csv data in neo4j database.

I have configured following configuration in neo4j.conf.

```<code>dbms.memory.heap.initial_size=4g
dbms.memory.heap.max_size=8g
dbms.memory.pagecache.size=4g
</code>```

which discribed at

http://neo4j.com/docs/operations-manual/current/performance/#_configuring_heap_size_and_garbage_collection

but that not resolve the issue.

following is my screen
enter image description here

答: You'll want to take a look at using PERIODIC COMMIT when loading, or by using the import tool.

Body:
I am getting "Java Heap Space" error when importing csv data in neo4j database.

I have configured following configuration in neo4j.conf.

dbms.memory.heap.initial_size=4g
dbms.memory.heap.max_size=8g
dbms.memory.pagecache.size=4g

which discribed at

http://neo4j.com/docs/operations-manual/current/performance/#_configuring_heap_size_and_garbage_collection

but that not resolve the issue.

following is my screen
enter image description here


问:
Should I catch all my exceptions in the global.asax?
If I am just logging exception details in my web app, do I really need to put in exception handling logic for each tier? Why not just let them all bubble up the stack trace to the global.asax and log them there?</p>

答:
If your web app makes use of the Microsoft AJAX extensions and partial postbacks, you'll need to handle exceptions in at least two places:

Global.asax

Your ScriptManager's OnAsyncPostBackError handler

For further information on OnAsyncPostBackError, check out:

http://msforge.net/blogs/janko/archive/2008/02/13/handling-exceptions-in-asp-net-ajax.aspx

http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.onasyncpostbackerror.aspx

ContentLicense: CC BY-SA 2.5


问:
Microsoft Excel Can't insert new cells
I am receiving an error saying:

Microsoft Excel can't insert new cells because it would push non empty cells off the end of the worksheet.

This happens when I try to insert a new row of data. I need to keep all of the data on the sheet I already have. I only have 56 rows, so I think I should be able to add more...

答: My problem was that the sheet had Freeze Panes enabled. Clearing that cleared the issue.</p>

Title: Microsoft Excel Can't insert new cells


问:
Exporting Tensorboard computation graph as vector graphics
In Tensorboard there is a button save the computation graph as a png, is there a way to export it as vector graphics like eps?</p>

答:
You can save in svg format with SVG Crowbar

Bookmark the "SVG Crowbar 2"

Open tensorboard and the graph you want

Open your bookmarks tab, click the bookmark (it may take a long time)

Download the corresponding svg (it will output lots of svg, I'm not sure which one is which)


问:
Performing a subquery using values from a column in Oracle
I'm trying to create a calculated column in SQL.  Basically I need to get a set of distinct dates and determine how many customers there are in the population on that particular date. The result should be something like:

Date______| Customers

2016-01-01 | 1

2016-01-01 | 2

2016-01-05 | 3

2016-02-09 | 4

etc.

I created a sample database & data (using MySQL as I don't have permission to create tables in our Oracle dbs) with the following script:

```<code>create database customer_example;
use customer_example;

create table customers (
customer_id int not null primary key,
customer_name varchar(255) not null,
term_date DATE);

create table employee (
employee_id int not null primary key,
employee_name varchar(255) not null);

create table cust_emp (
ce_id int not null AUTO_INCREMENT,
emp_id int not null,
cust_id int not null,
start_date date,
end_date date,
deleted_yn boolean,
primary key (emp_id, cust_id, ce_id),
foreign key (cust_id) references customers(customer_id),
foreign key (emp_id) references employee(employee_id));

insert into customers (customer_id, customer_name)
values (1, 'Bobby Tables'), (2, 'Grover Cleveland'), (3, 'Chester Arthur'), (4, 'Jan Bush'), (5, 'Emanuel Porter'), (6, 'Darren King'), (7, 'Casey Mcguire'), (8, 'Robin Simpson'), (9, 'Robin Tables'), (10, 'Mitchell Arnold');

insert into customers (customer_id, customer_name, term_date)
values (11, 'Terrell Graves', '2017-01-01'), (12, 'Richard Wagner', '2016-10-31'), (13, 'Glenn Saunders', '2016-11-19'), (14, 'Bruce Irvin', '2016-03-11'), (15, 'Glenn Perry','2016-06-06'), (16, 'Hazel Freeman', '2016-07-10'),
(17, 'Martin Freeman', '2016-02-11'), (18, 'Morgan Freeman', '2017-02-01'), (19, 'Dirk Drake', '2017-01-12'), (20, 'Fraud Fraud', '2016-12-31');

insert into employee (employee_id, employee_name)
values (1000, 'Cedrick French'), (1001, 'Jane Phillips'), (1002, 'Brian Green'), (1003, 'Shawn Brooks'), (1004, 'Clarence Thomas');

insert into cust_emp (emp_id, cust_id, start_date, end_date)
values (1000, 1, '2016-01-01', '2016-02-01'), (1000, 1, '2016-02-01', '2016-02-01'), (1000, 2,'2016-01-05', '2016-01-16'),(1000, 3,'2016-02-09', '2016-03-14'),(1000, 4,'2016-03-20', '2016-04-23'),
(1000, 5,'2016-01-01', '2016-01-16'),(1000, 6,'2016-01-01', '2016-01-16'),(1004, 7, '2016-01-14', '206-01-16'),
(1004, 8, '2016-01-13', '2016-01-16'),(1004, 9, '2016-01-05', '2016-01-16'), (1003, 12, '2016-04-21', '2016-11-30');

insert into cust_emp (emp_id, cust_id, start_date, deleted_yn)
values (1002, 11, '2016-04-10', TRUE),(1003, 10, '2016-01-16', FALSE), (1004, 12, '2016-04-20', TRUE), (1004, 12, '2016-04-19', FALSE), (1003, 13, '2016-06-06', TRUE), (1002, 14, '2016-06-10', TRUE),
(1004, 15, '2016-03-25', TRUE), (1004, 17, '2016-01-02', TRUE), (1004, 18, '2017-01-01', TRUE), (1004, 19, '2016-11-13', TRUE), (1004, 20, '2016-03-10', TRUE), (1004, 16, '2016-05-13', TRUE);

insert into cust_emp (emp_id, cust_id, start_date)
values (1002, 1, '2016-02-01'), (1004, 2, '2016-01-16'),(1003, 3, '2016-03-14'),(1002, 4, '2016-04-23'),(1004, 5, '2016-01-16'),(1002, 6, '2016-01-16'),(1004, 7, '2016-01-16'),
(1004, 8, '2016-01-16'),(1002, 9, '2016-01-16'), (1004, 10, '2016-01-16');
</code>```

The following SQL works fine in MySQL but when I try it in Oracle, I get an 'invalid identifier' on 'dates':

```<code>select distinct(ce.start_date) as dates,
(select count(distinct(c.customer_id))
from customers c
    inner join cust_emp ce on c.customer_id = ce.cust_id
where ce.start_date < dates
    and (ce.end_date > dates or (ce.deleted_yn = false or ce.deleted_yn is null))
    and (c.term_date > dates or c.term_date is null)
)
from cust_emp as ce;
</code>```

It seems as though this is because the dates is too far in a subquery. I've tried a CTE as well, but that seems to have the same issue as it gave the same error. How can I re-write this so that I can assess how many customers were there for each date in Oracle?

答:
Huh?

Isn't this what you want?

```<code>select ce.dates as dates, count(distinct c.customer_id)
from cust_emp ce join
     customers c
     on c.customer_id = ce.cust_id
where ce.start_date < ce.dates and
      (ce.end_date > ce.dates or ce.deleted_yn = false or ce.deleted_yn is null) and
      (c.term_date > ce.dates or c.term_date is null)
group by ce.dates
order by ce.dates;
</code>```

I don't really understand the use of the subquery with select distinct.  The logic you describe is more easily understood as a simple aggregation.

I'm not sure where dates comes from.  It is not in your data model, but it is in your sample query.

Body:
I'm trying to create a calculated column in SQL.  Basically I need to get a set of distinct dates and determine how many customers there are in the population on that particular date. The result should be something like:

Date______| Customers

2016-01-01 | 1

2016-01-01 | 2

2016-01-05 | 3

2016-02-09 | 4

etc.

I created a sample database & data (using MySQL as I don't have permission to create tables in our Oracle dbs) with the following script:

create database customer_example;
use customer_example;

create table customers (
customer_id int not null primary key,
customer_name varchar(255) not null,
term_date DATE);

create table employee (
employee_id int not null primary key,
employee_name varchar(255) not null);

create table cust_emp (
ce_id int not null AUTO_INCREMENT,
emp_id int not null,
cust_id int not null,
start_date date,
end_date date,
deleted_yn boolean,
primary key (emp_id, cust_id, ce_id),
foreign key (cust_id) references customers(customer_id),
foreign key (emp_id) references employee(employee_id));

insert into customers (customer_id, customer_name)
values (1, 'Bobby Tables'), (2, 'Grover Cleveland'), (3, 'Chester Arthur'), (4, 'Jan Bush'), (5, 'Emanuel Porter'), (6, 'Darren King'), (7, 'Casey Mcguire'), (8, 'Robin Simpson'), (9, 'Robin Tables'), (10, 'Mitchell Arnold');

insert into customers (customer_id, customer_name, term_date)
values (11, 'Terrell Graves', '2017-01-01'), (12, 'Richard Wagner', '2016-10-31'), (13, 'Glenn Saunders', '2016-11-19'), (14, 'Bruce Irvin', '2016-03-11'), (15, 'Glenn Perry','2016-06-06'), (16, 'Hazel Freeman', '2016-07-10'),
(17, 'Martin Freeman', '2016-02-11'), (18, 'Morgan Freeman', '2017-02-01'), (19, 'Dirk Drake', '2017-01-12'), (20, 'Fraud Fraud', '2016-12-31');

insert into employee (employee_id, employee_name)
values (1000, 'Cedrick French'), (1001, 'Jane Phillips'), (1002, 'Brian Green'), (1003, 'Shawn Brooks'), (1004, 'Clarence Thomas');

insert into cust_emp (emp_id, cust_id, start_date, end_date)
values (1000, 1, '2016-01-01', '2016-02-01'), (1000, 1, '2016-02-01', '2016-02-01'), (1000, 2,'2016-01-05', '2016-01-16'),(1000, 3,'2016-02-09', '2016-03-14'),(1000, 4,'2016-03-20', '2016-04-23'),
(1000, 5,'2016-01-01', '2016-01-16'),(1000, 6,'2016-01-01', '2016-01-16'),(1004, 7, '2016-01-14', '206-01-16'),
(1004, 8, '2016-01-13', '2016-01-16'),(1004, 9, '2016-01-05', '2016-01-16'), (1003, 12, '2016-04-21', '2016-11-30');

insert into cust_emp (emp_id, cust_id, start_date, deleted_yn)
values (1002, 11, '2016-04-10', TRUE),(1003, 10, '2016-01-16', FALSE), (1004, 12, '2016-04-20', TRUE), (1004, 12, '2016-04-19', FALSE), (1003, 13, '2016-06-06', TRUE), (1002, 14, '2016-06-10', TRUE),
(1004, 15, '2016-03-25', TRUE), (1004, 17, '2016-01-02', TRUE), (1004, 18, '2017-01-01', TRUE), (1004, 19, '2016-11-13', TRUE), (1004, 20, '2016-03-10', TRUE), (1004, 16, '2016-05-13', TRUE);

insert into cust_emp (emp_id, cust_id, start_date)
values (1002, 1, '2016-02-01'), (1004, 2, '2016-01-16'),(1003, 3, '2016-03-14'),(1002, 4, '2016-04-23'),(1004, 5, '2016-01-16'),(1002, 6, '2016-01-16'),(1004, 7, '2016-01-16'),
(1004, 8, '2016-01-16'),(1002, 9, '2016-01-16'), (1004, 10, '2016-01-16');

The following SQL works fine in MySQL but when I try it in Oracle, I get an 'invalid identifier' on 'dates':

select distinct(ce.start_date) as dates,
(select count(distinct(c.customer_id))
from customers c
    inner join cust_emp ce on c.customer_id = ce.cust_id
where ce.start_date < dates
    and (ce.end_date > dates or (ce.deleted_yn = false or ce.deleted_yn is null))
    and (c.term_date > dates or c.term_date is null)
)
from cust_emp as ce;

It seems as though this is because the dates is too far in a subquery. I've tried a CTE as well, but that seems to have the same issue as it gave the same error. How can I re-write this so that I can assess how many customers were there for each date in Oracle?

Body:
Huh?

Isn't this what you want?

select ce.dates as dates, count(distinct c.customer_id)
from cust_emp ce join
     customers c
     on c.customer_id = ce.cust_id
where ce.start_date < ce.dates and
      (ce.end_date > ce.dates or ce.deleted_yn = false or ce.deleted_yn is null) and
      (c.term_date > ce.dates or c.term_date is null)
group by ce.dates
order by ce.dates;

I don't really understand the use of the subquery with select distinct.  The logic you describe is more easily understood as a simple aggregation.

I'm not sure where dates comes from.  It is not in your data model, but it is in your sample query.


问:
How do I create a Firebase collection?
So I am writing a chat application that I want to have multiple rooms, however, I can't find a button on the Firebase console that I can add child collections.

I've tried exporting, editing, then importing but that doesn't seem to do much. I have looked at some Firebase tutorial's but I can't find one that explains this.

答:
Anything you enter in the console has to have a value itself, or at least one child (with a value). This is because Firebase does not explicitly store "null" or empty values in the database. You can enter the name of the collection and then rather than a value use the + button at the right to start adding children to it and so on until you reach a node with a value:

You cannot however simply create a placeholder for a collection that has no values. If you need a collection but can't initialize any of its data, just use your security rules to define what's allowed and write your client code knowing it may or may not exist. Firebase allows you to attach listeners to nodes that don't exist yet.

Title: How do I create a Firebase collection?


问:
Define range between two page breaks excel VBA
i have an excel sheet that is separated by multiple page breaks - for each change in column C (column C represents specific ProjecID).

Each line of the table contains certain amount that has been spent. This amount is stored in column Q. (Note - for each project there can be multiple rows - amounts in column Q).

Depending if the subtotal amount (column Q) per project (column C) is <0 or >0,
different operations should be performed within that range.

Question - How to loop through these ranges (between two page breaks) in order to check subtotal amount and perform appropriate operations on rows within each range?

Thank you in advance

答:
try this. It removes page breaks from all sheets. Hope it helps.</p>

```<code>       Sub PageBreak()

         Dim ws As Worksheet, tws As Worksheet
            Set tws = ActiveSheet
            For Each ws In Worksheets
                ws.Activate
                ActiveWindow.View = xlPageBreakNone
               Next ws
                tws.Activate
        End Sub
</code>```

Body:
try this. It removes page breaks from all sheets. Hope it helps.

       Sub PageBreak()

         Dim ws As Worksheet, tws As Worksheet
            Set tws = ActiveSheet
            For Each ws In Worksheets
                ws.Activate
                ActiveWindow.View = xlPageBreakNone
               Next ws
                tws.Activate
        End Sub


问:
How can I show only the first result in ng-repeat
I have an ecommerce angularjs project that uses ng-repeat. On a product detail page, I am getting more than 1 result. So I have to use ng-repeat.

How can I show only the first result/array of the response?

My response looks like this:

What I want to do is just show that first response [0]. I don't want to show the 2nd array until later.

Controller:

```<code>unarcoQS.controller ('prodCtrl', ['$scope', 'productService', 'ngCart',
'$route', '$routeParams', '$resource', function($scope, productService, ngCart,
$route, $routeParams, $resource)
{
id = $routeParams.PartNumber;

productService.query({PartNumber: id}, function(response){
   $scope.products = response;
});
</code>```

HTML:

```<code><div class="col-md-7" ng-repeat="product in products">
    <div class="product-title">{{product[0].Description}}</div>
    <div class="product-desc">{{product[0].Category}}</div>
</div>
</code>```

答:
You can also use the $index to track the index and only show the o indexed value

```<code>  <ul ng-repeat="product in products" ng-show="$index == 0">
      <div class="product-title">{{product.Description}}</div>
      <div class="product-desc">{{product.Category}}</div>
  </ul>
</code>```

Body:
I have an ecommerce angularjs project that uses ng-repeat. On a product detail page, I am getting more than 1 result. So I have to use ng-repeat.

How can I show only the first result/array of the response?

My response looks like this:

What I want to do is just show that first response [0]. I don't want to show the 2nd array until later.

Controller:

unarcoQS.controller ('prodCtrl', ['$scope', 'productService', 'ngCart',
'$route', '$routeParams', '$resource', function($scope, productService, ngCart,
$route, $routeParams, $resource)
{
id = $routeParams.PartNumber;

productService.query({PartNumber: id}, function(response){
   $scope.products = response;
});

HTML:

{{product[0].Description}}

{{product[0].Category}}

Body:
You can also use the $index to track the index and only show the o indexed value

  <ul ng-repeat="product in products" ng-show="$index == 0">
      <div class="product-title">{{product.Description}}</div>
      <div class="product-desc">{{product.Category}}</div>
  </ul>


问:
Pandas to_csv how to format both int and float variables with comma as thousands separator
All the data I crunch needs to be reported with comma as thousands separator. I'm only interested in values with comma as thousands separator after the data is written to a .csv file. Internally within my pandas dataframe, I want to keep them as int or float.

floats

I can output the floats to zero decimal with:

```<code> df.to_csv('c:\Awesome\Groovy.csv', float_format = '%.0f')
</code>```

but whenever I try to put a comma in the float it doesn't work.

```<code> df.to_csv('c:\Awesome\Groovy.csv', float_format = ':,.0f') ## WRONG
 df.to_csv('c:\Awesome\Groovy.csv', float_format = {:,.0f}'.format) ## WRONG
</code>```

ints

And my plan for the ints, is first to convert them to float in the dataframe and then format them with the .to_csv function. Any thoughts?

ContentLicense: CC BY-SA 4.0

Body:
All the data I crunch needs to be reported with comma as thousands separator. I'm only interested in values with comma as thousands separator after the data is written to a .csv file. Internally within my pandas dataframe, I want to keep them as int or float.

floats

I can output the floats to zero decimal with:

 df.to_csv('c:\Awesome\Groovy.csv', float_format = '%.0f')

but whenever I try to put a comma in the float it doesn't work.

 df.to_csv('c:\Awesome\Groovy.csv', float_format = ':,.0f') ## WRONG
 df.to_csv('c:\Awesome\Groovy.csv', float_format = {:,.0f}'.format) ## WRONG

ints

And my plan for the ints, is first to convert them to float in the dataframe and then format them with the .to_csv function. Any thoughts?

Body:
This might be too kludgy for you. At any rate here goes. Using this answer https://stackoverflow.com/a/4205875/42346 we can have our commas:

def thous(x, sep=',', dot='.'):
    num, _, frac = str(x).partition(dot)
    num = re.sub(r'(\d{3})(?=\d)', r'\1'+sep, num[::-1])[::-1]
    if frac:
        num += dot + frac
    return num

df['my_column'] = df['my_column'].apply(lambda x: thous(x))

Using some sample data I had lying around from another SO question:

>>> df = pd.DataFrame({'date':['2017-03-10','2017-03-11','2017-03-12'],
                       'activate_time':['2017-03-10 12:13:30','2017-03-11 13:57:49','2017-03-12 14:28:05'],
                       'mycol':[1234.56789,9876.54321,1111111.11111]})
>>> df['mycol'] = df['mycol'].apply(lambda x: thous(x))
>>> df
          activate_time        date            mycol
0   2017-03-10 12:13:30  2017-03-10      1,234.56789
1   2017-03-11 13:57:49  2017-03-11      9,876.54321
2   2017-03-12 14:28:05  2017-03-12  1,111,111.11111


问:
Difference between osv.osv class and models.Model class odoo 8
Please let me know difference between osv.osv class and models.Model  class in odoo 8
Example:</p>

```<code>class account_invoice_line(models.Model):

class account_invoice_line(osv.osv):
</code>```

答:
They have used C++ for the OSV Kernel Development with various data structures and algorithms. Linux Kernel is developed using C with the use of various data structures as well.

OSV is mainly designed to run on the cloud as it reduces the memory and cpu overhead when compared with other operating systems

Body:
Please let me know difference between osv.osv class and models.Model  class in odoo 8
Example:

class account_invoice_line(models.Model):

class account_invoice_line(osv.osv):


问:
MVC project complaining it is unable to find Nhibernate.dll version 2.1.0.4000
In my MVC project, I am trying to use the latest Fluent Nhibernate, and NHibernate.linq.  I am using the Nhibernate.dll that came with the latest Fluent Nhibernate released build.  However, I have only been able to find NHibernate.linq 1.0.

When attempting to run I get the error:

```<code>Could not load file or assembly 'NHibernate, Version=2.1.0.4000, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's
manifest definition does not match the assembly reference. (Exception from HRESULT:
0x80131040)
</code>```

I see at SourceForge in the NHibernate project, they have a NHibernate.Linq 2.1.2 version under the NHibernate 2.1.2 project, but if you download this zip, it is empty.

My thoughts is that Linq is referencing the older NHibernate.dll, but how can I get the NHibernate.linq.dll 2.1.2 version?

There is another question with this same error, and I tried all their suggestions with making sure that all the other NHibernate.dll's are included.  I didn't rebuild the NHibernate.linq project with the same NHibernate.dll that Fluent uses, since I was hoping to get a newer version of NHibernate.linq.

答:
You can grab a build of NHibernate.Linq compatible with NH2.1.2 from here:

http://sourceforge.net/projects/nhibernate/files/NHibernate/2.1.2GA/NHibernate.Linq-2.1.2-GA-Bin.zip/download

Body:
In my MVC project, I am trying to use the latest Fluent Nhibernate, and NHibernate.linq.  I am using the Nhibernate.dll that came with the latest Fluent Nhibernate released build.  However, I have only been able to find NHibernate.linq 1.0.

When attempting to run I get the error:

Could not load file or assembly 'NHibernate, Version=2.1.0.4000, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's
manifest definition does not match the assembly reference. (Exception from HRESULT:
0x80131040)

I see at SourceForge in the NHibernate project, they have a NHibernate.Linq 2.1.2 version under the NHibernate 2.1.2 project, but if you download this zip, it is empty.

My thoughts is that Linq is referencing the older NHibernate.dll, but how can I get the NHibernate.linq.dll 2.1.2 version?

There is another question with this same error, and I tried all their suggestions with making sure that all the other NHibernate.dll's are included.  I didn't rebuild the NHibernate.linq project with the same NHibernate.dll that Fluent uses, since I was hoping to get a newer version of NHibernate.linq.


问:
Valgrind does not work with WSL?
When I installed WSL for my computer I was very excited to have a more natively supported Linux system rather than using VirtualBox. However I get this error when I try to run it. Is there a reason why?

I am happy to give more information as required.

```<code>--4364:0:aspacem   -1: ANON 0038000000-00383d5fff 4022272 r-x-- SmFixed d=0x000 i=25365   o=0       (0) m=0 /usr/lib/valgrind/memcheck-amd64-linux

--4364:0:aspacem  Valgrind: FATAL: aspacem assertion failed:

--4364:0:aspacem    segment_is_sane

--4364:0:aspacem    at m_aspacemgr/aspacemgr-linux.c:1502 (add_segment)

--4364:0:aspacem  Exiting now.
</code>```

答:
It's definitely possible

I've encountered some problems installing it directly with apt, however it can be installed manually with some very simple steps:

Download the source file: wget http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2 (by the time you read this there could be a newer version)

Extract the archive: tar -xvjf valgrind-3.12.0.tar.bz2

Configure the installation process: cd into the exctracted folder valgrind-3.12.0 and then launch ./configure

Make: simply launch make while in the valgrind-3.12.0 folder

Check the dependencies: launch make check to see whether all the dependencies necessary for the installation are satisfied (e.g: you'll have to install g++, just launch sudo apt install g++)

Install valgrind: type sudo make install to install it

Title: Valgrind does not work with WSL?

Body:
When I installed WSL for my computer I was very excited to have a more natively supported Linux system rather than using VirtualBox. However I get this error when I try to run it. Is there a reason why?

I am happy to give more information as required.

--4364:0:aspacem   -1: ANON 0038000000-00383d5fff 4022272 r-x-- SmFixed d=0x000 i=25365   o=0       (0) m=0 /usr/lib/valgrind/memcheck-amd64-linux

--4364:0:aspacem  Valgrind: FATAL: aspacem assertion failed:

--4364:0:aspacem    segment_is_sane

--4364:0:aspacem    at m_aspacemgr/aspacemgr-linux.c:1502 (add_segment)

--4364:0:aspacem  Exiting now.


问:
How to set caps lock only for selected signs in css?
I have downloaded a font and I set font-variant: small-caps;. Works fine but my numbers are way too big then. And now I want to know if there is any way to set caps lock only for letters, not for the numbers? I know that theoretically numbers don't have caps lock form but in my case they do. Any ideas how to fix it?

答:
Use the text-transform property.

    p.uppercase, textarea {
        text-transform: uppercase;
    }

    p.lowercase {
        text-transform: lowercase;
    }

    p.capitalize {
        text-transform: capitalize;
    }```
<pre class="snippet-code-html lang-html prettyprint-override"><code>    <p class="uppercase">This is some text. 123</p>
    <p class="lowercase">This is some text.</p>
    <p class="capitalize">This is some text.</p>
    <textarea>This is input text 1234</textarea></code>```

Body:
Use the text-transform property.

    p.uppercase, textarea {
        text-transform: uppercase;
    }

    p.lowercase {
        text-transform: lowercase;
    }

    p.capitalize {
        text-transform: capitalize;
    }

    <p class="uppercase">This is some text. 123</p>
    <p class="lowercase">This is some text.</p>
    <p class="capitalize">This is some text.</p>
    <textarea>This is input text 1234</textarea>


问:
PHP 7.1 Register_Globals
Another odd question here. I've recently been apart of a huge upgrade from PHP 5 to Php 7.1 along with CentOS upgrade as well.

We have a lot of pages (almost all of them in fact) that used the register global shortcut in the code.

```<code>$_SESSION['username'] = $data['username'];
$_SESSION['password'] = $data['password'];
$_SESSION['accountid'] = $data['accountid'];
$_SESSION['role'] = $data['role'];

$getCompany = mysqli_query($mysqli_con,"SELECT * FROM companies WHERE companyid='$data[accountid]'");
$dataCompany = mysqli_fetch_array($getCompany);

$delinquent = $dataCompany['delinquency'];

// Here I fixed it
$item = $_GET['item'];
// But generally variables are just referenced by $whatevergetparameter
if($delinquent == 0){
switch($item)
{
    // Settings
    case "cannedresponses":
        include("/master/inc/settings/list-cannedresponse.inc");
    break;

    case "serviceboard":
        include("/master/inc/settings/list-serviceboard.inc");
    break;

    case "pending-direct":
        include("/master/inc/direct/pending.inc");
    break;
</code>```

Naturally this has caused a lot of problems. Especially since it is everywhere.

There are plans for a re-write in the works but in the meantime I was wondering if anyone knows a workaround to imitate or "enable" register_globals so we can get functionality up and running.

I've looked and tried the solutions:
http://php.net/manual/en/security.globals.php
But unfortunately they don't work which isn't surprising since they were written 3 years ago.

My Google-Fu isn't helping me here either :/

Any help is appreciated, thanks in advance!

答:
So I came up with a temporary solution in the meantime.

We utilize an include often in almost all of our pages that includes functions, db connections, etc.

I begun listing the GET / POST variables we use everywhere there.

```<code>if(isset($_GET["outsource"]))
        $outsource = $_GET["outsource"];
else
    $outsource = "";

// Our Selector for a lot of our Select case Usage
if(isset($_GET["item"]))
        $item = $_GET["item"];
else
    $item = "";

// Order Stuff
if(isset($_GET["orderby"]))
        $orderby = $_GET["orderby"];
else
    $orderby = "";
</code>```

It's not the cleanest solution, and it's not the best solution but it "works".

Title: PHP 7.1 Register_Globals

Body:
Another odd question here. I've recently been apart of a huge upgrade from PHP 5 to Php 7.1 along with CentOS upgrade as well.

We have a lot of pages (almost all of them in fact) that used the register global shortcut in the code.

$_SESSION['username'] = $data['username'];
$_SESSION['password'] = $data['password'];
$_SESSION['accountid'] = $data['accountid'];
$_SESSION['role'] = $data['role'];

$getCompany = mysqli_query($mysqli_con,"SELECT * FROM companies WHERE companyid='$data[accountid]'");
$dataCompany = mysqli_fetch_array($getCompany);

$delinquent = $dataCompany['delinquency'];

// Here I fixed it
$item = $_GET['item'];
// But generally variables are just referenced by $whatevergetparameter
if($delinquent == 0){
switch($item)
{
    // Settings
    case "cannedresponses":
        include("/master/inc/settings/list-cannedresponse.inc");
    break;

    case "serviceboard":
        include("/master/inc/settings/list-serviceboard.inc");
    break;

    case "pending-direct":
        include("/master/inc/direct/pending.inc");
    break;

Naturally this has caused a lot of problems. Especially since it is everywhere.

There are plans for a re-write in the works but in the meantime I was wondering if anyone knows a workaround to imitate or "enable" register_globals so we can get functionality up and running.

I've looked and tried the solutions:
http://php.net/manual/en/security.globals.php
But unfortunately they don't work which isn't surprising since they were written 3 years ago.

My Google-Fu isn't helping me here either :/

Any help is appreciated, thanks in advance!

Body:
So I came up with a temporary solution in the meantime.

We utilize an include often in almost all of our pages that includes functions, db connections, etc.

I begun listing the GET / POST variables we use everywhere there.

if(isset($_GET["outsource"]))
        $outsource = $_GET["outsource"];
else
    $outsource = "";

// Our Selector for a lot of our Select case Usage
if(isset($_GET["item"]))
        $item = $_GET["item"];
else
    $item = "";

// Order Stuff
if(isset($_GET["orderby"]))
        $orderby = $_GET["orderby"];
else
    $orderby = "";

It's not the cleanest solution, and it's not the best solution but it "works".


问:
Clear textbox after select jquery typeahead.js
Thanks to the wonderful suggestions listed on SO I was able to hack out a type ahead that will update a table when selected. The last step I need to do is clear the textbox on/during/after the selection. I have tried adding things to the table onchange event, intercepting the select event, etc. nothing seems to work. The only other reference I can find here for this does not have an answer. There are responses for autocomplete but I cant seem to adapt them either. Any help would be greatly appreciated.

```<code>    $(document).ready(function () {

    var ds = [
           @if (ViewData.ModelState.IsValid)
             {
                 var index = 0;
                 foreach (var person in Model)
                 {
                     var jaUser = "{ name: \" " + person.UserName + "\", mobi: \"" + person.MobilePhone + "\" }";
                     if (index > 0) { jaUser = ',' + jaUser; }

                                   @Html.Raw(jaUser)
                     index++;
                 }
             }
    ];

    var d = new Bloodhound({
        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        local: ds
    });
    d.initialize();

    $('#contactSearch').typeahead(
{
    hint: true,
    highlight: true,
    minLength: 1,
},
{
    name: 'd',
    displayKey: 'name',
    source: d.ttAdapter(),
    templates: {
        empty: 'not found', //optional
        suggestion: function (el) {
            return "<span onclick=\"addUser2list('" + el.name + "');\"><img src='" + el.mobi + "' />" + el.name + "</span>"
        }
    }
}
);

});

function addUser2list(mobnum){
    if (mobnum.length > 0){
        row = $("<tr></tr>");
        col1 = $("<td>col1</td>");
        col2 = $("<td>"+ mobnum +"</td>");
        col3 = $("<td>col3</td>");
        row.append(col1, col2, col3).prependTo("#mytable");
        //$('#contactSearch').val('');
    }
}
</code>```

example - you type "da" in the text box, 3 names appear in the drop down, you select 1 and it is prepended to the table above. Once that happens, I need the text box to be clear, currently it shows the name you selected and you have to manually delete it. For some unknown reason the jsfiddle isnt updating the table, but in my local code it works fine, I just need to know how to clear the "contactSearch" box automatically.

答:
add updater </p>

```<code>updater: function (item) {
                    comp = map[item];
                    if (typeof comp != 'undefined') {
                        _cid = map[item].myid;
                        return '';  // here return blank
                    }
                },
</code>```

Body:
Thanks to the wonderful suggestions listed on SO I was able to hack out a type ahead that will update a table when selected. The last step I need to do is clear the textbox on/during/after the selection. I have tried adding things to the table onchange event, intercepting the select event, etc. nothing seems to work. The only other reference I can find here for this does not have an answer. There are responses for autocomplete but I cant seem to adapt them either. Any help would be greatly appreciated.

    $(document).ready(function () {

    var ds = [
           @if (ViewData.ModelState.IsValid)
             {
                 var index = 0;
                 foreach (var person in Model)
                 {
                     var jaUser = "{ name: \" " + person.UserName + "\", mobi: \"" + person.MobilePhone + "\" }";
                     if (index > 0) { jaUser = ',' + jaUser; }

                                   @Html.Raw(jaUser)
                     index++;
                 }
             }
    ];

    var d = new Bloodhound({
        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        local: ds
    });
    d.initialize();

    $('#contactSearch').typeahead(
{
    hint: true,
    highlight: true,
    minLength: 1,
},
{
    name: 'd',
    displayKey: 'name',
    source: d.ttAdapter(),
    templates: {
        empty: 'not found', //optional
        suggestion: function (el) {
            return "" + el.name + ""
        }
    }
}
);

});

function addUser2list(mobnum){
    if (mobnum.length > 0){
        row = $("

");
        col1 = $("col1	");
        col2 = $(""+ mobnum +"	");
        col3 = $("col3	");
        row.append(col1, col2, col3).prependTo("#mytable");
        //$('#contactSearch').val('');
    }
}

example - you type "da" in the text box, 3 names appear in the drop down, you select 1 and it is prepended to the table above. Once that happens, I need the text box to be clear, currently it shows the name you selected and you have to manually delete it. For some unknown reason the jsfiddle isnt updating the table, but in my local code it works fine, I just need to know how to clear the "contactSearch" box automatically.

Body:
add updater

updater: function (item) {
                    comp = map[item];
                    if (typeof comp != 'undefined') {
                        _cid = map[item].myid;
                        return '';  // here return blank
                    }
                },


问:
Why does the counter keep counting when i'm using .hasNext in file io in java
Basically, I'm trying to count how many lines in a txt file and then store it to an array as index.

```<code>File file = new java.io.File("number.txt");
Scanner s = new Scanner(file);
int count = 0;
while(s.hasNextLine())
{
    count++;
    System.out.println(count);
}
System.out.println("There is: " + count + " line );
int[] array = new int[count];
</code>```

However, I realize that the "count" go infinity and it never stop counting, but I only have 20 line in my txt file. Why is this happening??

Note: I know how to fix , but i just curious about why it keep counting

答:
You should be using

```<code>scanner.nextLine()
</code>```

in conjunction with

```<code>scanner.hasNextLine()
</code>```

hasNextLine will check if the there is next line available or not but it will not goto the next line for that you need to use nextLine. When both of them are used you will see the counter stop after it has parsed the last line. So your code should be something like this

```<code>File file = new java.io.File("number.txt");
Scanner s = new Scanner(file);
int count = 0;
while(s.hasNextLine())
{
    s.nextLine();
    count++;
    System.out.println(count);
}
System.out.println("There is: " + count + " line );
int[] array = new int[count];
</code>```

Body:
Basically, I'm trying to count how many lines in a txt file and then store it to an array as index.

File file = new java.io.File("number.txt");
Scanner s = new Scanner(file);
int count = 0;
while(s.hasNextLine())
{
    count++;
    System.out.println(count);
}
System.out.println("There is: " + count + " line );
int[] array = new int[count];

However, I realize that the "count" go infinity and it never stop counting, but I only have 20 line in my txt file. Why is this happening??

Note: I know how to fix , but i just curious about why it keep counting

Body:
You should be using

scanner.nextLine()

in conjunction with

scanner.hasNextLine()

hasNextLine will check if the there is next line available or not but it will not goto the next line for that you need to use nextLine. When both of them are used you will see the counter stop after it has parsed the last line. So your code should be something like this

File file = new java.io.File("number.txt");
Scanner s = new Scanner(file);
int count = 0;
while(s.hasNextLine())
{
    s.nextLine();
    count++;
    System.out.println(count);
}
System.out.println("There is: " + count + " line );
int[] array = new int[count];


问:
Textarea without scrollbar
Hi
I do want to create a textarea without scrollbar just like in facebook and twitter, and the creation of the textarea that changes its height when we click on it.
thank you</p>

答:
If you are looking to use jQuery, there is a plugin called autoResize

Usage is simple:

```<code>$('textarea#comment').autoResize({
    // On resize:
    onResize : function() {
        $(this).css({opacity:0.8});
    },
    // After resize:
    animateCallback : function() {
        $(this).css({opacity:1});
    },
    // Quite slow animation:
    animateDuration : 300,
    // More extra space:
    extraSpace : 40
});
</code>```

Grab this plugin here: http://james.padolsey.com/javascript/jquery-plugin-autoresize/

Title: Textarea without scrollbar

Body:
If you are looking to use jQuery, there is a plugin called autoResize

Usage is simple:

$('textarea#comment').autoResize({
    // On resize:
    onResize : function() {
        $(this).css({opacity:0.8});
    },
    // After resize:
    animateCallback : function() {
        $(this).css({opacity:1});
    },
    // Quite slow animation:
    animateDuration : 300,
    // More extra space:
    extraSpace : 40
});

Grab this plugin here: http://james.padolsey.com/javascript/jquery-plugin-autoresize/


问:
Passing PHP variable via AJAX to PHP variable in another DIV
I've been working on this for a whole day but think I'm getting confused on the various methods available while I learn AJAX.   I want my website to display the results of Python script. I can do that.

The problem is the script's results change randomly (it's the status of my garage door) and my site is clunky if the garage door's status changes.  Usually the user has to keep reloading the page to get a current status.  I'm trying to have the DIV that shows the status to update every 5 seconds thus showing the new status.

The Python script takes about 4 seconds to run, so I want to keep calling it as a function and pass it as a DIV on my site where I want to display the results.

If possible, one PHP file (index.php).  Here is the skeleton of what I'm looking to do.  My get_status function works, but I'm at a loss on the rest of it.

Thank you.

EDIT:   Code updated with minor tweaks spotted by the commenters.

```<code><html>
<body>

<?php
    function get_status(){
        $status = shell_exec('python /path/to/garage_door/myq-garage.py status');  //Equals either 'Open' or 'Closed'
        echo $status;
    }
?>

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js">
    var java_status = <?php echo json_encode(get_status) ?>;

    // I have no idea how to pass a variable from PHP thru javascript to PHP on the
    // same page.  Trying to pass on results of get_status function every 5 seconds.

    setInterval(function(){

        $.ajax({
            url: "index.php"
            type: "POST"
            dataType: "json"
            data: ({status: java_status}),
            success: function(data){
                $("#status_div").html(data);
            }
        })

    }, 5000);
</script>

<div id="status_div">
    <?php
        $new_status = json_decode(data);
    ?>

    // I have no idea how to get that status variable here.
    The Garage Door Status is:  <?php
        echo $new_status;
    ?>

</div>
</body>
</html>
</code>```

答:
If you are using ajax, you can make your life very easy:

function_status.php:

```<code><?php
function get_status(){
        $status = shell_exec('python /path/to/garage_door/myq-garage.py status');     //Equals either 'Open' or 'Closed'
        return $status; //avoid echo in such functions, try to not produce side effects
    }
</code>```

ajax_server.php:

```<code><?php
require_once("function_status.php");
echo get_status();
</code>```

index.php:

```<code><?php
require_once("function_status.php");
?>
<html>
<body>
<div id="status">
<?php echo get_status(); ?>
</div>

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js">
<script type="text/javascript">

( //run function immediatly
  function($){ //in this anonymous function, $ is always jQuery
     function updateStatus(){
         $.ajax({
            url: "ajax_server.php"
            type: "POST"
            dataType: "json"
            data: ({status: 1}),
            success: function(data){
                $("#status").html(data);
            }
        });
     }

     //first call it onload
     $(function(e){
        updateStatus();
     }

     //and then every 5 seconds
     setInterval(updateStatus, 5000);
     );
   }

)//run function immediatly
(jQuery); //pass parameter jQuery to immediate execution of anonymous function

</script>
</body>
</html>
</code>```

it is not a very clean way, and i used the <?php echo get_status(); ?> only, because your python script takes 4 seconds, so you would have no status for the first 4 seconds.
else you could change it to index.html and have a nicely seperated html and php, if you anyway want to populate the html with ajax.
if you really want to hack it into one file, you need an

```<code>if(isset($_POST['status'])){
echo get_status();
}else{
//output the html around the whole thing
}
</code>```

Body:
I've been working on this for a whole day but think I'm getting confused on the various methods available while I learn AJAX.   I want my website to display the results of Python script. I can do that.

The problem is the script's results change randomly (it's the status of my garage door) and my site is clunky if the garage door's status changes.  Usually the user has to keep reloading the page to get a current status.  I'm trying to have the DIV that shows the status to update every 5 seconds thus showing the new status.

The Python script takes about 4 seconds to run, so I want to keep calling it as a function and pass it as a DIV on my site where I want to display the results.

If possible, one PHP file (index.php).  Here is the skeleton of what I'm looking to do.  My get_status function works, but I'm at a loss on the rest of it.

Thank you.

EDIT:   Code updated with minor tweaks spotted by the commenters.

<?php
    function get_status(){
        $status = shell_exec('python /path/to/garage_door/myq-garage.py status');  //Equals either 'Open' or 'Closed'
        echo $status;
    }
?>

    <?php
        $new_status = json_decode(data);
    ?>

    // I have no idea how to get that status variable here.
    The Garage Door Status is:  <?php
        echo $new_status;
    ?>

Body:
If you are using ajax, you can make your life very easy:

function_status.php:

<?php
function get_status(){
        $status = shell_exec('python /path/to/garage_door/myq-garage.py status');     //Equals either 'Open' or 'Closed'
        return $status; //avoid echo in such functions, try to not produce side effects
    }

ajax_server.php:

<?php
require_once("function_status.php");
echo get_status();

index.php:

<?php
require_once("function_status.php");
?>
<html>
<body>
<div id="status">
<?php echo get_status(); ?>
</div>

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js">
<script type="text/javascript">

( //run function immediatly
  function($){ //in this anonymous function, $ is always jQuery
     function updateStatus(){
         $.ajax({
            url: "ajax_server.php"
            type: "POST"
            dataType: "json"
            data: ({status: 1}),
            success: function(data){
                $("#status").html(data);
            }
        });
     }

     //first call it onload
     $(function(e){
        updateStatus();
     }

     //and then every 5 seconds
     setInterval(updateStatus, 5000);
     );
   }

)//run function immediatly
(jQuery); //pass parameter jQuery to immediate execution of anonymous function

</script>
</body>
</html>

it is not a very clean way, and i used the <?php echo get_status(); ?> only, because your python script takes 4 seconds, so you would have no status for the first 4 seconds.
else you could change it to index.html and have a nicely seperated html and php, if you anyway want to populate the html with ajax.
if you really want to hack it into one file, you need an

if(isset($_POST['status'])){
echo get_status();
}else{
//output the html around the whole thing
}


问:
Create a string from a specific key/value in an array
I have an array collection that I want to pull values out of to create a string. I am using lodash to help out with the loop.

```<code>var arr = [
  {
    "id": 0,
    "name": "Lorem"
  },
  {
    "id": 1,
    "name": "ipsum"
  },
  {
    "id": 3,
    "name": "dolor"
  },
  {
    "id": 4,
    "name": "sit"
  }
];

_.forEach(arr, function(value) {
  var jawn = value.name;
  jawn.join('\n');
  console.log(jawn);
});
</code>```

What I want to do is

```<code>jawn.join('\n');
</code>```

So the result for console.log(jawn); would be...

```<code>"Lorem
ipsum
dolor
sit
amet"
</code>```

I know this but I'm drawing a blank for some reason.

答:
I'm not familiar with lodash, but you can easily achieve the desired result using Array#map. I bet it would be pretty similar with lodash.

var arr = [ { "id": 0, "name": "Lorem" }, { "id": 1, "name": "ipsum" }, { "id": 3, "name": "dolor" }, { "id": 4, "name": "sit" } ],
    res = arr.map(v => v.name).join('\n');
    console.log(res);```

Body:
I have an array collection that I want to pull values out of to create a string. I am using lodash to help out with the loop.

var arr = [
  {
    "id": 0,
    "name": "Lorem"
  },
  {
    "id": 1,
    "name": "ipsum"
  },
  {
    "id": 3,
    "name": "dolor"
  },
  {
    "id": 4,
    "name": "sit"
  }
];

_.forEach(arr, function(value) {
  var jawn = value.name;
  jawn.join('\n');
  console.log(jawn);
});

What I want to do is

jawn.join('\n');

So the result for console.log(jawn); would be...

"Lorem
ipsum
dolor
sit
amet"

I know this but I'm drawing a blank for some reason.


问:
libXp.so library missing on Ubuntu 16.04
I'm trying to install Matlab on my Ubuntu 16.04 (64 bit), and it says 'the X11 library libXp.so does not exist. Matlab won't run on this machine until the library is installed'. I followed some other forums about this problem, and the instruction was to install libxp6 (sudo apt-get install libxp6). I did so, but the problem still persists. I searched for the libxp.so library on my system but couldn't find it.

When tryng to run Matlab from the bin folder using ./matlab, it says error while loading shared libraries: libXp.so.6: cannot open shared object file: No such file or directory

How do I install the libxp.so on ubuntu 16.04? Do I need to run any specific package for it? If libXp.so is installed, then how do I locate the .so library? Please help.

答:
On my Ubuntu 16.04 machine I did dpkg -S /usr/lib/x86_64-linux-gnu/libXp.so and found out that this file is provided by the libxp-dev package.

So sudo apt-get install libxp-dev is likely to fix your problem.


答:
Without lodash:</p>

```<code>arr.map(function(value) {
  return value.name;
}).join('\n');
</code>```

Title: Create a string from a specific key/value in an array

Body:
Without lodash:

arr.map(function(value) {
  return value.name;
}).join('\n');


答:
You could map only the name and join the array with \n.

var arr = [{ id: 0, name: "Lorem" }, { id: 1, name: "ipsum" }, { id: 3, name: "dolor" }, { id: 4, name: "sit" }],
    result = arr.map(a => a.name).join('\n');

console.log(result);```


问:
Implementing retry pattern for WCF call transient exceptions
I have a very simple WCF SOAP service that does some changes in DB upon every call and returns some response. I'm also using ServiceChannel to call it from my client side code.

I want to make sure that my client-side code does not just fail when service is too busy, so have implemented a Retry pattern to retry the service call if exception is caught. However, i don't want to retry if exception is caused by my code on WCF server side (if it's not connection-related, or if any OperationContract code was executed anyway (a timeout doesn't mean it wasn't, right?)).

So i want to retry only if

I've sent a request

Caught an exception

None of the server side code in my OperationContract method was executed

Microsoft article (link above) has almost no information about what types of exceptions exactly are transient. What exception types should I use to catch exactly what I need? Or how should I filter them?

答: Inside your WCF service implementation, within your operation contracts catch exceptions that happens throughout the execution of the code and return specific FaultException to signal your client that your service side code has run. May be put a special fault code or start your Fault Exception message with a predefined sub string. On your client side once you catch a Fault exception check if the sub string exists (or the specific fault code s you set on your service code), if these exist that means your service side code has run and you do not need to retry otherwise you can retry. You could also catch other exception types and retry as well.  </p>


问:
What is wrong with this link? when clicked on, browser says "null/"
https://smile.amazon.com/gp/f.html?C=1OR2JD8DH59TD&K=A2CTKC0L6X87GK&R=28ZTBZOJI3VVH&T=C&U=http%3A%2F%2Fnull&A=KQPRJ83ZWZ0RQMDCCLBSZSLUIACA&H=1OLUERCFQKYSOSL3QA4HUYMYKEKA

I am unsure why this link is only coming up as "null/" when entered into browser. Someone please help me fix this!

答:
The link returns a status code 302. The response will have a location attribute in response header which redirects to a second link

https://www.amazon.com/gp/f.html?C=1OR2JD8DH59TD&K=A2CTKC0L6X87GK&R=28ZTBZOJI3VVH&T=C&U=http%3A%2F%2Fnull&A=KQPRJ83ZWZ0RQMDCCLBSZSLUIACA&H=1OLUERCFQKYSOSL3QA4HUYMYKEKA&pldnSite=1

Again the second link returns same status code which redirects to http://null

You can see all this in chrome developer tools under network tab. Make sure 'Preserve log' checkbox is checked else you won't be able to see individual request/responses.