MOSS 2007 vs. WSS 3.0

January 16, 2011 Leave a comment

Question:
“What is the difference between MOSS 2007 and WSS 3.0? Should we spend the money for SharePoint 2007 or is WSS 3.0 sufficient?”

MOSS vs. WSS

Answer:
This is a common question for organizations looking to implement a Microsoft-based online collaboration system. The basic answer is Windows SharePoint Services 3.0 (WSS) provides a collaboration foundation with a variety of features including a web-based portal, document collaboration, etc. and Microsoft Office SharePoint Server 2007 (MOSS) builds on WSS by providing several additional enterprise features.

The best way to understand the difference is to evaluate the additional features provided by MOSS. This article provides a good feature comparison.

I have implemented both MOSS and WSS-only solutions for a number of organizations and although WSS is nice and will work, if you can afford MOSS (or SharePoint Server 2010) I would strongly recommend it.

Categories: SharePoint Tags: , ,

Data Storage in SharePoint 2007

January 14, 2011 Leave a comment

Question:
“Where is the data and the documents stored when I create a document library in SharePoint 2007?”

Answer:
The meta-data (library columns) and the files themselves (BLOBs) are stored in the SQL Server database associated with the specific web application.

The databases can be viewed and managed in Central Admin -> Application Management -> Content Databases.

Categories: SharePoint Tags: ,

ESPN Ticker in PowerPoint

December 31, 2010 3 comments

Throughout my career, I have made countless presentations and almost every single one of them has been delivered with Microsoft PowerPoint. I am a huge sports fan and watch a lot of ESPN and have always liked the ticker that appears at the bottom of the screen.

ESPN Ticker

I figured it would be interesting to have an ESPN-like ticker at the bottom of my presentation and although it’s not appropriate for all audiences, it is pretty cool.

It works by handling internal PowerPoint events through macro code (hit Alt-F11 to view the code editor) and reads the tabs and messages at runtime from a XML file in the same directory as the presentation. Please note that I’ve only tested this with PowerPoint 2007, but it should work with 2010 and probably 2003.

A few quick notes:
1. You need to install EventGen12 add-in, which redirects PowerPoint events to actual presentations. http://officeone.mvps.org/eventgen/eventgen.html

2. Make sure you enable macros when prompted in PowerPoint.

3. The code that performs the work relies on the ticker shapes in the presentation to be named in a particular way, so it’s generally easiest to simply copy an existing slide from the sample and then make your content changes. But, if you’d like to change them, there’s also a ‘NameShape’ macro included as well.

4. The speed of the ticker is controlled by adjusting the ‘timer_interval’ value in ‘ticker_msgs.xml’.

Download Complete Sample (includes source code, sample presentation and XML)

A quick video demonstration of how it looks in action.


Download Complete Sample

Categories: Code, PowerPoint, Samples

Finally Traded my iPhone for an Android

I have been waiting for a compelling Android device for almost a year and I finally find it – I am now the proud owner of a Samgsung S.

Although I’m still in the honeymoon stage, I have to say I’m impressed with both the device and OS.

The Android SDK looks interesting as well and could be fun.

Categories: Android Tags: ,

How to Read a Binary File in C++

February 17, 2010 1 comment

The following code shows how to read a binary file in C++. This is a quick example and doesn’t contain much error handling and if you’re using Visual Studio, make sure you set the appropriate character set:

Right-click on your project in the Solution Explorer and click Properties.
Select Configuration Properties -> General.
Set the Character Set to Use Multi-Byte Character Set.

///////////////////////////////////////////////////////////////////////////////
// A quick example of reading a binary file in C++.
//
// 2010 Jason Barkes - http://jbarkes.wordpress.com
///////////////////////////////////////////////////////////////////////////////

#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>

int _tmain(int argc, _TCHAR* argv[])
{
    FILE *file;
    char *fileName;
    int   fileSize;
    char *readBuffer;

    // Set the filename (could also get from a command-line parameter)
    fileName = "c:\\samples\\binary.jpg";

    // Open the specified file in binary mode ("rb")
    file = fopen(fileName, "rb");

    // If the file wasn't opened successfully, print an error and close
    if(file == NULL)
    {
        perror("Failed to open file for read access.");
        return 1;
    }

    // Determine the file size
    fseek(file, 0L, SEEK_END);
    fileSize = ftell(file);
    rewind(file);

    // Allocate the read buffer
    readBuffer = (char *)malloc(fileSize);

    // Read the file's data into the read buffer
    long read = fread(readBuffer, 1, fileSize, file);

    // Do something with the data
    // ...

    // Free allocated memory and close the file
    free(readBuffer);
    fclose(file);

    // Exit program
    return 0;
}

