Blog posts about frax

  • Use string.format in javascript

    August 30, 2011 | Tags: Javascript, Frax, Snippet
    This is a pretty neat snippet that attaches a format function to the string object. Works with infinit number of arguments: mystring.format('{0} and {1} and {2} and etc..', 'one', 'two', 'three');
    <script type="text/javascript">
          
    String.prototype.format = function() {
    var formatted = this;
    for (i=0;i<arguments.length;i++) {
    formatted = formatted.replace("{" + i + "}", arguments[i]);
    }
    return formatted;
    };

    alert('{0} is {1}!'.format('this','awesome'));
    </script>

    Code provided by my college Axtelius.

  • Sync user and login for SQL database

    February 01, 2011 | Tags: Frax, Database, Troubleshooting, SQL, Snippet
    Got a login on your SQL server and the same user in a database but they are not connected? Even though the names are the sames the unique IDs are not. Here's a snippet from my college Fredrik that's very useful connecting the user name between server login and database user. Replace 'user' with 'your user name':
    EXEC sp_change_users_login 'Auto_Fix', 'user'

    And a small celebration! This is the 100th post :)