Thursday, May 26, 2016

window.location



 var element = $(document.createElement("li"));
        element.addClass("main-tabs");
        element.html("Profile");
        element.on('click', function (event) { window.location="https://elements-test.it.ohio-state.edu"; });
        $scope.hardpoint.append(element);

Tuesday, May 17, 2016

node js log

https://nodejs.org/en/blog/module/service-logging-in-json-with-bunyan/

Thursday, May 12, 2016

margin-top: -10px

  margin-top: -10px


css !important;

  background-color: #4CAF50 !important;


https://css-tricks.com/when-using-important-is-the-right-choice/

Friday, May 6, 2016

clone Mongodb database to local from a server

The reason is to work on local copy of database when I am in airplane or off network.

Download MongChef, connect to server and local Mongodb (for sure you install local Mongodb first)

1. add database to local
2. select source, right click, then copy collections
3. right click local database then past collections

Thursday, May 5, 2016

MongoDB check field existence and partial match


db.getCollection('merged_authors').find({last_name: 'Wang','first_name': {'$regex': 'Junmin'}, user_id:{$exists:true} })

router.get('/merged_author/', function (req, res, next) {
  var first_name = req.query.first_name;
  var last_name = req.query.last_name;
  var full_name = req.query.full_name;
  var middle_name = req.query.middle_name;
  var page = req.query.page;
  if (page == null) {
    page = 1;
  }
  var per_page = req.query.per_page;
  if (per_page == null) {
    per_page = 25;
  }
  var name_results = [];
  var condition = {};
  if (first_name != undefined) {
    condition_first_name ={};
    condition_first_name["$regex"] = first_name;
    condition["first_name"] = condition_first_name;
  }
  if (last_name != undefined) {
    condition["last_name"] = last_name;
  }
  if (middle_name != undefined) {
    condition["middle_name"] = middle_name;
  }

  condition["user_id"] = {$exists: true};
  console.log(condition);
  KMMergedAuthors.find(condition)
    .sort(
      buildSortClause(req)
    )
    .limit(50)
    .exec()
    .then(function (allMergedAuthors) {
      res.json(allMergedAuthors);
    });
});

netstat -ano

Wednesday, May 4, 2016

Tuesday, May 3, 2016

Monday, May 2, 2016