Coding For a Living

rss

A place to share and comment about coding for a living.


Gadgeteer Book–Learn to Program With VB & .Net Mike McIntyre

This book is a free resource from Microsoft Press which helps students learn to program with the .Net Gadgeteer, a device originated at the Microsoft Research in Cambridge, U.K.. image

The Gadgeteer book explains how to program with VB and .Net using the FEZ Cerberus Tinker Kit modules such as the mainboard, USPClientSP power module, the Joystick, the LED strip, and the Display N18 module.

Students plug together modules then use Visual Studio 2012 or Visual Studio 2010 to build a .Net Gadgeteer project.

The Visual Studio project includes lots of visual tools for connecting and configuring modules.

image 

I love this book and the FEZ Tinker Kit. 

Back in the day I remember buying electronic parts, wiring up boards and hooking up devices based on computer magazine articles.

This kit gives a similar ‘hands on experience’ with the power of VB and .NET added in. 

This book and the FEZ Cerberus Tinker Kit are highly recommended for the young nerds in your life.  The book is free and the kit costs around $100 U.S.


Visual Basic 2012– Caller Information Mike McIntyre

New in Visual Basic 2012 is the caller information feature. This feature enables you to obtain information about the caller of a method.

By using Caller Info attributes, you can obtain information about the caller to a method. You can obtain file path of the source code, the line number in the source code, and the member name of the caller. This information is helpful for tracing, debugging, and creating diagnostic tools.

To obtain this information, you use attributes that are applied to optional parameters, each of which has a default value. 

For more information about using the Caller Information feature click:

       Caller Information (C# and Visual Basic)

Sample Use

' Imports System.Runtime.CompilerServices ' Imports System.Diagnostics Private Sub DoProcessing() TraceMessage("Something happened.") End Sub Public Sub TraceMessage(message As String, <CallerMemberName> Optional memberName As String = Nothing, <CallerFilePath> Optional sourcefilePath As String = Nothing, <CallerLineNumber()> Optional sourceLineNumber As Integer = 0) Trace.WriteLine("message: " & message) Trace.WriteLine("member name: " & memberName) Trace.WriteLine("source file path: " & sourcefilePath) Trace.WriteLine("source line number: " & sourceLineNumber) End Sub ' Sample output: ' message: Something happened. ' member name: DoProcessing ' source file path: C:\Users\username\Documents\Visual Studio 2012\Projects\CallerInfoVB\CallerInfoVB\Form1.vb ' source line number: 15

Visual Studio 2012– JavaScript Strict Mode Mike McIntyre

Visual Studio 2012’s JavaScript Strict Mode provides better error checking.

Strict Mode

Strict mode is a way to introduce better error-checking into your code. When you use strict mode, you cannot, for example, use implicitly declared variables, or assign a value to a read-only property, or add a property to an object that is not extensible.

For example, in the following example all the code is in strict mode, and the variable declaration outside the function causes the syntax error "Variable undefined in strict mode."

"use strict"; function testFunction(){ var testvar = 4; return testvar; } testvar = 5;
"use strict"; function testFunction(){ var testvar = 4; return testvar; } testvar = 5;