Friday, July 25, 2014

Unknown class 'foo' -- Geppetto not recognizing dependencies in your puppet code?

Check your Modulefile. Update your dependencies there via the tab on the bottom and verify the change in your metadata.json .

Poof, your puppet include finally will be recognized as a valid class that was found and when someone installs your script, then it will dig up the dependencies if necessary.

Saturday, June 28, 2014

rebeccapurple, digging into mozilla firefox

Why? Digital-remembrance for a life taken too early and in support of a man that unbenknownst to me makes my life better and easier. But, also that we share friends, who tapped me. And I got on board.

My first two files ready for committing:

./aurora/content/base/test/test_html_colors_standards.html

./aurora/content/base/test/test_html_colors_quirks.html

However, I have no commit access to the mozilla firefox repos.

(Womp womp womp woaoamp. Play the sad music.)

The rest need tweaked still. Currently mulling over whether Mozilla Bug Report 456826 applies to my source editing task.

Friday, April 25, 2014

HP LaserJet 2015 Ethernet Conversion

So, I ordered a HP LaserJet 2015dn from ebay. The seller wasn't quite the worst at packing packages. (A contender, a close second for sure.) That in conjunction with the shipping company obviously using it for a few frames of bowling practice left it in the condition I received it in.

I obviously didn't learn anything from the encounter. After I got all my money back free and clear, I go ahead and order a second printer from the same seller. (Say it ain't so.) The second printer was a 2015d, i.e., no networking feature.

Feast your eyes on the photos below. The only changes are the stickers, a little removable plastic cover where the Ethernet plug gains entry to the device, and the formatter board. That last one being most important detail.

To save you a minute or two, pry the side panel off from the rear along the vertical edge. You'll need a #2 Phillips from there.




Wednesday, April 9, 2014

Spritz Reading

I read about Spritz a short while ago. And I thought it was really cool. The problem is that Spritz Inc., the innovators behind Spritz weren't going to provide an implementation or SDK or whatever that I could use in the timeframe I was interested in. I assume that their implementation is better, so definitely check on them as they said implementations are coming and they will possibly be free to use.

In the mean time, I have made a JavaScript implementation that you are free to use or modify under the MIT license. I will pencil in that it is the "don't ask me" license as well. You can use it more or less in any way you see fit if you don't ask me anything about it. My slowly evolving code will be posted to Github. I also have it on CodePen and jsFiddle.

Also, for the Android crowd, be sure to check out Glance. It is a neat project which also has it's source code that can be found on Github

Thursday, April 25, 2013

Census data for Zip Code Geolocation - MySQL inserts

I have extracted the data built by the US Census Bureau in regards to the general geolocation of a zipcode. This information is not exact-- but is exactly 'good enough for government work'.

MySQL-inserts-for-census-zip-code-geolocation on GitHub

Wednesday, April 10, 2013

Sorting columns on Netflix

So, it is 2013 and jQuery makes sorting elements in an HTML table a trivial matter (jQuery sorting examples, tutorials, etc.). Add to that the fact Netflix is already using jQuery on their site and, furthermore, the specific page I am referring to (Netflix Instant Queue).

My instant queue, why are the columns not sortable?


The eclectic viewing selections on my Logitech Revue aside, you can see my cursor on 'Star Ranking' in the image below. That is the text selection cursor indicating that it does not have the interactivity I think should be there-- i.e. sorting on a column.


Netflix Screen Capture Showing Unsortability

Monday, January 14, 2013

Change Permissions by File Type

I recently have had to figure out how to allow others, the slightly privileged masses, to traverse my directory structure even if they cannot see anything or do anything with most of it.

find /directory -type d -exec chmod 771 {} \;


Where the /directory is where you want your search to start.

Saturday, December 8, 2012

MySQL timestamp versus datetime

Storing a date according to UTC and automatically converting to the localized time upon retrieval, the way the MySQL database field type does, is something that appeals to me.

But, it looks as though the MySQL datetime type will store a date in excess of the UNIX 2038 date limit.

Friday, November 16, 2012

PHP Objects to XML

What worked for me was to populate object properties with other objects that have one or more of their own properties. (Credit goes to the venerable James Thompson for pointing this out to me.)

<?php

