Colin's profileColin Brown MSN MVPPhotosBlogListsMore Tools Help
Books that I'm currently reading
No list items have been added yet.

Colin Brown MSN MVP

Check out MSNWindowsLive.Spaces.live.com

Search

Loading...

Keyword Cloud

Loading...
October 22

Silverlight 3 Programmers Reference - Review

Title : Silverlight 3 Programmer's Reference (Wrox Programmer to Programmer)
Author : J. Ambrose Little
  Jason Beres
  Grant Hinkson
  Devin Rader
  Joe Croney
ISBN : 0470385405
Price : $49.99
Rating : 79 out of 100

 

In America there is a growing trend to take your date to the prom in a limousine with all the pomp and lavishness and it works (I’ve heard stories anyway). The same can be said for books. Technical books that deal with certain subjects, CSS, Silverlight etc. are noticeably enhanced when they are printed in full color and Silverlight 3 Programmers Reference is no exception. It helps to clearly demonstrate what the author(s) are portraying.

This book covers both the bases of those new to Silverlight programming and those looking to upgrade their skill sets from Silverlight 2. Silverlight 3 has introduced many enhancements in many areas of the product and the authors have done a good job explaining this. It gently eases you like a pair of well worn slippers into the world of Silverlight programming and captures you with the possibilities that this technology can achieve.

Some chapters of the book are better than others, for example the chapter on styling is the best I’ve read on Silverlight styling but other chapters, although they get the subject matter across appear to leave out some information and sometimes come across as overviews rather than in-depth tutorials.

The authors have slipped up in a couple of places and you can certainly tell that this book isn’t a complete re-write but rather an update of their book on Silverlight 2 as they have forgotten to update the text. This should not put you off however as Silverlight 3 is backwards compatible so what might apply to Silverlight 2 equally applies to Silverlight 3.

I would say that this book is aimed mainly at the newcomer to the Silverlight world and it gives you enough knowledge to more than get started with the technology. Those that are already familiar with Silverlight 2 will learn what is new in Silverlight 3 however the book does not point these things out in an obvious manner which is perhaps one of it’s downfalls. The other downfall is you are left with a feeling that some things should have been explained in more depth. It certainly gives you a good introduction to certain things, some things it does cover well and in-depth but this is not consistent throughout the book.

Some things in this world are exquisite, the minute attention to every detail in a Da Vinci, the song of a Ferrari engine. Some things are good but but lack that something that makes them great and most things fall into the category of Mediocre/Useable. This book I would place in the good category if you are new to Silverlight programming. If you are already proficient in Silverlight 2 and looking to learn what’s new in Silverlight 3 then perhaps this book is not for you as you really have to dig to find that information.


Digg This

The CSS Anthology: 101 Essential Tips, Tricks and Hacks Review

Title : The CSS Anthology: 101 Essential Tips, Tricks & Hacks
Author : Rachel Andrew
ISBN : 0980576806
Price : $39.95
Rating : 73 out of 100

 

Like human beings, CSS is constantly evolving. The introduction of new browsers, people learning new techniques and tricks etc. The CSS Anthology is now in it’s third edition and has been completely updated to include the latest browsers including Internet Explorer 8.

The book takes a slightly different approach than most. It’s still split into different chapters like every other book but rather than teaching you in the normal fashion, this book takes the approach of you reader having asked a question then gives you an answer and an explanation of the answer.

For example, in the chapter on CSS positioning and layout, there is a question “Can I make an inline element display as if it were a block element and vice versa?”. This then leads to an example of exactly what the question means, an answer and an explanation of how the answer works. If necessary, sidebars are presented to detail certain abnormalities for example, what happens in quirks mode in Internet Explorer, if there are differences in the final renderings between the various browsers or whether the browser actually accepts the specified CSS and if not what a workaround would be. All this information extra information is essential for web developers and is tied nicely in with the specific question.  

There is a lot to learn in this book if you are fairly new to CSS and even things to learn if you are an old hand but this isn’t really a book on learning CSS so if you are in the market for that I would suggest looking elsewhere and it’s not exactly a reference book either (I would suggest The Ultimate CSS Reference - Book Review also by SitePoint although to my knowledge this book hasn’t been completely updated with the new browsers yet, but is an excellent reference book on CSS).

The CSS Anthology is beautifully decked out in full color. For certain kinds of books, CSS, Silverlight etc. there is a definite advantage to having the book in color and this shines through here.

Although this book isn’t really meant as a complete learning guide to CSS due to the way it’s been written as a question and answer scenario the first few chapters are written as if the reader has no knowledge of CSS and therefore would be a newcomer to CSS. This gives the book a slight identity crisis and you’re left not knowing exactly where CSS Anthology should be positioned. Is it a newcomer learning book? Is it a reference book or is it as the title suggests a tips book? It tries to cover all bases when it shouldn’t. This is my main criticism of the book and why I find it hard to unequivocally recommend.  I would say the people who are going to get the most out of this book are people who know the basics of CSS but aren’t quite fully accomplished CSS gurus.

Digg This
October 12

My second MVP award of 2009

Today I received my Microsoft MVP Award for 2009/2010.

DSC00002

On opening the box you get the usual MVP Certificate :-

DSC00003

DSC00004

As you can see the award states October 2009.  There is also an extremely nice crystal award included :-

DSC00005

Again as you can see from the little bead on the left, the award states 2009. So why did I get awarded twice for 2009?

The reason comes down to Microsoft themselves changing the award periods. Over the past years, October was the first award of the new year inline with the financial year. This year however Microsoft is changing the award period to be inline with the calendar year, starting January.  So if you were awarded in October, like I am, then you have essentially been awarded twice for the same year. I now have two very nice crystal awards inscribed with the 2009.

Technorati Tags: , , ,
Digg This
October 09

Windows 7 House Party Kit

I received my Windows 7 house party kit in the post when I got home last night. For anyone interested here is what was included :-

34897516

The actual party kit with letters explaining included etc.

34897893

Windows colored streamers

34898047

Windows 7 balloons

34898484

A Windows 7 jigsaw (very reminiscent of Terry Pratchetts Discworld)

34898768

Windows 7 napkins (will probably come in very handy)

34899076

Windows 7 playing cards

34900218

10 very nicely decorated Windows 7 tote bags

34900832

10 Zune Pass 14 day trial certificates

34901187

10 coupons for 40% off Norton 2010

34901864

10 coupons for 1 year free Kaspersky Security Suite

34902447

10 coupons for 20% off Nero 9 and get Nero Backitup free (worth $60)

34902725

10 Windows 7 thank you cards

34903194

10 coupons for Corel

34903443

A Windows 7 table center piece

34903790

A Windows 7 poster

34899853

A copy of Windows 7 Ultimate 64 bit edition

34899497

and of course the copy of Windows 7 Ultimate 32 bit signature edition (signed by Steve Ballmer)

Digg This
September 24

How to use the Sharepoint People Picker in your own control

I was recently tasked with creating a quick Sharepoint web part that would require the ability to enter a user and store that user in a list. The overall control was a registration control for various workshops.

The list included a people field so whatever I programmed from the front end would have to supply a valid user. Also in the list were fields for Email and Display Name. All of these of course can be found in the SPUser object. So the control I created would have to convert whatever the input was into a SPUser object.

SmartPart1

Above is the simple control I came up with. As this was just meant to be a quick control I decided to use a SmartPart control which is basically just an ASCX user control.

In order to do the above, the best way would be to be include SharePoint’s built in People Picker control. Now here is where things got a little confusing. There is indeed a people picker control however this is not what you are actually looking for. What you really want to use is the People  Editor control.

To use this in your user control you first need to give your control a reference to Microsoft.Sharepoint.WebControls :-

<%@ Register Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
    Namespace="Microsoft.SharePoint.WebControls" TagPrefix="cc1" %>

Once you have added that reference you are free to use any of the built in SharePoint controls. The one we’re specifically wanting is the People Editor control :-

 
    <cc1:PeopleEditor ID="BlazerID" runat="server" MaximumEntities="1" 
    MultiSelect="false" AllowEmpty="false" 
    ErrorMessage="Please Enter a User" ValidatorEnabled="true"  />

The people editor control has various properties that you can set. Here I have told it that I only want a single entry (only one person) and that this is a required field.

Now that you have you’re people picker control added to your form, how do you get the value in your code behind and convert it to a SPUser object?

First off I defined an empty SPUser object that will eventually hold the result :-

SPUser user;

The people editor control doesn’t actually return an array of SPUser objects as I would have expected, instead it returns an array of PickerEntities. So first thing you want to do is get the appropriate entry. Since I specified only a single entry I can immediately reference the index of the entry I want :-

PickerEntity ent = (PickerEntity)BlazerID.ResolvedEntities[0];

Next I want to convert this into a SPUser object. There are various ways of doing this but the quickest is to first get the UserID of the username entered :-

int userID = Int32.Parse(ent.EntityData["SPUserID"].ToString());

Once you have that then you can simply get the SPUser object from the sites authorized users collection :-

user = SPContext.Current.Site.RootWeb.SiteUsers.GetByID(userID);

Now that you have a SPUser object you can use all the normal properties associated with a user object (Email, Name etc.).  Here is the code in full I used :-

SPSite site = SPContext.Current.Site;
SPWeb web = site.OpenWeb();
SPUser user;
try
{
    PickerEntity ent = (PickerEntity)BlazerID.ResolvedEntities[0];
    int userID = Int32.Parse(ent.EntityData["SPUserID"].ToString());
    user = SPContext.Current.Site.RootWeb.SiteUsers.GetByID(userID);
}
catch
{
    lblError.Text = "Please enter a valid user";
    return;
}

…….

item[item.Fields["FullName"].InternalName] = user.Name;
item[item.Fields["Email"].InternalName] = user.Email;
item[item.Fields["BlazerId"].InternalName] = "-1;#" + user.LoginName;

……

The (…….) represents code that isn’t relevant here. The end result is a fully working people picker control on your own custom control :-

SmartPart2

Digg This
September 06

Powershell Part 3 – CmdLets

CmdLets (pronounced “Command Lets”) are the building blocks of Powershell scripts.  You can think of them as being like keywords in a programming language. In reality however CmdLets are mini-programs. As you may recall, Windows Powershell is basically built on top of the .Net Framework and a CmdLet simply packages together multiple .Net Framework commands and methods into an easy to use package so that if you’re not used to programming the .Net Framework, are a CLI script writer, you don’t actually have to learn the .Net Framework and it’s thousands of classes and methods in order to use PowerShell.

Windows Powershell 2 comes packaged with well over 100 CmdLets for you to choose from ranging from simply writing out text to the PowerShell window to advanced functionality like Transactions.  To get a complete list of CmdLets that are available in PowerShell 2 can simply enter :-

get-commands

into your Powershell console. This will list not only the CmdLets but their aliases as well. 

getcommand

 

To make it a bit easier to read you can issue the following command :-

get-command | out-gridview

The out-gridview CmdLet takes the output from any command and displays it in a searchable window :-

getcommand2

As you can see there are a mixture of functions, aliases and CmdLets. What is an Alias?  Microsoft added Aliases to most CmdLets to help CLI script writers easily transfer over to Powershell. For example, to get a directory listing of the current directory you would use the following CmdLet :-

get-childitem

getchild

As you can see, this basically just gives you a listing of all the files and folder in the current directory. CLI programmers however are used to the old DIR command :-

getchild2

As you can see the output is exactly the same. That is because DIR is just an Alias for get-childitem. There is also another Alias for this command for unix programmers – LS. You can have multiple Aliases for a single CmdLet, depending upon your preference and what you are used to.

So you have all these commands at your disposal but what do they all do? Well it’s easy to get help on any CmdLet in PowerShell. You simply use the Get-Help CmdLet :-

gethelp

As you can see, if you just enter Get-Help by itself then it will give you help about the Get-Help CmdLet itself. From the output however you can see that you can enter the name of a CmdLet as a parameter and it will show you the help for that particular CmdLet, e.g. get-help write-host :-

gethelp2

You can also get information about a specific CmdLet from the graphical help file (basically a CHM file). From within your PowerShell IDE (or ISE as it’s called in PowerShell), simply press the “F1” key or use the Help menu item :-

gethelp3

