Archive for the ‘SQL Saturday’ Category

Post

Add Map and Points to Windows Phone 7

In Bing Maps,Geo Spatial,Silverlight,SQL Saturday,Windows Phone 7 on January 15, 2011 by mws580

Here are the steps to add a map and point on the map.

1) Add a reference to Microsoft.Phone.Controls.Maps

2) Drag a ‘Map’ Windows Phone Control to the Page xaml.

3) Register on Bing Maps Portal and obtain an ID or Key.  Without this the map will display not register message.

4) Add the key obtained above to the xaml code.  Modify the xaml created by dragging the control and dropping it on the page.

    <Microsoft_Phone_Controls_Maps:Map    Name="map1" VerticalAlignment="Top" >     
            <Microsoft_Phone_Controls_Maps:Map.CredentialsProvider>
                <Microsoft_Phone_Controls_Maps:ApplicationIdCredentialsProvider ApplicationId="your key here" />
            </Microsoft_Phone_Controls_Maps:Map.CredentialsProvider>
    </Microsoft_Phone_Controls_Maps:Map>

 

5) Go to  the code behind

6) Add a using statement to reference the map control

using Microsoft.Phone.Controls.Maps;
using Microsoft.Phone.Controls.Maps.Platform;

7)  Add an instance variable for the page

MapLayer PinLayer1;

8) Create a pin and location

Pushpin MyPin = new Pushpin();
MyPin.Location = new Location();

9)  Set the Lat and Lon for the location.

MyPin.Location.Latitude = 27.96206353406851;
MyPin.Location.Longitude = -82.44960308074951;

10) Add a label to the Pin

MyPin.Content = "KForce";

11) Create a Map Layer

PinLayer1 = new MapLayer();

12) Add  Pin to Layer

PinLayer1.Children.Add(MyPin);

13) Add Layer to map

map1.Children.Add(PinLayer1);

14)  Center and Zoom on the location

map1.Center = MyPin.Location;
map1.ZoomLevel = 9;

Happy Coding

Comments Off

Post

Get Location on Windows Phone 7

In Geo Spatial,Mapping,SQL Saturday,Windows Phone 7 on January 15, 2011 by mws580

To get the geographic location of the device there ae a few steps to follow. 

1) Add a reference to System.Device

2) Add a ‘using’ line using System.Device.Location;

3) At the start of the page add a listener

GeoCoordinateWatcher watcher;

For a one time get of the location…

4) Add a button that calls the event defined here

private void StartLocationButton_Click(object sender, RoutedEventArgs e)
{
    // The watcher variable was previously declared as type GeoCoordinateWatcher.
    if (watcher == null)
    {
        watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High); // Use high accuracy.
        watcher.MovementThreshold = 20; // Use MovementThreshold to ignore noise in the signal.
        watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(watcher_StatusChanged);
    }
    watcher.Start();
}
5) Add the listening event that the above function calls.  It is listening for the status change.  The start above causes a status change.  Notice there is a stop at the end.  Geo Location service burns battery time.

void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e)
{
    if (e.Status == GeoPositionStatus.Ready)
    {
        // Use the Position property of the GeoCoordinateWatcher object to get the current location.
        GeoCoordinate co = watcher.Position.Location;
        latitudeTextBlock.Text = co.Latitude.ToString("0.000");
        longitudeTextBlock.Text = co.Longitude.ToString("0.000");
        //Stop the Location Service to conserve battery power.
        watcher.Stop();
    }
}

 

Happy Coding

Comments Off

t

There were great attendees to the SQL Saturday presentation “Spatial Queries in SQL 2008”

First, here are the slide,database , SQL, and ASP.Net code in one zip file.

Download from SQLSaturday website

Here are some links mentioned during the presentation.

1) Geocoding addresses using Google See sample on Codeplex.com

2) BING maps SDK AJAX version

3) Bing maps SDK Silverlight version

4) Window Mobile 7 toolkit Download the Tools

phone7

SQL Saturday 49 Orlando

on October 16, 2010 by mws580

Comments Off

Post

PowerShell ETL by Chad Miller

In SQL Saturday on January 23, 2010 by mws580

In this session we will look at performing common data loading tasks with Powershell. A basic understanding of PowerShell is helpful, but not necessary. Specific topics covered include importing structured files, XML, WMI objects and ADO.NET data sources.

image Chad Miller(website) is a SQL Server DBA and Manager of Database Administration at Raymond James Financial. He has 10 years experience as DBA, working with SQL Server 6.5 through SQL Server 2008. In his spare time Chad is the Project Coordinator/Developer of Codeplex projects SQL Server PowerShell Extensions (SQLPSX) and PoshRSS.

Tampa PowerShell user group www.tampapowershell.com/

Joe Healy’s TweetPhoto HERE

Comments Off

Post

SQL Saturday – Zero to Cube

In SQL Saturday on January 23, 2010 by mws580

Aggregated data according to your business needs.  It is optimized for business terms.  For example, Rolling numbers by quarter.

Zero to Cube in 60 Minutes

Overcome the barriers of traditional training and seminars with this Quick Start to building a cube. This all demo session will get you started and answer many questions you have about building cubes the right way, the first time.

Adam Jorgensen(website), President – Pragmatic Works Consulting – has over a decade of experience leading organizations around the world in developing and implementing enterprise solutions. Adam is also very involved in the community as a featured author on SQLServerCentral, SQLShare, as well as a regular contributor to the SQLPASS Virtual User Groups and other organizations. He regularly speaks at industry group events, Code Camps, and SQLSaturday events on strategic and technical topics.

 

Fact Tables – Actual facts such as sales, orders, or donations.