Categories: Code, HowTo, Samples Tags: , ,

Drawing Dynamic Shapes in Silverlight 3

January 3, 2010 2 comments

This is a quick demonstration that focuses on some of the geometric shape drawing features that are available in Silverlight and how to use those features in code.

Live Demo: Drawing Dynamic Silverlight Shapes
Live Demo

The following code excerpts show the highlights of performing the primary shape drawing functions:

  • Dynamic shape creation
  • Sizing calculations
  • Brushes
  • Dynamic event handlers
  • Shape re-sizing
  • Shape movement

/// <summary>
/// Draws the desired geometrical shape.  This quick example app uses
/// ellipses and rectangles, but others would work here as well.
/// </summary>
private void DrawShape(Shape shape, SolidColorBrush brush)
{
    double x = 0.0, y = 0.0;

    // These calcs are required to handle sizing in any direction
    if (_ptStart.X > _mX)
    {
        shape.Width = _ptStart.X - _mX;
        x = _mX;
    }
    else
    {
        shape.Width = _mX - _ptStart.X;
        x = _ptStart.X;
    }

    if (_ptStart.Y > _mY)
    {
        shape.Height = _ptStart.Y - _mY;
        y = _mY;
    }
    else
    {
        shape.Height = _mY - _ptStart.Y;
        y = _ptStart.Y;
    }

    // Set the brushes
    shape.Fill = brush;
    shape.StrokeThickness = 1;
    shape.Stroke = _whiteBrush;

    // Set the shape's coordinates
    shape.SetValue(Canvas.LeftProperty, x);
    shape.SetValue(Canvas.TopProperty, y);

    if (_shapeLast != null)
    {
        LayoutRoot.Children.Remove(_shapeLast);
    }

    // Set the name, tooltip and add the event handlers
    shape.Name = "DynamicShape" + _shapeCount.ToString();
    ToolTipService.SetToolTip(shape, shape.Name + "\r\n" + shape.GetType().ToString());

    shape.MouseEnter += new MouseEventHandler(shape_MouseEnter);
    shape.MouseLeave += new MouseEventHandler(shape_MouseLeave);
    shape.MouseLeftButtonDown += new MouseButtonEventHandler(shape_MouseLeftButtonDown);
    shape.MouseLeftButtonUp += new MouseButtonEventHandler(shape_MouseLeftButtonUp);

    // Add the shape to the canvas
    _shapeLast = shape;
    _shapeCount++;
    LayoutRoot.Children.Add(shape);
}

/// <summary>
/// This is where the shapes are drawn, resized and moved.
/// </summary>
private void LayoutRoot_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
    // Update mouse coordinates
    _mX = e.GetPosition(sender as UIElement).X;
    _mY = e.GetPosition(sender as UIElement).Y;
    ctlCoords.Text = "(" + _mX + " ," + _mY + ")";

    // If enabled, add event info to the console
    if (chkTrackMouse.IsChecked == true)
    {
        AddConsoleMsg("LayoutRoot_MouseMove: X=" + _mX + ", Y=" + _mY);
    }

    // Perform a hittest to make sure we're operating within the bounds of our
    // drawing surface
    IEnumerable<UIElement> elements;
    elements = VisualTreeHelper.FindElementsInHostCoordinates(
        new Point(_mX, _mY), ctlBounds as UIElement);

    if (elements.Any())
    {
        // If enabled, draw the gridlines
        if (chkGridlines.IsChecked == true)
        {
            DrawGridlines();
        }

        // If enabled, draw an ellipse
        if (_isLeftMouseButtonDown == true && _isDrawEllipse)
        {
            Ellipse ellipse = new Ellipse();
            DrawShape(ellipse, _brushes[_randBrush.Next(0,_brushes.Count)]);
        }

        // If enabled, draw a rectangle
        if (_isLeftMouseButtonDown == true && _isDrawRect)
        {
            Rectangle rect = new Rectangle();
            DrawShape(rect, _brushes[_randBrush.Next(0, _brushes.Count)]);
        }

        // If enabled, draw a line
        if (_isLeftMouseButtonDown == true && _isDrawLine)
        {
            Line line = new Line();
            DrawLine(line);
        }

        // If a shape is moving
        if (_isShapeMoving)
        {
            double x = _mX - _shapeMove.Width / 2;
            double y = _mY - _shapeMove.Height / 2;

            // Move the shape
            _shapeMove.SetValue(Canvas.LeftProperty, x);
            _shapeMove.SetValue(Canvas.TopProperty, y);
        }
    }
    else
    {
        // We're outside of the bounds of our drawing surface so remove the gridlines
        RemoveGridlines();
    }
}

