Thursday, May 7, 2015

Cleaning Excel Styles

The code below will clean the Excel styles:

Sub StyleKiller()
    Dim styT As Style
    Dim intRet As Integer

    For Each styT In ActiveWorkbook.Styles
        If Not styT.BuiltIn Then
            'intRet = MsgBox("Delete style '" & styT.Name & "'?", vbYesNo)
            'If intRet = vbYes Then styT.Delete
            styT.Delete
        End If
    Next styT
End Sub

Thursday, April 23, 2015

BootStrap Grid Size Classes

GRID SIZE CLASSES

Structure of Bootstrap classes for sizing grid content
  • col
    • Short for column
    • Required prefix
  • size abbreviation
    • xs for Extra small
    • sm for Small
    • md for Medium
    • lg for Large
  • Number of columns
    • Integer to represent the number of columns

EXAMPLES

Let's take a look at a couple of sample Bootstrap content sizing classes:
  • col-md-4 would indicate 4 columns for medium and large screens
  • col-sm-6 would indicate 6 columns for small, medium and large screens
  • col-xs-2 would indicate 2 columns for extra small, medium and large screens
Remember that screen size rules apply for the specified screen size as well as those larger than that size, unless overriden. So the following combination would indicate 2 columns for extra small screens, 6 columns for small screens, and 4 for medium and large screens.
<div class='col-xs-2 col-sm-6 col-md-4'>Content</div>

BootStrap

Visual Studio resources
Bootstrap resources

Tuesday, April 14, 2015

Dfferences between traditional coding and TDD

The traditional way of writing unit tests. The broken lines represent actions people treat as optional.
Test-driven development—a bird’s-eye view. Notice the spiral nature of the process: write test, write code, refactor, write next test. It shows the incremental nature of TDD: small steps lead to a quality end result.

Taken from: The Art of Unit Testing, Second Edition: with examples in C#. Author:Roy Osherove. 





Sunday, February 22, 2015

Show the Users Library Folder Permanently in OS X Yosemite

  • From the OS X Finder, open a new window and go to the users Home folder (hit Command+Shift+H to jump to Home instantly)
  • Pull down the “View” menu and select “Show View Options” (or hit Command+J if you like keyboard shortcuts)
  • Check the box for “Show Library Folder” then close the View Options panel
  • Navigate in the users home folder to see the newly visible “Library” directory













Taken from: http://osxdaily.com/2013/10/28/show-user-library-folder-os-x-mavericks/

Monday, January 26, 2015

Solaris persitent routes

route -p show

route  -p add -host 204.209.228.134 172.16.64.32

route  -p delete -host 204.209.228.134 172.16.64.32

Thursday, January 22, 2015

Profiling Code Using clock_gettime

#include <cstdlib>

#include <iostream>
#include <time.h>

using namespace std;

timespec diff(timespec start, timespec end);

/* Profiling code using clock_gettime
 * Link with the librt library (-lrt)
 */
int main(int argc, char** argv) {

    timespec time1, time2;
    int temp;

    clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time1);

    for (int i = 0; i < 242000000; i++)
        temp += temp;

    clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time2);

    cout << diff(time1, time2).tv_sec << ":" << diff(time1, time2).tv_nsec << endl;

    return 0;
}

/**
 * Returns a timespec of the difference between 2 timespec
 * @param start timespec structure
 * @param end timespec structure
 * @return timespec structure
 */
timespec diff(const timespec start, const timespec end) {
    timespec temp;

    if ((end.tv_nsec - start.tv_nsec) < 0) {
        temp.tv_sec = end.tv_sec - start.tv_sec - 1;
        temp.tv_nsec = 1000000000 + end.tv_nsec - start.tv_nsec;
    } else {
        temp.tv_sec = end.tv_sec - start.tv_sec;
        temp.tv_nsec = end.tv_nsec - start.tv_nsec;
    }

    return temp;
}


Taken from: http://www.guyrutenberg.com/2007/09/22/profiling-code-using-clock_gettime/