//So first we need an object of objects.

class rootObject {
    public $root;

    public function populateRoot() {
        $root=new singleFirstTierObject();
        $root->populateSingleFirstTier();
        $this->root=$root;
    }
    public function toXML() {
        $serializer = new XMLSerializer();
        return  $serializer->objToXML($this);
    }
}

class singleFirstTierObject {
    public $singleFirstTier;
    public $singleOtherFirstTier;

    public function populateSingleFirstTier() {
        $singleFirstTier=new singleSecondTierObject();
        $singleFirstTier->populateSingleSecondTier();
        $this->singleFirstTier=$singleFirstTier;
       
        $singleOtherFirstTier=new multipleSecondTierObject();
        $singleOtherFirstTier->populateSingleSecondTier();
        $this->singleOtherFirstTier=$singleOtherFirstTier;
    }
}

class singleSecondTierObject {
    public $singleSecondTier;

    public function populateSingleSecondTier() {
        $this->singleSecondTier='singleSecondTier';
    }
}

class multipleSecondTierObject {
    public $singleSecondTier;
    public $singleOtherSecondTier=array();

    public function populateSingleSecondTier() {
        $this->singleSecondTier='singleSecondTier';
        $argumentArray=array();
        for($i=0;$i<5;$i++) {
            $arrayComponent=new multipleThirdTier();
            $arrayComponent->populateMultipleThirdTier();
            $argumentArray[]=$arrayComponent;
        }
        $this->singleOtherSecondTier=$argumentArray;
    }
}

class multipleThirdTier {
    public $multipleThirdTier;
       
    public function populateMultipleThirdTier() {
        $this->multipleThirdTier='multipleThirdTier';
    }
}

$object = new rootObject();
$object->populateRoot();

echo "<hr />\n<pre>\$object: <br />\n";
echo print_r($object);
echo "</pre><hr />\n";

//Now we have an object that will translate into XML via the XMLSerializer class below using the toXML function in the rootObject class.

//http://www.akchauhan.com/php-class-for-converting-xml-to-object-and-object-to-xml/
class XMLSerializer {
    private static $xml;

    // Constructor
    public function __construct() {
        $this->xml = new XmlWriter();
        $this->xml->openMemory();
        $this->xml->startDocument('1.0');
        $this->xml->setIndent(true);
    }

    // Method to convert Object into XML string
    public function objToXML($obj) {


        $this->getObject2XML($this->xml, $obj);

        $this->xml->endElement();

        return $this->xml->outputMemory(true);
    }

    // Method to convert XML string into Object
    public function xmlToObj($xmlString) {
        return simplexml_load_string($xmlString);
    }

    private function getObject2XML(XMLWriter $xml, $data) {
        foreach($data as $key => $value) {
            if(is_object($value)) {
                $xml->startElement($key);
                $this->getObject2XML($xml, $value);
                $xml->endElement();
                continue;
            }
            else if(is_array($value)) {
                $this->getArray2XML($xml, $key, $value);
            }

            if (is_string($value)) {
                $xml->writeElement($key, $value);
            }elseif(is_numeric($value)) {
                $xml->writeElement($key, $value);
            }
        }
    }

    private function getArray2XML(XMLWriter $xml, $keyParent, $data) {
        foreach($data as $key => $value) {
            if (is_string($value)) {
                $xml->writeElement($keyParent, $value);
                continue;
            }

            if (is_numeric($key)) {
                $xml->startElement($keyParent);
            }

            if(is_object($value)) {
                $this->getObject2XML($xml, $value);
            }
            else if(is_array($value)) {
                $this->getArray2XML($xml, $key, $value);
                continue;
            }

            if (is_numeric($key)) {
                $xml->endElement();
            }
        }
    }
}

$xmlOutput1=$object->toXML();

echo "<hr />\n<pre>\$xmlOutput1: <br />\n";
echo $xmlOutput1;
echo "</pre><hr />\n";

//What if we want to add attributes or edit the XML object though?

$xmlObject = new SimpleXMLElement($xmlOutput1);

echo "<hr />\n<pre>\$xmlObject: <br />\n";
echo "Round 1: <br />\n";
echo print_r($xmlObject);
echo "</pre><hr />\n";