Dimension – any that starts with the word “by”.  For example, Sales by state or orders by gender.

Power Pivot (Website)

Comments Off

t

Thank you all for attending my session here are the files to download and get stated with spatial data with SQL Server 2008 and Virtual Earth.

Everything (PPT,ASP.NET,Database)

Just the ASP.Net code

Just database backup

Just the script to build the database

Just the PowerPoint

Bing Maps AJAX SDK

Bing Maps Silverlight SDK

SQL Saturday Tampa – Spatial Data

on January 23, 2010 by mws580

Comments Off

Post

SQL Saturday Tampa Sessions

In SQL Saturday on January 23, 2010 by mws580

Troy Gallant (greatfuldba on Twitter) his website on Twitter

Troy offered a good overview of Transactional Replication in SQL Server. 

Microsoft uses a Magazine Publisher metaphor for labeling the various pieces. 

SQL Server replication allows DBAs to distribute data to various servers throughout an organization. Some of the primary reasons to employ replication include load balancing, offline processing & redundancy. Transactional replication in particular can offer a very flexible solution where data frequently changes. This session will discuss the basics of planning and implementation of a solid transactional replication solution.

Troy has been a SQL Server professional for over 6 years The first four were in the role of a developer, and the last two as DBA for an international organization of over 900 employees. When not working, Troy enjoys MMO’s, the Grateful Dead, and whiling away the hours picking his mandolin.

—–

PowerShell

Functions can be used from various areas and used in unexpected areas.

In this session we will learn to perform several everyday DBA tasks like backing up user databases, scripting table objects and evaluating disk space usage with PowerShell. For each task we will explore the benefits of using PowerShell over the standard method. Only a basic understanding of PowerShell or DOS is needed. This session should serve as a good introduction to PowerShell for database users. The goal is to get data professionals feet wet using PowerShell.

Aaron Nelson(website) is a Senior SQL Server Architect, Database Developer, DBA, and Business Intelligence Developer with over 10 years experience in the architecture, design, development and maintenance of SQL Server. He is experienced managing enterprise-wide data needs in both transactional and data warehouse environments.

Comments Off

Post

See you at SQL Saturday in Tampa!

In SQL Saturday,SQL Server 2008 on January 19, 2010 by mws580

See you at the SQL Saturday event in Tampa.

Here is a map to the K Force building


K Force

SQLSaturday is a training event for SQL Server professionals and those wanting to learn about SQL Server.

This event will be held January 23rd, 2010 at K-Force, 1001 East Palm Avenue, Tampa, FL 33605.  K-Force has really stepped up.  After seeing the issues with the “box wall” and the “bowling alley”, they have secured additional rooms at a venue next door.  The Tampa Code Camp recently took advantage of the expanded facilities and I am hearing great things as a result.

Admittance to this event is free, all costs are covered by donations and sponsorships. Please register soon as seating is limited, and let friends and colleagues know about the event.

Registration will open at 8:00 am.  The first session will start at 9:00 am and the last session will conclude at 5:00 pm.  At 5:15 the raffles will start and we should be out of there by 6:00 pm.

Comments Off

Post

SQL Saturday #21 Orlando – Spatial Data in SQL 2008

In Mapping,SQL Saturday,SQL Server 2008 on October 17, 2009 by mws580

October 17, 2009

This session is

a quick tour of the spatial features of SQL Server 2008slide1

PowerPoint slides

PowerPoint as PDF

Tyler Chessman’s article in SQL Server Magazine’s December 2008 issue is my primary source of information to implement my spatial solutions. Visit http://www.sqlmag.com and search for instant doc ID 100528.
Here is a link to the article

What is Spatial Data

  • Spatial data represents the shape and physical location of an object.
  • The object can be a house, business, sub-division, or a county.
  • SQL Server 2008 has two new data types GEOMETRY and GEOGRAPHY.
  • GEOMETRY works with flat objects.
  • GEOGRAPHY considers the shape of the earth.

CLR Types

  • GEOGRAPHY and GEOMETRY are CLR data types.
  • You do not need to have CLR enabled on the SQL Server instance.
  • Microsoft has provided a long list of OGC methods.
  • These are methods that are part of the independent Open Geospatial Consortium list of specifications

STDistance Function explained

  • The STDistance function requires an argument of the SQLgeometrytype
  • Convert the latitude and longitude to SQLgeometrytype.
  • Declare a variable of the geography type.
  • Set the variable to geography::STGeomFromText(‘point(lon lat)’,4326).
  • Notice that the point is a string.
  • Notice there is no comma between lat and lon
  • 4326 is an SRID and is used to tell the function what method to use to calculate distance on a not-so-round planet.

STDistance in action

Declare @CodeGEOG geography =
geography::STGeomFromText(‘Point(-95.3410 29.7070)’,4326);
Select top(5) addr.AddressID as id ,
addr.addressline1,addr.city,
addr.SpatialLocation, — Will show the raw data
addr.SpatialLocation.AsGml() as SpationalGML,
addr.SpatialLocation.STAsText() as SpatialText,
addr.SpatialLocation.STGeometryType() as GeoType,
addr.SpatialLocation.STNumPoints() as Points,
addr.SpatialLocation.STDistance(@CodeGEOG) as distance_in_meters,
addr.SpatialLocation.STDistance(@CodeGEOG)/1609.344 as distance_in_miles
from dbo.Address addr
Where
addr.SpatialLocation.STDistance(@CodeGEOG)/1609.344 < 50
order by distance_in_miles

Wire the SQL up to Virtual Earth

The wire up will get it’s own blog entry

Comments Off

Follow

Get every new post delivered to your Inbox.