Welcome to my website. I am always posting links to photo albums, art, technology and other creations. Everything that you will see on my numerous personal sites is powered by the formVistaTM Website Management Engine.

icon.linkedin.jpgicon.twitter.jpg

  • Subscribe to this RSS Feed
  • Bash Style Guide and Coding Standard
    04/24/2012 9:05AM

    A great resource for bash coding conventions (the PDF is also available as an attachment to the blog post).

    http://lug.fh-swf.de/vim/vim-bash/StyleGuideShell.en.pdf

    Attachment: styleguideshell.en.pdf 134241 bytes
  • Yum Proxy Configuration with an @ (at) Character in Your User Name or Password
    04/23/2012 11:35AM
    If you want to set up yum.conf to talk to repos via a proxy server AND you have an @ sign in your user name or password, try replacing the @ with the url encoded equivalent of '%40'
  • Problem Adding a Network Printer Under Windows 7 on a Samba Share
    04/20/2012 11:04PM

    Ah, Windows.  It still has it's old, quirky, you-just-can't-wait-for-MicroSoft-to-go-out-of-business charm.

    But seriously, if you are having trouble adding a printer on a Samba share on a Linux host try the following:

    • After you authenticate to the Samba share, make sure that you actually open up a window displaying the contents of the home directory.  For some reason, just authenticating to the Samba share will not get you access to the Samba servers list of shared printers.
    • If the searching for printers window hangs without displaying the Samba share's printers, hit the cancel button, close the window and try it again.
  • Syntax for Dynamically Generating JSON in JavaScript to be Output to HTML
    04/11/2012 4:50PM

    Should you find yourself in a situation where you want to call a function (or method) that accepts JSON data parameters that you want to actually print to the browser to be invoked on some sort of callback (onchange, onclick, etc).

    Given the following function:

    doSomething(JSONparam) {
        // Something happens in here . . .
    }

    Here is the syntax for rendering an onclick link that is generated in JavaScript and then output to the DOM:

    var $markup = '<a href="some/url.html" onclick="doSomething({\'key1\':\'value'\, \'key2\':\'value\'}); return false;">Some link</a>';

  • Simple Solution for JavaScript Object Packages and Namespaces
    03/26/2012 11:14AM

    Most OO programers are familiar with packages.  This enables programmers to group like classes together in a logical order and provide some namespace to avoid class name collisions.

    I have seen a variety of JavaScript sugar implementations that are mostly unintelligible.

    I like things that are simple and easy to understand.

    So, if you have a JavaScript class that looks like:

    /**
     * Constructor
     */
    com.ryanchapin.Base = function() {

        //
        // Constructor does something here . . .
        //
    }

    //----------------------------------------------------------------------------
    // Properties:
    //

    /**
     * Some property
     */
    com.ryanchapin.Base.prototype.someProperty;

    //----------------------------------------------------------------------------
    // Methods:
    //

    com.ryanchapin.Base.prototype.doSomething = function() {

        //
        // Do something here . . . .
        //
    }

    Then all you need to do is add something similare to the following as the top-most block of JavaScript on the page:

    <script type="text/javascript">

                // Instantiate 'package/namespace', containing object
                var com = new Object();
                com.ryanchapin = new Object();


                // Then you can instantiate your objects as follows:
                var baseInst = new com.ryanchapin.Base();

    </script>

    This will create the 'container' object in which your class definitions will reside and help reduce the use of global variables as well as class name and method name collisions.

Advanced Search

Categories

Archives