//$xmlObject->singleOtherFirstTier->singleOtherSecondTier[$child_count]->multipleThirdTier

$child_count=0;
foreach($xmlObject->singleOtherFirstTier->singleOtherSecondTier as $element){
    $xmlObject->singleOtherFirstTier->singleOtherSecondTier[$child_count]->multipleThirdTier->addAttribute('child-element',$child_count);
    $child_count++;
}

echo "<hr />\n<pre>\$xmlObject: <br />\n";
echo "Round 2: with new attributes <br />\n";
echo print_r($xmlObject);
echo "</pre><hr />\n";

//Sorry, I know you looked. But, you won't be able to see they are there. And what is worse if you want to access them similarly now that they exist, the attribute name will need encapsulated in {curly braces}.

//And we convert our SimpleXML object back into an XML string.

$xmlOutput2=$xmlObject->asXML();

echo "<hr />\n<pre>\$xmlOutput2: <br />\n";
echo $xmlOutput2;
echo "</pre><hr />\n";

//Also, whitespace is a waste of bandwidth if you are talking to a machine.
//The following code will enable us to fine tune how we want whitespace handled by converting our data in an XML string into a DOM document object.

$domObject = new DOMDocument('1.0');
$domObject->preserveWhiteSpace = false; //self explanatory
   
$domObject->formatOutput = true; //false = no whitespace, true = human friendly tabbed indenting

//Now that we have a DOM document object with the settings we like let's load the XML string into it.
$domObject->loadXML($xmlOutput2);

//Last thing to do is output our finished DOM document object as XML document using the saveXML method.

echo "<hr />\n<pre>\$domObject->saveXML(): <br />\n";
echo $domObject->saveXML();
echo "</pre><hr />\n";

?>
<hr />
<pre>$object: <br />
rootObject Object
(
    [root] => singleFirstTierObject Object
        (
            [singleFirstTier] => singleSecondTierObject Object
                (
                    [singleSecondTier] => singleSecondTier
                )

            [singleOtherFirstTier] => multipleSecondTierObject Object
                (
                    [singleSecondTier] => singleSecondTier
                    [singleOtherSecondTier] => Array
                        (
                            [0] => multipleThirdTier Object
                                (
                                    [multipleThirdTier] => multipleThirdTier
                                )

                            [1] => multipleThirdTier Object
                                (
                                    [multipleThirdTier] => multipleThirdTier
                                )

                            [2] => multipleThirdTier Object
                                (
                                    [multipleThirdTier] => multipleThirdTier
                                )

                            [3] => multipleThirdTier Object
                                (
                                    [multipleThirdTier] => multipleThirdTier
                                )

                            [4] => multipleThirdTier Object
                                (
                                    [multipleThirdTier] => multipleThirdTier
                                )

                        )

                )

        )

)
1</pre><hr />
<hr />
<pre>$xmlOutput1: <br />
<?xml version="1.0"?>
<root>
 <singleFirstTier>
  <singleSecondTier>singleSecondTier</singleSecondTier>
 </singleFirstTier>
 <singleOtherFirstTier>
  <singleSecondTier>singleSecondTier</singleSecondTier>
  <singleOtherSecondTier>
   <multipleThirdTier>multipleThirdTier</multipleThirdTier>
  </singleOtherSecondTier>
  <singleOtherSecondTier>
   <multipleThirdTier>multipleThirdTier</multipleThirdTier>
  </singleOtherSecondTier>
  <singleOtherSecondTier>
   <multipleThirdTier>multipleThirdTier</multipleThirdTier>
  </singleOtherSecondTier>
  <singleOtherSecondTier>
   <multipleThirdTier>multipleThirdTier</multipleThirdTier>
  </singleOtherSecondTier>
  <singleOtherSecondTier>
   <multipleThirdTier>multipleThirdTier</multipleThirdTier>
  </singleOtherSecondTier>
 </singleOtherFirstTier>
