Wednesday, September 14, 2016

So here's a trick I learned in case someone is having trouble adding an inherited windows form control to a derived class' group box.

You'll find if you try to drag/drop the inherited control, it won't actually be addable to the group box.

So the trick here is, while you're dragging with the left mouse button into the group box, click and release the right mouse button, and you'll notice the control is now a child of the group box.

That's all there is to it.

Wednesday, July 13, 2016

List of Important Commands

Okay, so it's not the "complete" list, but it's definitely a list of important CLI commands.

Generate Linux Commands

ln -s <file-to-link> <link-name>

Docker Commands

docker exec -ti <container-id> bash
docker run -P --privilege --net=host -td <image-name:version>
docker commit [-m "message"] <container-id> <image-name:version>
docker cp container-id:/<source-path> <target-path>
docker cp <source-path> container-id:/<target-path>

docker run --privileged -p 80:80 -p 443:443 -td <image-name:version>
docker run --privileged -p 9200:9200 -p 5601:5601 -p 1433:1433 -td <image-name:version>

Elastic Search Curl commands

List elastic search indeces

curl 'localhost:9200/_cat/indices?v' | sort -nk3

Delete elastic search indeces

curl -XDELETE localhost:9200/_all
curl -XDELETE localhost:9200/

Thursday, April 21, 2016

Unity's "5/11Clustering" hang issue solved

So this is just a quick post to help those of you who may be facing the same issue I was today when trying to build for iOS and/or Android in Unity.

I kept getting "5/11 Clustering" box and then it would just hang forever.  Turns out it's a super easy fix.

Simply open up the "Lighting" and uncheck the "Auto" checkbox.  I was pulling my hair out until I figured that part out.

Friday, September 11, 2015

How to Optimize MacOS Yosemite's WindowServer to Reduce CPU Usage

So I'm not going to waste a lot of time explaining the "how come?"'s here. I'm simply going to give you some tips to reduce CPU usage of the WindowServer on MacOS Yosemite.

So here they are:

  1. MacOS, despite what some may tell you, does require the occasional reboot.  So start there, just to clean things up. 
  2. Shutdown apps you don't need to reduce memory usage, thus reducing the likelihood of swapping. 
  3. Disable Transparent Effects as follows:
    1. Apple > System Preferences > Accessibility
    2. Select Display
    3. Check "Reduce Transparency"
  4. Disable "Spaces" if you're using multiple displays as follows:
    1. Apple > System Preferences > Mission Control
    2. Uncheck "Displays Have Separate Spaces"
    3. Uncheck "Automatically rearrange Spaces based on most recent use"
    4. Reboot
That should do it for you.  :)

If you still have problems, download and install MacKeeper or MacBooster, and follow the optimization instructions provided. 

How to Upgrade Windows 8 to 8.1 so you can then upgrade to Windows 10

To say that upgrading from Windows 8 to 8.1 can be a pain is an understatement.  I'm helping out this one person right now who keeps getting stuck at 82% during the upgrade.  So I thought I'd compile some info around the upgrade process.  Hopefully this journey will bear fruit for everyone having these issues.

To upgrade the operating system to Windows 8.1 following these steps exactly:
  1. Disconnect any external devices connected to the computer like printers, cameras, smartphones, scanners, USB drives, etc. that aren't essential to the upgrade. You can always plug them back in and install them AFTER you get the upgrade done. Obviously the mouse and the keyboard will need to remain plugged in. 
  2. Uninstall ALL antivirus or internet security software before you begin, so they don't interfere with the setup program. This is VERY IMPORTANT. And hey, don't worry, the Windows Defender software will still be running on windows, so it'll keep your system safe during the upgrade process. 
  3. Make sure you install any pending Windows upgrades before you start the upgrade to 8.1. 
  4. If your PC comes with custom "help desk" software that helps you install upgrades/device drivers/bios/firmware updates be sure and do that as well. 
  5. Now do a clean boot of your machine by following the steps outlined here:
  6. Start the upgrade to Windows 8.1
