Mar 26 2017

Breaking the rules.

Category: Weirderm @ 1:51 am

Has this statement been disproved?

“No words in the English Language Rhymes with month, Orange, silver or purple?”

I’ve got a silver sliver
and an orange
home on the range
built on the fourth month
in a purple whiffle waffle rain.

The boss (wife) says no, but I figured I’d share it anyways.


Apr 18 2016

Dirty detection of a multi-dimentional javascript object

Category: Deverm @ 1:44 pm

I’m not sure what to call this.  It’s a proxy handler that watches the dirty state of an object.  I don’t know why, but I’m kinda proud of this.  It also has the ability to ignore fields.  The main goal is to have a mechanism to indicate if you should save an object or not.  In other words:

if (obj.dirty) { save(obj); }

window.objHandler = {
    dirty: false,
    ignore: [],
    get: function(target, name) {
        if (name != "dirty" && name != "ignore") {
            return name in target ? target[name] : undefined;
        }
        if (name == "ignore") {
            return this.ignore;
        }
        if (name == "dirty") {
            // console.log("get dirty:", target);
            if (this.dirty) {
                return true;
            }
            if (typeof target == "object") {
                if (target.dirty) {
                    return true;
                }
                for (k in target) {
                  if (typeof target[k] == "object" && target[k].dirty) {
                      return true;
                  }
                }
            }
            return this.dirty;
        }
        return undefined;
    },
    set: function(target, name, value) {
        if (name == "dirty") {
            this.dirty = value;
            if (typeof target == "object") {
                for (k in target) {
                    if (typeof target[k] == "object") {
                        target[k].dirty = value;
                    }
                }
            }
            return;
        }
        if (name == "ignore") {
            this.ignore = value;
            return;
        }
        if (angular.equals(target[name], value)) {
            return;
        }
        if (this.ignore.indexOf(name) == -1) {
            this.dirty = true;
        }
        var _type = typeof value;
        if (_type == "object") {
            // console.log("making proxy:", value);
            value = new Proxy(value, window.objHandler);
            value.dirty = true;
        }
        target[name] = value;
    }
};

var p = new Proxy({}, window.objHandler);
p.obj = {"foo":"bar"};
if (!p.dirty) {
    console.log("FAIL", "!p.dirty", "p should be dirty because obj was set");
}
if (!p.obj.dirty) {
    console.log("FAIL", "!p.obj.dirty", "p.obj should be dirty because it's new?");
}
p.obj.dirty = false;
if (p.obj.dirty) {
    console.log("FAIL", "p.obj.dirty", "Shouldn't be dirty because p.obj.dirty = false;");
}
if (p.dirty) {
    console.log("FAIL", "p.dirty", "Should still be dirty p.obj.dirty = false;");
}
p.dirty = false;
if (p.dirty) {
    console.log("FAIL", "p.dirty", "Should be clean");
}
p.obj.foo = "baz";
if(!p.dirty) {
    console.log("FAIL", "p.dirty should be true");
}

if (!p.obj.dirty) {
    console.log("FAIL", "p.obj.dirty should be true");
}
p.dirty = false;
if(p.obj.dirty) {
    console.log("FAIL", "p.obj.dirty should not be dirty");
}



console.log("p.dirty:",p.dirty);
console.log("p.obj.dirty", p.obj.dirty);
p.str = "string value";
p.integer = 1;
p.dec = 1.1;
console.log(JSON.stringify(p,null, "\t"));
console.log("p.dirty", p.dirty);
p.dirty = false;

 

 

Output:

p.dirty: false
p.obj.dirty false
{
	"obj": {
		"foo": "baz"
	},
	"str": "string value",
	"integer": 1,
	"dec": 1.1
}
p.dirty true


Jan 07 2016

Ionic framework

Category: Dev,Family Media Player,Techerm @ 2:43 am

It’s time to break radio silence. I’m mostly doing this because of something I heard in an interview from the owner of the Drudge Report said on Info Wars. Go ahead point your fingers, call me whack-a-doodle.

Lately I’ve been working with the Ionic framework to develop an android app for FMP.


Sep 16 2013

Conjurer Attack Macro

Category: Final Fantasy 14:ARRerm @ 7:18 pm


/echo Stone 1
/ac "Stone"
/wait 3
/echo Aero 2
/ac "Aero"
/wait 3
/echo Stone II 3
/ac "Stone II"
/echo ===[Conjurer Attack Complete]===


Sep 16 2013

prime factorization

Category: Homeworkerm @ 6:31 pm

Today I learned an easy way to do prime factors from my son. We were working on his homework. We’ll build a prime factor tree to accomplish this. I know a lot of you already know this stuff, but I don’t think I learned it in school, and if I did. I have forgotten it.

In case you don’t know what a prime number is, it’s a number that can’t be divided into any other number and get a 0 remainder.

I believe prime numbers up to 13 are.
0, 1, 2, 3, 5, 7, 9, 11, 13

However we aren’t going to use the first 2 because 0 and 1 can be divided into anything. We’re trying to find the primes from 2 to 13.

Pick a number any number any number.

  80
 /  \
8   10

8×10 = 80

     80
    /  \
   8    \
  / \    \
[2]   4   \
          10

2 x 4 = 8
We’ve found our first prime which is 2.

     80
    /  \
   8    \
  / \    \
[2]   4   \
     / \   \
   [2] [2] 10

We’ve now found our next prime numbers because 2 x 2 = 4
So far our lowest prime numbers are 2 x 2 x 2 = 8

     80
    /  \
   8    \
  / \    \
[2]   4   \
     / \   \
   [2] [2] 10
          /  \
        [2]  [5]

We have now found our last 2 prime numbers 2 and 5.

So in the end our prime factorization is: 2 x 2 x 2 x 2 x 5 = 80

I’m so glad my son is teaching me math. This is fun stuff.


Sep 15 2013

Arcanist Macro

Category: Final Fantasy 14:ARRerm @ 10:26 pm

You may need to remove /ac “Areo” if you don’t have it, but this is what I’m using. Pointers given to me by my guild leader Club.


/echo .
/ac "Bio"
/wait 2.5
/echo ..
/ac "Aero"

/wait 2.5
echo ...
/ac "Miasma"

/wait 2.5
echo ....
/ac "Ruin"

/wait 2.5
/echo ===[Arcanist Attack Complete]===

You can run while casting Bio & Aero

/echo .
/ac "Bio"
/wait 2.5
/echo ..
/ac "Aero"

/wait 2.5
/echo ===[Arcanist Running Attack Complete]===


Dec 27 2012

php trash day script

Category: phperm @ 10:25 pm

Trash days on Monday suck.
I constantly forget to take out the trash on Saturday when there is a holiday on Monday. I dusted off the old trash-day-php script and installed it.

Installation is pretty simple.
Edit the script with the values you want.
place it in /etc/cron.daily/trash-day-php
chmod +x /etc/cron.daily/trash-day-php

cron doesn’t like . in filenames. Thats why I named the file trash-day-php not trash-day.php.

To test your email just run /etc/cron.daily/trash-day-php –test

Continue reading “php trash day script”


Dec 07 2012

enable/disable hibernate/suspend pygtk status icon

Category: pygtkerm @ 12:33 am

Every once in a while my machine runs stuff in the background, like backups, db dumps and whatnot. This obviously causes performance issues at times, but among other things I don’t want to shutdown during these processes.

So I created a simple status icon to warn me if one of those processes were executing so I wouldn’t shutdown the machine, and it also will disable hibernate/suspend.

I figure I’d share it with the world.

Continue reading “enable/disable hibernate/suspend pygtk status icon”


Next Page »