</root>
</pre><hr />
<hr />
<pre>$xmlObject: <br />
Round 1: <br />
SimpleXMLElement Object
(
    [singleFirstTier] => SimpleXMLElement Object
        (
            [singleSecondTier] => singleSecondTier
        )

    [singleOtherFirstTier] => SimpleXMLElement Object
        (
            [singleSecondTier] => singleSecondTier
            [singleOtherSecondTier] => Array
                (
                    [0] => SimpleXMLElement Object
                        (
                            [multipleThirdTier] => multipleThirdTier
                        )

                    [1] => SimpleXMLElement Object
                        (
                            [multipleThirdTier] => multipleThirdTier
                        )

                    [2] => SimpleXMLElement Object
                        (
                            [multipleThirdTier] => multipleThirdTier
                        )

                    [3] => SimpleXMLElement Object
                        (
                            [multipleThirdTier] => multipleThirdTier
                        )

                    [4] => SimpleXMLElement Object
                        (
                            [multipleThirdTier] => multipleThirdTier
                        )

                )

        )

)
1</pre><hr />
<hr />
<pre>$xmlObject: <br />
Round 2: with new attributes <br />
SimpleXMLElement Object
(
    [singleFirstTier] => SimpleXMLElement Object
        (
            [singleSecondTier] => singleSecondTier
        )

    [singleOtherFirstTier] => SimpleXMLElement Object
        (
            [singleSecondTier] => singleSecondTier
            [singleOtherSecondTier] => Array
                (
                    [0] => SimpleXMLElement Object
                        (
                            [multipleThirdTier] => multipleThirdTier
                        )

                    [1] => SimpleXMLElement Object
                        (
                            [multipleThirdTier] => multipleThirdTier
                        )

                    [2] => SimpleXMLElement Object
                        (
                            [multipleThirdTier] => multipleThirdTier
                        )

                    [3] => SimpleXMLElement Object
                        (
                            [multipleThirdTier] => multipleThirdTier
                        )

                    [4] => SimpleXMLElement Object
                        (
                            [multipleThirdTier] => multipleThirdTier
                        )

                )

        )

)
1</pre><hr />
<hr />
<pre>$xmlOutput2: <br />
<?xml version="1.0"?>
<root>
 <singleFirstTier>
  <singleSecondTier>singleSecondTier</singleSecondTier>
 </singleFirstTier>
 <singleOtherFirstTier>
  <singleSecondTier>singleSecondTier</singleSecondTier>
  <singleOtherSecondTier>
   <multipleThirdTier child-element="0">multipleThirdTier</multipleThirdTier>
  </singleOtherSecondTier>
  <singleOtherSecondTier>
   <multipleThirdTier child-element="1">multipleThirdTier</multipleThirdTier>
  </singleOtherSecondTier>
  <singleOtherSecondTier>
   <multipleThirdTier child-element="2">multipleThirdTier</multipleThirdTier>
  </singleOtherSecondTier>
  <singleOtherSecondTier>
   <multipleThirdTier child-element="3">multipleThirdTier</multipleThirdTier>
  </singleOtherSecondTier>
  <singleOtherSecondTier>
   <multipleThirdTier child-element="4">multipleThirdTier</multipleThirdTier>
  </singleOtherSecondTier>
 </singleOtherFirstTier>
</root>
</pre><hr />
<hr />
<pre>$domObject->saveXML(): <br />
<?xml version="1.0"?>
<root>
  <singleFirstTier>
    <singleSecondTier>singleSecondTier</singleSecondTier>
  </singleFirstTier>
  <singleOtherFirstTier>
    <singleSecondTier>singleSecondTier</singleSecondTier>
    <singleOtherSecondTier>
      <multipleThirdTier child-element="0">multipleThirdTier</multipleThirdTier>
    </singleOtherSecondTier>
    <singleOtherSecondTier>
      <multipleThirdTier child-element="1">multipleThirdTier</multipleThirdTier>
    </singleOtherSecondTier>
    <singleOtherSecondTier>
      <multipleThirdTier child-element="2">multipleThirdTier</multipleThirdTier>
    </singleOtherSecondTier>
    <singleOtherSecondTier>
      <multipleThirdTier child-element="3">multipleThirdTier</multipleThirdTier>
    </singleOtherSecondTier>
    <singleOtherSecondTier>
      <multipleThirdTier child-element="4">multipleThirdTier</multipleThirdTier>
    </singleOtherSecondTier>
  </singleOtherFirstTier>
</root>
</pre><hr />

 

Are there more compact and elegant ways to do this? Sure. But, this gets the job done.