You can download the full source here: Drawing Dynamic Silverlight Shapes Demo. This requires Visual Studio 2008 and Silverlight 3 development tools (Expression Blend is not required but would be useful as well).

Deep Copy / Clone Objects in Silverlight with C#

December 28, 2009 5 comments

The following code will add an extension method to Silverlight 3 based C# code to perform a deep copy of a custom object.  This templated method uses the MemoryStream serialization/deserialization technique, but will not work with UIElement members or derivatives.

public static class ExtensionMethods
{
       public static T DeepCopy<T>(this T oSource)
       {
              T oClone;

              DataContractSerializer dcs = new DataContractSerializer(typeof(T));

              using (MemoryStream ms = new MemoryStream())
              {
                     dcs.WriteObject(ms, oSource);
                     ms.Position = 0;
                     oClone = (T)dcs.ReadObject(ms);
              }

              return oClone;
       }
}

Basketball Play Designer in Silverlight 3

December 12, 2009 4 comments

Silverlight is an exciting new technology that provides a cool platform for building EMBED’able applications and complete web sites using Visual Studio and Expression Blend. There are numerous features that are worth exploring, but my favorite is the seperation of the UI/UX and the implementation, along with Expression Blend.

Being a C#/C++ software guy with some graphical design skills, this is a perfect match. In this article, we’ll create the start of a Silverlight application for designing basketball plays. The finished product’s looks can change quite a bit, but the functionality remains the same:

     Standard Court - Click for Larger Image     Abstract Court - Click for Larger Image

In the first video clip you will learn how to create the project in Visual Studio and the static visual layout in Expression Blend.

In part 2, you will learn how to create and wire up dynamic controls and event handlers and create the associated C# code.

The next steps for this application will be presented in an upcoming article and include:

  • Drag and drop animation
  • Better styling (buttons, etc)
  • Passing and dribbling
  • Record and playback
  • Save plays and play templates (e.g., ‘2-3 zone’)

Download Source: SilverlightBasketballSample.zip (316KB)

A Quick Line Counter in C++

December 11, 2009 Leave a comment

A quick source code line counter written in C++.  This project uses the Microsoft Foundation Classes (MFC), along with the standard C++ libraries. It could use some additional features and more advanced error handling, but it is fairly complete. One quick note (that several have brought to my attention), the percentages do not usually add up to 100% – that is because of the use of integers instead of floating point types, which essentially rounds down. The code is available below.

Windows Line Counter Screenshot

Download Source: WinLocCounterSample.zip (216KB)

Categories: Code, Samples Tags: ,

Iterate Directories & Files in C++

December 9, 2009 Leave a comment

In standard (non-managed) C++ on the Windows platform, traversing a directory / folder tree recursively can be accomplished via the Win32 API.  The following listing is a simple example that displays the name of each file.

#include <windows.h>
#include <string>
#include <vector>
#include <stack>
#include <iostream>

using namespace std;

