What is the difference between calories and fat?

December 17, 2009 – 7:57 pm
What's the difference between fat and calories? Fat is one of six nutrients your body needs to stay healthy. The other five nutrients are: Carbohydrates (found in fruits, vegetables, pasta, rice, grains, peas, beans, and other legumes) Proteins (found in meat, poultry, dairy products, eggs, and beans) Minerals (such as potassium, calcium, and iron) Vitamins (such as vitamins A, D, E, and K) Water Of these six nutrients, carbohydrates, protein and fats provide calories. Each gram of carbohydrate and protein yield 4 calories/gram. Each gram of fat yields 9 calories. A calorie is a measurement, just like a teaspoon or an inch. Calories are the amount of energy released when your body breaks down (digests and absorbs) food. The more calories a food has, the more energy it can provide to your body. When you eat more calories than you need, your body stores the extra calories as body fat. Even a fat-free food can have a lot ...

WCF beginner’s guide

November 30, 2009 – 6:06 pm
1. Create a WCF Service Library project 2. Create an entity object class .cs. 3. Annotate entity class with [DataContract] attribute. 4. Annotate fields (from class above) you want in the contract with [DataMember] attribute. 5. Next, create a IService.cs interface that has the operations that can be performed. 6. Annotate with [ServiceContract] attribute. 7. Annotate methods with [OperationContract] attribute. 8. Create Service.cs class to hold the actual implementation of the interface above. 9. Annotate with [ServiceBehaviour] attribute.

.NET Streams cheatsheet

November 19, 2009 – 5:17 pm
A summary of streams in .NET. TextReader [abstract] -----> StringReader -----> StreamReader TextWriter [abstract] -----> StringWriter (uses underlying StringBuilder) -----> StreamWriter

Anonymous BitTorrent / Anonymous Internet Surfing

November 13, 2009 – 6:29 pm
A list of software applications, tools and utilities for anonymous bittorrent and anonymous web surfing.

ObjectDataSource : how to set insert / update parameters programmatically

November 10, 2009 – 5:02 pm
Having begun programming with ASP.NET from its inception where you wrote your own solutions to common problems, I've found the introduction of ObjectDataSource objects and similar functionality a blessing and a curse. Although they can save a bit of coding I always find my self wasting lots of time trying to find which events I should be performing certain tasks in. Trying to find how to do simple tasks such as setting insert or update parameters can often waste considerable amount of time. To that end, I've written the following the "remind" myself of these simple tasks...

SQL Server Report Builder: how to access a TextBox value

September 24, 2009 – 8:32 pm
I recently needed to access a TextBox value in an expression in one of my SQL Server Report Builder (SQL Reporting Services) reports recently, and found it surprisingly hard to find the answer).

How to create a masked textbox using JavaScript

July 8, 2009 – 12:19 am
This article demonstrates how to implement a masked input box or masked textbox using JavaScript. For example, let's imagine you have a simple HTML form and want to restrict the user to enter on numbers in a Telephone number field. The following code will demonstrate how to to capture the keypress events of a form element (eg. your Telephone input textbox) and to restrict which keys can be pressed.

Random number generator for JavaScript

July 7, 2009 – 8:42 pm
Need to know how to generate a random number in JavaScript? The following code will do the job. There are a lot of articles on the internet explaining how to generate a random number between 0 and 10 (for example), but not so many explaining how to generate a random number within a certain specified range. And of those solutions, some of these didn't produce very random results. The solution below, I've tested with 10,000 repetitions and found that there was a good even distribution over all numbers in the specified range.

How to get the parts of a URL in ASP.NET

June 30, 2009 – 8:43 pm
Every time I need to parse a URL or to extract parts of a URL in ASP.NET C# I can never remember what I did last time and need to refer to the documentation. So, in order to quickly answer the question "How can I get the elements of a URL in C#?", I've made this quick reference.

SELECT DISTINCT and ORDER BY

June 24, 2009 – 8:52 pm
ORDER BY items must appear in the select list if SELECT DISTINCT is specified. Recently discovered the above error (T-SQL, SQL Server) when trying to select DISTINCT rows for one set of columns while ordering the rows by another column. Jeff Smith had a good explanation of why this occurs (article). In a nutshell, if you're trying to order your distinct results but the other column you are ordering by is NOT distinct, then how will SQL Server know which value to use for ordering?