Thursday, October 11, 2012

Automatic Touchpad Disable While Typing in Ubuntu (Kubuntu)

If you are running Ubuntu or an Ubuntu variant (like me using Kubuntu) then you can:

sudo apt-get install gsynaptics


to get additional options for the configuration of your Synaptics or Synaptics compatible touchpad. --I've been grazing the touchpad while typing, but there is a feature that disables the touchpad for a short while if a keyboard key is touched. Huge reduction in stupid and annoying accidental typo corrections.

Wednesday, September 26, 2012

Recursive String Replacement

find /recursive/replace/directory/ -type f -exec sed -i 's/properlyescapedsearchstring/properlyescapedreplacementstring/g' {} +

by properly escaped, I mean using the backslash character(\) before special characters ( \. \/  \\ )
I should make myself a tool for this.

Installing the Papyrus Eclipse Plugin

The software source you will need is:
http://download.eclipse.org/modeling/mdt/papyrus/updates/releases/juno/main

Then you will need to install the modeling libraries from eclipse.org. I ended up just installing them all.

For whatever reason, I did not have a 'palette' tool box on my first model. It is there now, I created a new specific model (use case checkbox) with basic primitive types (checkbox) and they were magically there-- if you don't see any way to add diagram graphics via the 'palette'.

About Cloned Wordpress Servers and Logging In to the Wrong Server

So, I cloned an entire server as a development environment.

On that server was a wordpress installation.

The server was logging in to the wrong wordpress installation.

There is probably a 'correct' way to do this. But I found the wordpress options I needed to change in the wordpress database in the prefix_options table. (We have prefixes set to ON for multiple wordpress installations. Our tables are prefixed and referenced with prefix_ prepended in this post.)

SELECT * FROM prefix_options LIMIT 0,20;

From there, you should see why your new wordpress is logging you in to your old wordpress...

Hint:
mysql> select * from prefix_options limit 0,20;
+---------+-----------+-------------------------+--------+
|option_id|option_name|option_value             |autoload|
+---------+-----------+-------------------------+--------+
|        1|siteurl    |http://notdevelopment.com|yes     |


mysql> UPDATE prefix_options SET option_value='http://development.com' WHERE option_id=1;


Monday, September 24, 2012

Changing the default user and group for files in linux directories

Issue this command to have new files in the directory get set with the owner the same as the owner of the directory

chmod u+s

or issue this command to have new files in the directory get set with the group that is the same as the group of the directory

chmod g+s

also restricting deletion by any non-owner or privileged user is chmod +t to set the sticky bit

Capitalization is used to show whether the execute permission is set or not since these settings show up in the same spaces as the execute bit.

Here are a few examples that you might see if you ls -la:

rwSrwSrwT
(that means rwxrwxrwx with uid, gid, & sticky set)

rwxrwSrwt
(that means rwxrwxrw- with only the gid & sticky set)

Thursday, August 30, 2012

Kate Regex Search and Replace

If you are using the Kate text editor and you are going to use parenthesis to capture parts of your regex that you want to reuse (a submatch), the character you have to prepend is \, the backslash. But it isn't the dollar sign or any other character on Kate for Kubuntu Linux anyway.
So if you are wanting to switch wordsomething to somethingword in Kate, your regex will look like this (word)(something) and your replacement will look like this \2\1 to end up with somethingword when it is all done

wordsomething find (word)(something)

replace with \2\1 finishes with something word

Thursday, August 2, 2012

Best value web hosting

I have become a fan of VPS.net . I have been more than happily running a Debian instance of 2 nodes. I am extremely happy with the breadth of control I have over a portion of a server.

Granted, it is a lot more work than other hosts I have used because it is so much like having a raw machine-- but the response and flexibility of the platform is well worth the ~$20 per node and effort each month.

The successes and happiness with the outcomes of incremental efforts have made it so worth it.

We are using fusemail as our email service provider. They are sufficient at $2 per account each month. I would consider other providers.

Thursday, March 29, 2012

Get Column Names Text from MySQL

So, I was using describe table. But, then I found this which helps me reduce the amount of crap I have to pull out while creating a comma delimited list.

select column_name from information_schema.columns where table_name='tablename';

Followers