// Recursive directory traversal using the Win32 API
bool ListFiles(wstring path, wstring mask, vector<wstring>& files)
{
	HANDLE hFind = INVALID_HANDLE_VALUE;
	WIN32_FIND_DATA fdata;
	wstring fullpath;
	stack<wstring> folders;
	folders.push(path);
	files.clear();
	
	while (!folders.empty())
	{
		path = folders.top();
		fullpath = path + L”\\” + mask;
		folders.pop();

		hFind = FindFirstFile(fullpath.c_str(), &fdata);

		if (hFind != INVALID_HANDLE_VALUE)
		{
			do
			{
				if (wcscmp(fdata.cFileName, L”.”) != 0 &&
                    wcscmp(fdata.cFileName, L”..”) != 0)
				{
					if (fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
					{
						folders.push(path + L”\\” + fdata.cFileName);
					}
					else
					{
						files.push_back(path + L”\\” + fdata.cFileName);
					}
				}
			}
			while (FindNextFile(hFind, &fdata) != 0);
		}

		if (GetLastError() != ERROR_NO_MORE_FILES)
		{
			FindClose(hFind);

			return false;
		}

		FindClose(hFind);
		hFind = INVALID_HANDLE_VALUE;
	}

	return true;
}

int main(int argc, char* argv[])
{
	vector<wstring> files;

	if (ListFiles(L”C:\\source”, L”*”, files))
	{
		for (vector<wstring>::iterator iter = files.begin(); iter != files.end(); ++iter)
		{
			wcout << iter->c_str() << endl;
		}
	}

	return false;
}

Categories: Code, Win32 Tags: , , ,

Silverlight 3 – Dynamically Add & Remove Objects in C# Code

December 8, 2009 6 comments

I recently spent a few minutes trying to figure out how to create rectangles and ellipsis in Silverlight code – I was sure I had it all hooked up and coded properly, but I missed one little thing (isn’t that the way it always goes).    

Here is what the canvas looks like in Blend:
Click for Larger Image    

Create the dynamic controls:
The following C# code does the heavy lifting to dynamically create an ‘offensive player’ (which is really an ellipse) and associated event handlers and is called by the ‘O’ button click event handler.  

public void CreateOffensivePlayer()
{ 
     // Create an Ellipse
     Ellipse player = new Ellipse();
     player.Height = 25;
     player.Width = 25;
 
     // Create the brushes
     SolidColorBrush blueBrush = new SolidColorBrush();
     blueBrush.Color = Colors.Blue;
     SolidColorBrush blackBrush = new SolidColorBrush();
     blackBrush.Color = Colors.Black;

     // Set the width, color and fill
     player.StrokeThickness = 1;
     player.Stroke = blackBrush;
     player.Fill = blueBrush;
 
     // Add to the Canvas
     player.SetValue(Canvas.LeftProperty, _mouseXpos – player.Width / 2);
     player.SetValue(Canvas.TopProperty, _mouseYpos – player.Height / 2);
 
     // Set the tag to identify the player
     string elementName = “offensiveplayer” + (++_offensivePlayerCount).ToString();
     player.Tag = elementName;
     player.Name = elementName;
 
     // Dynamically add the event handlers
     player.MouseEnter += new MouseEventHandler(oPlayer_MouseEnter);
     player.MouseLeave += new MouseEventHandler(player_MouseLeave);
 
     // Add the player to the canvas
     LayoutRoot.Children.Add(player);
} 

Remove the dynamic controls:
The following event handler removes the shapes that were dynamically created on the canvas. It assumes the existance of LayoutRoot and a global _shapeCount integer.

private void btnClearShapes_Click(object sender, System.Windows.RoutedEventArgs e)
{
    // Make a copy of uielements in order to remove the desired shapes
    UIElement[] tmp = new UIElement[LayoutRoot.Children.Count];
    LayoutRoot.Children.CopyTo(tmp, 0);

    // Iterate the uielements
    foreach (UIElement uielement in tmp)
    {
        Shape myShape = uielement as Shape;

        // Make sure we have a shape and the shape has a tag
        if (myShape != null && myShape.Tag != null)
        {
            // We only want to remove our dynamically created shapes
            if (myShape.Tag.ToString().Contains(“mycustomshape”))
            {
                LayoutRoot.Children.Remove(uielement);
            }
        }
    }

    _shapeCount = 0;
}

How to Embed Video Content in SharePoint

December 2, 2009 1 comment

I am frequently asked about the rich content that appears in the SharePoint sites I have developed.  Specifically the video, Silverlight and Flash content.  The most common question is “how do you create a SharePoint site that doesn’t look like SharePoint?”  While the technical answer to that question is a little complex, the simple answer (that provides the ability to provide video content) is actually pretty simple.

Although some of the following pre-requisites may already be in place, you will need a document library and a web part page.

1Create a Document Library to contain the Web Part Pages (aspx).  These files must have a home, but you can use an existing library if a suitable one exists.  The name of the library is somewhat arbitrary, but should be as consise as possible.  It is also a good idea to provide an accurate description of the library.
   
2Create the Web Part Page or modify an existing page that will contain the video content.
   
3Edit the newly created Web Part Page and add a ‘Content Editor Web Part’.
   
4Enter the Embed code (either manually or by cut-and-pasting from YouTube, etc) into the source editor of the CEWP.
   
5Exit from editing mode of the Web Part Page and you should now see a video player with your video.
   
6If you are using a publishing site, with corresponding web content management enabled, the steps are slightly different, just add the CEWP and Embed code.  Don’t forget to check-in and publish your changes.
Categories: HowTo, SharePoint Tags: , ,

SharePoint 2007 – How to Enable Publishing Feature

November 27, 2009 2 comments

SharePoint 2007 includes the ability to host and manage content-oriented Publishing sites. For additional information on the publishing capabilities of SharePoint 2007, please see this Microsoft article.

If you receiving an “Access denied” error attempting to activate the feature, please review this article.

Categories: HowTo, SharePoint

SharePoint 2007 – How to Fix ‘Access Denied’ Activating Publishing Feature

November 27, 2009 3 comments

This is a quick fix for “Access denied” errors received while attempting to activate the Publishing Infrastructure feature for a SharePoint 2007 site collection. After the feature is enabled, make sure you remember to switch the App Pool back!

1 Right click on ‘My Computer’ and select ‘Manage’.
2 Expand ‘Sevices and Applications’, then ‘IIS Manager’.
3 Expand ‘Web Sites’, then right click on your MOSS web site.
4 Select ‘Properties’, then the ‘Home Directory’ tab.
5 Change the ‘Application Pool’ to your ‘SharePoint Central Administration’ application pool and select ‘OK’.
6 From the command-line, execute ‘IISRESET’.
7 Enable the ‘Publishing Infrastructure’ feature within ‘Site collection features’. For detailed instructions for this step, please see this post.
Categories: HowTo, SharePoint Tags: ,

SharePoint 2007 – Using Firefox and Firebug to Debug CSS

November 27, 2009 Leave a comment

Download Firefox

Debugging the CSS that comes with the style sheets (CSS) in SharePoint 2007 can be challeging at times.  The best tool I’ve found is a plug-in for Firefox called Firebug.  This demo shows how to use Firebug to “test out” how certain CSS changes will look and to determine which CSS file is being used – remember the ‘C’ in CSS stands for cascading.

Also, modifying the OOTB SharePoint style sheets (e.g. ‘Core.css’, etc) is NOT recommended and goes against best practices.  For more information on CSS, see this CSS Tutorial from w3schools. The best online source for information on branding SharePoint is contained in Heather Solomon’s blog.

SharePoint 2007 – How to Change a Site’s Theme

November 27, 2009 Leave a comment

Although there is some debate and essentially 2 camps on the use of themes within SharePoint 2007, there is no question they are much easier and safer for actual end users. I use master pages when I need to change structural elements of a site and themes for the look and feel.

Even though an AJAX version with live preview would be even better, the OOTB method is easy and does provide a quick preview of each theme’s colorscheme.

Categories: HowTo, SharePoint Tags:

SharePoint 2007 – How to Create a New Site Collection & Team Site

November 27, 2009 Leave a comment

The following demo shows how to create a SharePoint 2007 site collection and associated team site through Central Admininistration and Site Actions.

Categories: C#, HowTo, SharePoint

How to add a Local Hosts Entry

November 26, 2009 Leave a comment

Frequently during the development process you need the ability to reference an unregisted DNS name (i.e. ‘application.name.com’) prior to formal internal and/or external DNS registration or updates.  It is really pretty simple and only requires the addition of the name to IP mapping in the HOSTS file on the MOSS server(s) and each of the development machines.

The ‘hosts‘ file does not have a file extension and is typically located in ‘C:\Windows\System32\drivers\etc‘ (assuming the default Windows installation location).

Step 1:  Open notepad (or your favorite text editor) either through the menu or by clicking Start-Run and typing notepad in the Run dialog.  Please note that in Windows 7, you must run notepad as an administrator in order to save the required changes.

Step 2:  Open the ‘hosts‘ file (which is typically located in ‘C:\Windows\System32\drivers\etc’) and enter the IP address and the associated entry (i.e. 192.168.1.117  coolapp.mycompany.com).

Step 3:  Save the changes to the hosts file and then flush the DNS cache from the command-line using the ‘ipconfig /flushdns‘ command.

Note, in MOSS 2007, the host entry should correspond to the host header or alternate access mapping entry.

Categories: SharePoint, Windows Tags: ,

What’s on my iPhone?

November 24, 2009 1 comment

Several people have asked me about the apps on my iPhone and I’ve become somewhat of a local “expert” on iPhone apps (and their deployment within a company’s enterprise), so here is what’s on my iPhone. Please note that several of these I would not recommend to CIO’s for their enterprise :) .

Categories: iPhone Tags:

SharePoint 2010, MSS (notice the missing ‘O’)

November 23, 2009 Leave a comment

The new version of SharePoint has been released in beta and is available to be downloaded via MSDN’s subscription service (only 64-bit version is available).

Categories: SharePoint Tags:
Follow

Get every new post delivered to your Inbox.