header-image

Software Development Notes

Ted Neustaedter's Software Development Notes

Blog

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;
};
})

Ask me anything computer related, really.

Last year I was the head coach of my son’s hockey team and volunteered a great deal of my time to minor hockey.  The year started out great, and I really enjoyed things, until toward the end of the season.  After that, well, let’s just say volunteering just isn’t worth the grief we take sometimes.

This year, instead, I’m going to focus on what I do best. All things computer wise.

So, ask me anything.

  • Got a problem with your Mac or PC?  
  • Is your Windows box giving you grief?  
  • Has your PC slowed down to the point where you want to throw it against the wall?  
  • Need some advice on what antivirus and/or internet security tools to buy?
  • Having trouble getting onto your wireless network?
  • Trying to understand how Netflix works?
  • Wondering how to use your iPhone or Android device?
Honestly, if it’s computer related, and you need some help, I’m here for you.
Best way to reach me, is by clicking the button below and sending me a tweet, as I check my twitter account regularly.  From there we can converse and I’ll see if I can’t help you figure things out.
Tweet me your question

Oh, and don’t forget to follow me on twitter as well, cuz sometimes I tweet out stuff that you might find helpful, other times I just aims to amuse.  ðŸ™‚

TELUS HTC One Android Jelly Bean 4.3 Update Problems

If you’re having trouble getting the new HTC One Android Jelly Bean 4.3 to work (it gets to about 20% and then restarts repeatedly), I discovered a problem with the updater.  It won’t work if you have GO Launcher (or any launcher that matter) aside from HTC Sense as your default launcher.

So… TURN OFF the GO Launcher or whatever one you’re using.

Here’s how to turn off GO Launcher:

From your desktop click on the “…” button, and go to Preferences, then turn off as the default launcher, and EXIT the app.

Now it’ll work just fine.

Trouble with OUYA Drivers in Windows 7

I was having all sorts of problems with the OUYA and OUYA Console drivers in windows, and I wasn’t using ADB because I’m working with GameMaker Studio.

Timothy Graupmann’s tutorial on how to get things working worked for me.  In my case, I had to install the SDK not the ADB, and so it’s important to set the PATH to point to the tools and platform-tools folders after install, but once this is done, everything else works if you follow his tutorial step by step.

http://www.youtube.com/watch?feature=player_embedded&v=454JFvFTxww

Solving the “xinput1_3.dll not found” problem

If you get the error “xinput1_3.dll not found”, whether you’re using GameMaker Studio or any other application, the answer is simple, you need to fix your DirectX install.  The link below works great.  I had this issue and after running the following (it’s a simple install) things worked great for me.

In my case, I couldn’t get GamePad support in GameMaker Studio, I was getting the error message “xinput1_3.dll not found. Gamepad support disabled”, so that’s what I did to fix it.

http://www.microsoft.com/en-us/download/confirmation.aspx?id=35

How to Active Windows 8 Pro (Upgrade) on a Clean Install

If you use the Windows 8 Pro Upgrade to install on a clean PC (or VM), and can’t activate it because you get the following error:

Code: 0xC004F061 

Description: The Software Licensing Service determined that this specified product key can only be used for upgrading, not for clean installations.

…then here are the steps to workaround the issue:

  1. In Windows 8, press [Windows Key]+[8], and type REGEDIT
  2. Navigate to the registry key HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/Setup/OOBE 
  3. Change the value of MediaBootInstall to 0 (it’s default value is 1
  4. Go to the Start screen and start typing “Command Prompt” (this will cause the search for apps sidebar to open up and on the left the [Command Prompt] application will appear. 
  5. Right click on [Command Prompt] and choose “Run as Administrator” from the bottom 
  6. Type: slmgr /rearm and press [Enter] 
  7. Click OK when the window comes up to tell you that windows has been rearmed. 
  8. Type: shutdown -r and press [Enter] 
  9. Once Windows 8 has restarted, login and run activation again. 

Your Windows 8 Pro will now be activated. Enjoy!

Visual Studio 20120 Setup Project: Unable to update the dependencies of the project

So this happens to me every now and again.

Here’s are some workarounds I’ve used:

  1. Simply shutdown Visual Studio 2010, restart and rebuild.  This seems to fix the problem most times.
  2. If option #1 doesn’t work, do the following:
    1. Remove the offending project(s) from the solution
    2. Go to the folder where the project lives and delete everything except the project itself.
    3. Re-add the project to the solution
    4. Rebuild.
Visit Us On LinkedinVisit Us On FacebookVisit Us On TwitterVisit Us On YoutubeCheck Our FeedVisit Us On Instagram