The upgrade will take some time but you should be able to get through it without issue.  If you do have issues, such as getting stuck at 82% for a long time here are some things you can try:
  • Wait for at least an hour before trying anything else.  Many people have reported 45-60m or more wait times and then all of a sudden it continues on.  Knowing what I know about how things are done, this is likely because any devices the setup has trouble with will eventually TIMEOUT.  No idea how long the time out is, or how many times it RETRIES before giving up.  Just be patient, it may work itself out.
  • If things still don't clear up, it's likely that setup is getting stuck on a device driver setup of some sort.  So here are a few things to try, and yes some of them may seem crazy but I'm just compiling a list of things folks have reported seems to work for them:
    • A number of users have reported that unplugging their power from their laptop for a few moments allowed them to get past this point.  It's worth a try, don't ask me why.  Thanks Microsoft!
    • Go to the device manager and uninstalling all NON-ESSENTIAL devices such as (don't worry, you can reinstall this stuff AFTER the upgrade):
      • bluetooth devices
      • printers/all-in-one devices
      • webcams
      • camera/smartphone drivers
      • scanners
      • any older devices you may have had for a while that could hang things up
  • I'll add more trouble shooting tips here as I come across them.
Once you manage to get your PC updated to Windows 8.1 you can move onto Windows 10. Use the following link to do the upgrade:
Here are a couple other useful links from Microsoft on this topic:

Thursday, September 10, 2015

How to Fix Issue Where Windows 10 won't Wake Up From Sleep Mode

Here are the steps to fix the issue where windows 10 won't wake up from sleep mode:

  1. Settings > System > "Power and Sleep"
  2. Select "Additional Power Settings"
  3. Change the settings for the currently selected plan (i.e. "Balanced")
  4. Now select "Change Advanced Power Settings"
  5. Select "Hard Disk" and set the value to a higher value than the default 20 minutes.

Using Lawnchair in Angular

In case you're looking for a way to call lawnchair from angularJS, here's a handy service factory:

  .factory("LawnchairFactory", function($window, $log, $parse) {
    return function(name, config) {
      var collection = {};
      var array = [];
      var isArray = config && config.isArray;
      var idGetter = $parse((config && config.entryKey) ? config.entryKey : "id");
      var transformSave = (config && config.transformSave) ? config.transformSave : angular.identity;
      var transformLoad = (config && config.transformLoad) ? config.transformLoad : angular.identity;
  
      function getEntryId(entry){
        try {
          return idGetter(entry);
        } catch(e) {
          return null;
        }
      }
  
      function lawnchairBucket(callback) { return new Lawnchair({name:name}, callback); }
  
      function saveEntry(data,key) {
        key = key.toString();
        if(angular.isObject(data) && data !== collection[key]){
          collection[key] = collection[key] || {};
          angular.extend(collection[key], data);
        } else {
          collection[key] = data;
        }
        var update = {key:key, value:transformSave(collection[key])};
  
        try {
          lawnchairBucket(function() { this.save(update); });
        } catch(e) {
          if (e.name === "QUOTA_EXCEEDED_ERR" || e.name === "NS_ERROR_DOM_QUOTA_REACHED") {
            $window.localStorage.clear();
          }
          $log.info("LocalStorage Exception ==> " + e.message);
        }
      }
  
      function updateArray(data){
        array.length = 0;
        _.each(data,  function(o) { array.push(o); });
        return array;
      }
  
      function updateCache(obj,key) {
        if(obj && angular.isObject(obj) && collection[key] && collection[key] !== obj){
          angular.extend(collection[key], obj);
        } else {
          collection[key] = obj;
        }
      }
  
      function updateCacheFromStorage(cache, storage) {
        if(storage){
          if(angular.isObject(storage.value) && angular.isObject(cache)) {
            angular.extend(cache, transformLoad(storage.value));
          } else {
            cache = transformLoad(storage.value);
          }
          updateCache(cache, storage.key);
        }
        return cache;
      }
  
      function allAsCollection(callback){
        lawnchairBucket(function() {
          this.all(function(result) {
            angular.forEach(result, function(o) { updateCache(o.value, o.key); });
            if(callback){
              callback(collection);
            }
          });
        });
        return collection;
      }
  
      function allAsArray(callback){
        return updateArray(allAsCollection(function(data){
          updateArray(data);
          if(callback){
            callback(array);
          }
        }));
      }
  
      function removeEntry(key) {
        delete collection[key];
        lawnchairBucket(function() { this.remove(key); });
      }
  
      function getDefault(key) {
        if(collection[key]) {
          return collection[key];
        } else {
          var  d = {};
          idGetter.assign(d,key);
          return d;
        }
      }
  
      var lawnchair = {
        collection: collection,
        save: function(data, key, clear) {
          if(!data){
            data = collection; // if nothing is set save the current cache
            key = null;
          }
  
          if (angular.isArray(data)) {
            angular.forEach(data, function(e, index) { saveEntry(e, getEntryId(e) || index); }); // Save a Array
          } else if(key || (data && getEntryId(data))) {
            saveEntry(data, key || getEntryId(data)); // save one entry
          } else {
            angular.forEach(data, saveEntry); // save a collection
          }
  
          if(clear) {
            var newIds = angular.isArray(data) ? _.chain(data).map(getEntryId).map(String).value() : _.keys(data);
            _.chain(collection).keys().difference(newIds).each(removeEntry);
            // remove entries wihtout ids
            _.chain(collection).filter(function(entry){ return !getEntryId(entry); }).keys().each(removeEntry);
          }
  
          if(isArray){
            updateArray(collection);
          }
        },
        batch: function(keys, target, callback) {
          var cache = _.chain(keys).map(function(k){ return getDefault(k);}).value();
          if(target && angular.isArray(target)){
            target.length = 0;
            _.each(cache,  function(o) { target.push(o); });
          } else {
            target = cache;
          }
  
          lawnchairBucket(function() {
            this.get(keys, function(result) {
              if(result){
                for(var i = result.length - 1; i >= 0; i--){
                  target[i] = updateCacheFromStorage(target[i], result[i]);
                }
              }
              if(callback){
                callback(target);
              }
            });
          });
          return target;
        },
        get: function(key, callback) {
          var value = getDefault(key);
          lawnchairBucket(function() {
            this.get(key, function(result) {
              if(result){
                value = updateCacheFromStorage(value, result);
              }
              if(callback){
                callback(value);
              }
            });
          });
          return value;
        },
        all: isArray ? allAsArray : allAsCollection,
        remove: removeEntry,
        nuke: function() {
          lawnchairBucket(function() { this.nuke(); });
        },
        destroy: function() {
          for (var key in collection){
            delete collection[key];
          }
          lawnchairBucket(function() { this.nuke(); });
        }
      };
      return lawnchair;
    };
  })