Thursday, September 18, 2014

Serializing a list of values as json properties

I was so excited to find that this is easily doable in C#.  Here is the link to the stack overflow page.


Wednesday, July 23, 2014

Javascript function to mimic c#'s String.Format() method

var format = function (input) {
var args = arguments;
return input.replace(/\{(\d+)\}/g, function (match, capture) {
return args[1*capture + 1];
});


from this github gist

Friday, February 21, 2014

Example of reusing common table expression table name

;with word as
(
 select 'hello' as word union all
 select 'goodbye' 
 
)
, thing as 
(
 select 'world' as name union all
 select 'friends'
)
, wordthing as
(
 select w.word +  ' ' + t.name statement
 from 
  word w,
  thing t
)
Select wt.statement
from
 wordthing wt


Result:

Monday, December 23, 2013

BASH scripting GIT branch creation

This creates a develop branch if it doesn't exist already

create_develop_branchifNotExists() {
branch="develop"

if git show-ref --verify --quiet "refs/heads/$branch"; then
#echo >&2 "Branch '$branch' exists."
echo ""
else
#read -p "Do you really want to create branch $branch " ans
#echo $ans
echo "Creating $branch branch"
git branch $branch
git branch -a #show all branches
fi
}


# And the following lines assume you've already checked in all your changes. It will switch to develop branch and merge your changes from master into develop branch and go back to master branch.

create_develop_branchifNotExists
echo "========== MERGING Current branch into develop branch ============="
git checkout develop
git merge master

git checkout master

Thursday, December 12, 2013

AudioBook Resources

I am an avid Podcast listener and found it so refreshing to find http://www.booksshouldbefree.com/ that I am blogging about it so I don't forget it. What I find most useful about it is its use of RSS to allow you to add the ebook to your favorite RSS podcast program. For example,

Moby Dick is available here and here's a screenshot of the many options it gives you to consume it: