Saturday, November 27, 2010

Microsoft Codename Atlanta – monitoring SQL installation - welcome!

Yes, Microsoft does offer a new cloud service to monitor and guard your SQL Server installation. Local installation, I mean, not the SQL Server Azure.

Here the details : https://beta.microsoftatlanta.com/ – Registration (Live) is required.

clip_image002

After registration you will be provided with a link to download a certificate (will be installed locally) and a software modules. Store the certificate locally (you will need it later) and the software setup as well.

The software setup provides you with three setup variants: setup agent (collects information about local SQL installation), gateway (sends data collected by agents to the cloud) or both.

clip_image002[4]

For single box or evaluation purposes you’d choose to setup both agent and gateway.

While gateway installs you’ll be prompted for the issued certificate (s. above):

clip_image002[6]

Complete the setup and wait a couple of minutes, then go to the https://beta.microsoftatlanta.com/ and sign in – you’ll be redirected to the page where all the diagnostics information is shown:

image

Click on error or warning in the provided list – and enjoy the explanation of the cause and cure below the list:

clip_image002[8]

As you see, there’s also a link to appreciated download – if applicable.

The usage of Atlanta in the beta phase is for free, but requires registration.

Friday, November 19, 2010

Microsoft SQL Server product management says “Good Bye” to Itanium

image

Yes, the announce, the Microsoft SQL Server 2008 R2 is the last version with Itanium support is true. The announced SQL Server successor version (Codename “Denali”) does not support Itanium anymore.

Change your IA64 machines (if you have any) to x64 boxes and enjoy SQL Server “Denali” as CTP1.

Tuesday, November 16, 2010

Internet Explorer 9 Beta does not display XML files in tree view

The lifestory of XML files support in Internet Explorer passed many phases: pure text view in IE5 and IE6, animated tree view in IE7 with expanding and collapsing nodes, security warning for blocked content in IE8.

The newest version of IE – IE9 – does not display XML files in a tree view anymore. It displays the sequence of text values of all the XML document nodes – but neither nodes tags nor nodes hierarchy information.

Assume an XML file sample.xml:

<?xml version="1.0" encoding="utf-8"?>
<InternetBrowsers>
  <InternetBrowser>
    <Product>Internet Explorer</Product>
    <Version>7</Version>
    <Manufacturer>Microsoft</Manufacturer>
  </InternetBrowser>
  <InternetBrowser>
    <Product>Internet Explorer</Product>
    <Version>8</Version>
    <Manufacturer>Microsoft</Manufacturer>
  </InternetBrowser>
  <InternetBrowser>
    <Product>Internet Explorer</Product>
    <Version>9</Version>
    <Manufacturer>Microsoft</Manufacturer>
  </InternetBrowser>
</InternetBrowsers>

This file is shown in IE9 as follows:
image

The problem is, on most Windows based systems the Internet Explorer is the only program to view XML files (except Notepad as Editor – but not as comfortable quick viewer).

Looking forward to get tree view XML viewing back in final version of IE9 to enjoy it again…

Saturday, November 06, 2010

Write Windows Phone 7 game – for beginners (Part II)

Let’s start with game design. Our decision was a light version of blackjack game. “Light” means here: we implement only a subset of the real blackjack game. (Anyway you can improve the game logic using the sample source code later to narrow the “real” game).

First, we design the gambling table as the only frontend of the game:

Untitled

  • dealer: the picture of the dealer (computer)
  • player: the picture of player (human)
  • cardstock: the picture of the playing cards stock used to hit cards by the player if “touched”
  • stand: the picture used as “stand” button if “touched”
  • dealer cards: the sequence of cards hit by dealer
  • player cards: the sequence of cards hit by player
  • score dealer: the current score of the dealer
  • score player: the current score of the player

So far so good, we reach the first part of quick start into WP7 game programming: display information.

Display information in Windows Phone 7 games

The display functionality is encapsulated in the method Draw():

/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.Green); // we paint the table green

    // TODO: Add your drawing code here

    base.Draw(gameTime);
}

The method is described here: http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.game.draw.aspx
”Called when the game determines it is time to draw a frame. Override this method with game-specific rendering code.”

We will display data using the class SpriteBatch described here:

An instance variable of the class SpriteBatch:

SpriteBatch spriteBatch;

will do the display job for us.

SprĂ­teBatch instance does display the data in three steps:

  • Begin() initiates begin of sprite operations ( = display actions)
  • the instance of SpriteBatch performs the display actions
  • End() finishes the sprite operations

So referring to the UI model designed above, the Draw() function looks like follows:

/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.DarkGreen);

    // begin the display actions
    spriteBatch.Begin();

    // draw dealer's picture
    drawDealer();
    // draw player's picture
    drawPlayer();
    // draw card stock
    drawStock();
    // draw player's cards
    drawPlayerCards();
    // draw dealer's cards
    drawDealerCards();
    // draw game controls
    drawControls();
    // draw game score
    drawScore();
    // draw game result
    drawResult();

    // end display actions
    spriteBatch.End();

    base.Draw(gameTime);
}

There are two basic display operations implemented in this game: display a picture (called texture in terms of WP7 game) and display a string of text.

Display pictures

The most popular task to display information in a game is to display a picture. The pictures in WP7 games are called textures. The textures can be displayed by spriteBatch, but have to be loaded before from game content.

The loading of textures used in the game is realized usually in LoadContent() method:
 http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.game.loadcontent.aspx

This method is called when game resources need to be (re)loaded – even if DeviceReset() is called.

Loading of pictures looks like follows:

textureCardBack = Content.Load<Texture2D>("cardBack");

where cardBack is the name of the graphic resource saved as a picture (PNG, BMP etc.) file in game content project:

image

During the Draw() method call the previously loaded texture can be dispalyed by spriteBatch as follows:

spriteBatch.Draw(textureCardBack, stockPosition, Color.White);

The Draw() method of SpriteBatch used here takes three parameters:

  • texture (picture) to be displayed
  • screen position to display the picture
  • color to tint the picture (we use Color.White to avoid tinting)

Adding pĂ­cture to game content

To add a picture to the game use “Add” –> “New Item…” command from the context menu in the game content project:

image

Then select “Bitmap file” and edit it.

Alternatively use “Add” –> “Existing item…” to add an existing graphic file

Display text

SpriteBatch() can also display text messages. We use this functionality to display scores:

spriteBatch.DrawString(scoreFont, scoreDealer.ToString(), DealerScorePosition, color);

The method DrawString() used here takes four parameters:

  • font to be used (this font must be loaded before the call – usually in the LoadContent() method similar to loading textures)
  • text to display (in the sample above – dealer’s score as string)
  • screen position to display the text
  • text display color

Adding font to game content

To add a font to the game use “Add Item…” command from the context menu in the game content project as described above (adding picture to game).

Then select “Sprite Font” - a new font description file will be added to game content:

image

The spritefont file is a XML based font description file:

<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains an xml description of a font, and will be read by the XNA
Framework Content Pipeline. Follow the comments to customize the appearance
of the font in your game, and to change the characters which are available to draw
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
  <Asset Type="Graphics:FontDescription">

    <!--
    Modify this string to change the font that will be imported.
    -->
    <FontName>Segoe UI Mono</FontName>

    <!--
    Size is a float value, measured in points. Modify this value to change
    the size of the font.
    -->
    <Size>36</Size>

    <!--
    Spacing is a float value, measured in pixels. Modify this value to change
    the amount of spacing in between characters.
    -->
    <Spacing>0</Spacing>

    <!--
    UseKerning controls the layout of the font. If this value is true, kerning information
    will be used when placing characters.
    -->
    <UseKerning>true</UseKerning>

    <!--
    Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
    and "Bold, Italic", and are case sensitive.
    -->
    <Style>Bold</Style>

    <!--
    If you uncomment this line, the default character will be substituted if you draw
    or measure text that contains characters which were not included in the font.
    -->
    <!-- <DefaultCharacter>*</DefaultCharacter> -->

    <!--
    CharacterRegions control what letters are available in the font. Every
    character from Start to End will be built and made available for drawing. The
    default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
    character set. The characters are ordered according to the Unicode standard.
    See the documentation for more information.
    -->
    <CharacterRegions>
      <CharacterRegion>
        <Start>&#32;</Start>
        <End>&#126;</End>
      </CharacterRegion>
    </CharacterRegions>
  </Asset>
</XnaContent>


Edit the font parameters regarding text display requirements.

Play sound

Another way to provide user with information is playing sounds. A sound to play must be loaded from the game content the same way as we do for textures or fonts:

cardDownSound = Content.Load<SoundEffect>("cardDown");

where cardDown is the name of the sound file (usually WAV encoded) enclosed in game content:

image

To play the sound at the drawing time or in other game situations just use Play() method:

cardDownSound.Play();

…more to come…

Friday, November 05, 2010

Windows Live Writer 2011, Word 2010 and blog entry formatting


 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;


 

namespace HelloWorld

{


class
Program

{


static
void Main(string[] args)

{

}

}

}


 

This is the reason to create blog entries with Word 2010: the color formatting is kept on copy/paste from Visual Studio. Windows Live Writer doesn't keep the colors.

This is a good news. Here are two bad news:

  1. Word doesn't keep other formatting parameters (newlines, tabs etc.) – see above.
  2. Word doesn't support blog entry embedded pictures.

What to use? Decide yourself…