sample code from my blog articles