The built in Powershell help file is slightly different from the screenshot above as this is the PowerShell Plus help file. PowerShell Plus is a fully interactive PowerShell programming environment from Idera that I will be talking about more in a later posting but for those curious at the moment you can get details at http://www.powershell.com

Also in a later post I will show you how you can make your own CmdLets, after all, they are really just .Net Framework programs.

Digg This
September 03

Powershell 2 Part 2

In the last article I showed you where to download Windows Powershell 2 and went through the installation steps along with some initial configuration options.

In this article I’ll complete the initial configuration options that you may want to do (note these are optional).

Windows Powershell, just like the CLI that it essentially replaces, looks in certain folders on your drive for commands. It is a good idea to create your own directory on your system to store your own Powershell CmdLets and scripts however if you do, how do you run these scripts if it’s not in the default paths?

Before getting ahead of ourselves, what are the default paths?  You can easily find this information out by opening Windows Powershell and inserting the following command :-

$env:Path

This will return a semi-colon delimited list of directories that Windows Powershell automatically searches through for the command that you are running.

getenv

By default, as you can see above, these are :-

C:\Program Files\Common Files\Microsoft Shared\Windows Live
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files\Microsoft SQL Server\100\Tools\Binn\
C:\Program Files\Microsoft SQL Server\100\DTS\Binn\
C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\
C:\Program Files\Common Files\Microsoft Shared\Windows Live

Your default paths may vary from mine as I have various development tools installed that adjust the default path behaviors. As you can see, by default, the folder that you’ve just created to store your CmdLets and Powershell scripts will not be listed. This means that Powershell will not look in your folder for your scripts by default and therefore you cannot run them from anywhere on your system.  To include your Scripts folder so that it gets searched by default you need to adjust your system path environment variable. 

In Windows Vista or Windows 7 you need to open your System control panel applet. Go to Start menu, Control Panel then select System :-

SystemCtrlpanel

From the System Control Panel applet, select the link advanced system settings  near the top left :-

SystemSettings

At the bottom of this window you will see a button marked “Environment Variables”. This is the one you want. Click on it to bring up your system variable window. Note, if you do not know what these settings are then please don’t play about with them as you can end up rendering your computer inoperable.

EnvPath

The one that we are looking for is in the second list under System variables (although you could add it to your local variable path for if you wish however that would then only include that path for that particular user). Select Path then hit the edit button :-

EditPath

To add your own folder, in the “variable value” field, scroll to the end without altering anything that is in there, type in a semi-colon “;” and then type in the full path to your folder. As you can see from the screenshot above, I’ve added ;C:\PScripts to the end as that is where I intend to store my Powershell scripts and CmdLets.  Next “OK” your way out of the dialogs, then you need to reboot your computer as these settings are only loaded on startup. And that’s it, now whatever Powershell scripts and CmdLets you place in this folder can automatically by run from whichever directory your actually pointing to at the Powershell prompt.

After rebooting your computer, if you now re-run the $env:path command in Powershell you should see that your folder is now included :-

getend2

You are now ready to start learning about Powershell and have a folder in which you can place your scripts.

If you do not wish to do this (or perhaps cannot in a business environment) then you can run your Powershell scripts from any directory. You can either insert the full path to your script in with your script name e.g. :-

C:\PScripts\TestScript.ps1

or you can change to the directory that your script is in and put “./”  before your script name e.g. :-

./TestScript.ps1

Notice that all Powershell script files have the extension “ps1” (that’s a number one and not a lower case l).

Digg This
 

Colin Brown

Occupation
Location

Xbox Live GamerCard

Hackersoft
Xbox Live GamerCard
Rep:
5/5 stars
Score:
13860
Zone:
Recreation
Call of Duty: WaWForza Motorsport 3Modern Warfare® 2ET: QUAKE WarsIL-2: Birds of Prey

Xbox Live Recent Games

Call of Duty: WaW
Achieve:
15/66
Score:
220/1500
Forza Motorsport 3
Achieve:
38/50
Score:
735/1000
Modern Warfare® 2
Achieve:
18/50
Score:
265/1000
ET: QUAKE Wars
Achieve:
7/50
Score:
115/1000
IL-2: Birds of Prey
Achieve:
21/50
Score:
290/1000
Photo 1 of 259