Craig Gemmill's Blog

There is nothing more secure than an educated user!
A New Era of Software

I was reading a post by Rob Chartier titled, "Microsoft needs to give developers a break...", and anyone whose been keeping up with news from Microsoft these days can easily assume that his post is talking about all of the new and soon-to-be software releases. I was going to leave him a comment, but it soon became a post.

Overall, I agree... but it's bitter-sweet. I love new technology, always have... and I'm particularly thrilled with all of the new bits for Developers, IT Pros, and even the daily user that are being, and will be released by Microsoft: WF, WCF, WPF, ATLAS, Vista, CardSpace, Exchange, SMS and all of it's buddies, Longhorn, Storage Server, ISA, MapPoint, Office, IIS, IE, Live, WinMo 5, CE 6, PowerShell, SharePoint, BizTalk... and on and on.

So what makes it different from the last several years? Well, it’s easily overwhelming because a lot of these new releases are not relatively simple updates to the software we know, they're so different that it's like learning an entirely new product.

Also in the past, we've seen a lot of new software come out that was not easily adopted by small-businesses. So unless you were strictly working with major corporations, you had some time to play with software before you saw it become widely used. Now, small-business is booming and MS is releasing a lot of "lite" versions to meet these companies’ needs and budgets, so it's not leaving us much time to get familiar with the products before they become main-stream.

The sweet side of this is that it's new technology, and it's only a matter of time before you figure it out.

A new era of software is upon us and I'm just excited to be a part of it.

Halloween Horror: The SQL Timeout

I don’t know when it started or why, but I love Halloween (and autumn for that matter). So keeping the tradition of Halloween alive, I’ve decided to share some “horror” stories from the software/IT field over the next few weeks.

 

The SQL Timeout…

 

A few years ago, myself and another developer were brought in to help get a project moving along that had been at a stand still basically because it was the first ASP.NET app the existing team had tried to tackle. They sure picked a whopper to take on as their “learning” project too, but that of course ended up being bitter-sweet for me. I should add that the team was very competent and well experienced; they just lacked the .NET mojo.

 

Anyway, by the time we got involved; they had laid most of the foundation and were starting to build the other layers on top. Due to the existing project state and the time-constraints, we were forced to do a lot of independent testing during development. When a major milestone in the project was reached and it came time to stress/load test the application, we were expecting similar results to those found in the independent tests (famous last words). Well… not quite. We kept getting a SQL Timeout Error whenever there were multiple, simultaneous requests for databound pages, and we couldn’t test anything beyond that point. The weird thing about this was that it didn’t just happen under heavy loads; it simply happened when there was more than 1 request.

 

I’ll spare you the story about all the things we checked and re-checked from the hardware to the end users. In the end, I found that someone had declared a SqlConnection object as Static/Shared in the heart of the O/R mapped code. So anytime a request was processed, it was using the same SqlConnection object as the previous request (remember, this is a web-app) and would kill the previous request. The result would be a SQL Timeout Error for any of the requests before the last. Ah, memories.

 

The moral of this story is that you should be very weary of creating Static/Shared databound objects in ASP.NET applications, especially connection objects.

 

Oh yeah, boo!

Search.Live.Com. I want to like it, I really do...

Since it's no longer tagged Beta, its fair game right? Well, I have to be honest; so far I've had nothing but bad experiences with using the Live.com search engine. I'll give you my latest example:

I was watching a video of Victor Wooten, one of the most unique bass players around. Being a bass player myself, I like to learn other people’s styles and try to incorporate them into my music. So what's one of the first things you do when you need help learning someone else's song? Tab search, of course! Just look at the difference between Live and Google results for the value "wooten amazing grace bass tab":

Live: http://search.live.com/results.aspx?FORM=IE7&q=wooten+amazing+grace+bass+tab
Google: http://www.google.com/search?q=wooten+amazing+grace+bass+tab

It almost feels like the Live search results are based around trying to sell you stuff rather than relevance.

I tried every combination I could think of, short of searching for an exact URL. I even tried other search engines and was surprised to see that every other engine actually returned more relevant results than Live... except for Lycos. Then I noticed at the bottom of the Lycos page, it says: "Portions powered by Windows Live". Well, no surprise there.

I have hope for the future of Live search, but for right now I'm just a little surprised it's not still in Beta, because it really should be.

VB.NET Hexadecimal to Floating Point / Single (IEEE 754)

A post just came across the forum I frequent regarding Hexadecimal to Floating Point conversion. Strangely there appears to be no direct way to do this in .NET, and the solutions I found were pretty lame and tedious… so it became my mission to get it done the .NET way, and here is the result:

    Private Function ConvertHexToSingle(ByVal hexValue As String) As Single

        Try

            Dim iInputIndex As Integer = 0

            Dim iOutputIndex As Integer = 0

            Dim bArray(3) As Byte

 

            For iInputIndex = 0 To hexValue.Length - 1 Step 2

                bArray(iOutputIndex) = Byte.Parse(hexValue.Chars(iInputIndex) & hexValue.Chars(iInputIndex + 1), Globalization.NumberStyles.HexNumber)

                iOutputIndex += 1

            Next

 

            Array.Reverse(bArray)

 

            Return BitConverter.ToSingle(bArray, 0)

        Catch ex As Exception

            Throw New FormatException("The supplied hex value is either empty or in an incorrect format. Use the following format: 00000000", ex)

        End Try

 

    End Function

 

 

ConvertHexToSingle("3C000000")

Even though this is just a rough example, it does work, and it can be expanded to support larger types (such as Double) with a couple of small mods.

 

3D Desktop Interface... decorated by BOB

With all the hype surrounding 3D desktop interfaces these days, it's always fun to take a look back at some of the projects that have helped us to get where we are now: http://research.microsoft.com/adapt/taskgallery/ 

I've always thought that this project was actually a pretty good idea (except for the BOB’ness of course), and probably one of the only 3D interfaces I would actually use. It's summed up pretty well in this excerpt from the site:

"People typically spend most of their time concentrating on one task at a time, whether on the computer or engaged in more tangible pursuits. This concentrated focus, though, is often interspersed with attempts to gain overall awareness of context. Sometimes this happens serially: intense focus while writing a document and then a brief and temporary switch to check email. Sometimes it happens in parallel: taking in peripheral information while driving. Current computer-based productivity applications do not support this basic need: the need to combine focus and context. By placing existing productivity applications in a 3D environment, the TaskGallery design lets the user easily and dynamically choose a balance between focus and context."

 

Posted: Aug 11 2006, 01:33 AM by CraigG | with no comments
Filed under: , , , , ,
SharePoint Portal Server 2003 Experience (Part 3)

In the first two parts of this series, I discussed some topical information. In Part 3, I’ll just jump all over.

Audiences not being populated with all members of a security group

There is a BUG related to the Audience feature in SPS2003 (all current services packs) that I found during the implementation process.

When you create an Audience using the User -> Member Of option and you specify a Windows security group (group ABC), if any of the users in group ABC also have group ABC as their primary group, it will not find that user.

The reason is because the LDAP query only searches the memberOf attribute in the metadata of each user object, and AD does not store any reference to the primary group information in memberOf, but instead it stores it as an integer in the primaryGroupID attribute.

The easiest way to solve this is to change the Primary Group of the affected users by opening the user account in AD and clicking on [Member Of] tab. You can change the Primary group by selecting a group name, and clicking on [Set Primary Group]. Unless you are using a 3rd party product that requires specific primary groups, the primary group should be set to Domain Users by default.

The other workaround that Microsoft suggested is not even worth repeating.

If you need to reference the open Microsoft support case, send me an email and I’ll give you the case ID.

Local Administrators have full access to WSS sites

By default, any user that is a member of the local machines Administrators group will have full access to all SharePoint sites in your portal. You can disable this behavior with the following hotfix: http://support.microsoft.com/kb/892295/

Static IP in IIS

Your SPS Web sites cannot have a static IP defined in the IIS configuration. It must be set to (All Unassigned). This is by design.

Create custom templates for your WSS sites

The following procedure will allow you to create a custom site template that can be used whenever creating a new site.

1) Create a new site and set up everything the way you want it.

2) Navigate to: Site Settings -> Go to Site Administration -> Save Site as Template

3) Save it as c:\someDir\myTemplate.stp

4) Import the template into the SPS database and make it available for site creators by using the stsadm tool:

stsadm.exe -o addtemplate -filename c:\someDir\myTemplate.stp -title "My Custom Template" -description "A custom WSS template."

5) Now when you create a new site, you will see "My Custom Template" as an option.

6) stsadm.exe/? for more options including enumeration and removal of templates.

Create a custom link in Portal Site Map

The quick launch bar (the vertical link bar on the left) does not directly allow custom links to be added, only links to Areas that you create. This is how to do it without modifying the underlying source:

1) From the portal home page, click on Site Settings -> Manage portal site structure

2) Now you have to pretend that each new "Area" you create is really just a link. Determine where you want to add the custom link, then either Create Area (or link), or Create Sub Area (or link).

** Deleting or editing an existing link/area will directly impact the Area and all data, so make sure you don’t do that until you understand how this all works.

3) Now click on the [Edit] menu option for the new Area you just created.

4) Click on the [Page] tab.

5) In "Area Templates", change the option to: "This area uses the following page as a template".

6) Change the textbox to whatever link you want, ex: http://www.crgitsolutions.com

7) Click [Ok], and you now have a custom link in the portal site map.

Disable Front-Page editing of your sites pages

I strongly recommend you put some manual labor into editing your SPS/WSS pages, as using Front-page only causes more headaches then its worth.

This article explains how to disable editing all together:

http://www.kbalertz.com/kb_838117.aspx

All lists are not created equal

Some of the pre-defined list types are not as functional as others, and you should be aware of this before you use them for production tasks.

For instance, the Attendee list in Meeting Workspaces can not be edited in a datasheet (or Access), exported, nor can it have its existing column settings modified.

If you are already in this situation, check this out:

http://www.sharepointblogs.com/vandest/archive/2006/02/23/5313.aspx

Otherwise, create a custom list to store your Attendees.

SharePoint Portal Server 2003 Experience (Part 2)

In Part 1, I talked mostly about redesigning the presentation layer of your SharePoint Portal Server (SPS) website. What I would like to cover now is modifying other aspects not directly linked to the standard website design process.


 

Supporting Other File Types


One of the things you will most likely want to add is the ability to accommodate file types beyond what ships with SPS. You need four things to make this happen. Below are the steps required to add a PDF document type to your portal. Replace “PDF” with any other file extension to do the same.

 

1)      Change the Index settings to include this file type:

- Navigate to: Site Settings > Configure Search and Indexing > Include File Types

- Add the “pdf” extension.

 

2)      Modify the *\TEMPLATE\XML\DOCICON.XML file:

- Open this file in Notepad or whatever text editor you want and add this line to the other like elements:

<Mapping Key="pdf" Value="pdf16.gif"/>

 

3)      Add an IFilter that is created just for the file type.
- In this case, there just so happens to be an IFilter for this document type. You can download it with installation instructions here:
http://www.adobe.com/support/downloads/detail.jsp?ftpid=1276

- IFilters allow you to full-text search the document type. Not all document types have an appropriate filter, but don’t fear, everything else will work fine.

 

4)      Add an image of the ICON associated with that file type:

- Once you have a 16x16 gif of the ICON associated with this file type, copy it into *\TEMPLATE\IMAGES\ as these two file names: ICPDF.GIF and PDF16.GIF.

 

Here is a KB article that basically says the same:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;832809

FrontPage Ghosting

In Part 1, I mentioned that FrontPage caused some headaches with “ghosting”. Ghosting is essentially SPS’s terminology for caching page content. When you edit a page and save it in FrontPage, not only does it add a bunch of crap that you usually don’t need, but it also stores ALL of the page content directly in the database. This makes sense since that is the fundamental process SPS uses to load content for your viewing pleasure. However, this destroys any inheritance from template pages, meaning any design changes you make to the template pages will not be applied to this now “unghosted” page. There is a fix, but it requires some SQL knowledge. Because of the potential problems you could encounter, I am not going to spell it out, but I will point you in the right direction:

 

1)      Open the SITENAME_SITE database.

2)      Open the DOCS table and find the exact page you are trying to “unghost”.

3)      Write a SQL statement to set that rows CONTENT field to NULL.

 

Your page will now be “ghost-able” again.

 

Silly FrontPage.

 

QuickLaunch Watermark

Another thing you may want to change on your SPS site is that vertical “SharePoint Portal Server” logo located in the QuickLaunch area. This is easily done by simply finding and replacing any occurrence of "SharePoint Portal Server" in *\TEMPLATE\1033\default.aspx (and a couple others) with whatever your want.

 

Global Templates

 

So you finally design a SITE that you would like to use as a template for other sites that are not children of this site. This link will explain how to create a template you can use with new sites, among other things:
http://www.microsoft.com/resources/documentation/wss/2/all/adminguide/en-us/stsh05.mspx

 

 

* = C:\program Files\Common Files\Microsoft Shared\web server extensions\60

SharePoint Portal Server 2003 Experience (Part 1)

I’ve recently started a project implementing SharePoint Portal Server 2003 (SPS) to replace a legacy intranet solution, and while I’ve deployed SharePoint several times in the past, this is by far the most customizations that I have made to the portal. So I figured this would be a good opportunity to talk about some of my experiences thus far…

 

The requirements for the Portal:

-         Design to look somewhat familiar to parent companies site (not SPS).

-         Mimic all the functionality from the legacy intranet site.

-         Simplify current document sharing scheme.

-         Make as self manageable as possible.

-         4 month schedule.

 

One of the major customizations that needed to be done to the out-of-the-box SPS install was the UI design. I don’t know if it’s just the projects I’ve worked on, but when it comes to UI, it always seems to take longer then it should to make everyone happy… so I fittingly scheduled this part of the project to take the longest (and it has).

 

All tasks considered, modifying the SPS UI has been pretty easy, but by no means has it been snag free. Almost all of the existing components can be easily modified by changing a CSS value, but for any major change you will most likely have to modify every .aspx page under the *\TEMPLATE directory/sub directories. One of the things that required this level of change was the common Portal header. I was very surprised to find that some of the style values were hard coded in the .aspx page while the rest of the values were in a CSS. SPS does provide an option to supply an “AlternateHeader” that works by replacing the page header with a customized one, and it does… however there are 2 reasons why I didn’t use this:

 

1)      The “AlternateHeader” is not context sensitive. There are certain values that need to be hard coded into header web parts on each page that assist in linking to Help topics, etc.

2)      Not all pages implement the “AlternateHeader” option.

 

I also investigated using the option for a Custom Cascading Style Sheet. This seemed to work ok until I found out that the Portal and the Windows SharePoint Services (WSS) had some common values stored in the same CSS. For example, if I was trying to change the color of one element in the Portal, it might very well change the color of a totally different element in a WSS site, which I suppose is the logic behind offering an option for a custom CSS that ONLY applies to the Portal. Another issue is that you can not change the default theme used for WSS sites, so you MUST modify the common CSS files. I was able to get both the Portal and WSS sites looking the way I wanted by making the modifications in this order:

 

-         I modified all of the *\TEMPLATE\LAYOUTS\1033\STYLES\*.CSS files to make the WSS sites look the way I wanted them. Don’t worry about what this does to the Portal, as you are going to fix that shortly.

 

-         I then made my changes to the common Portal header by writing a program that would first pull context sensitive values from an .aspx page, and then overwrite the existing header with my custom header incorporating the values I gathered earlier. I ran this program against all .aspxs pages in the *\TEMPLATE directory/sub directories.** (I hope to document this more when I have a chance)

 

-         I created a separate CSS and told the Portal to use it as the Custom Cascading Style Sheet. I then modified this CSS to make the Portal look the way I wanted it.



This was the only way I could find to give me all the control I needed. I also designed my custom header to be very flexible and to rely heavily on CSS so that in the future I won’t have to modify every .aspx again to make simple design changes.

 

I also tried to use FrontPage to assist in this process, but it ended up causing me a major issue with "ghosting", which I will explain in Part 2 of this series. If you are going to use FrontPage with SPS, then I would limit its use to one of two scenarios:

 

1)      You set up a development site where you can make your changes to the design, then manually apply them to the rest of portal.

2)      You are editing a page which does not inherit any design elements from a parent page.

 

Here are a couple of links that really helped:

 

SharePoint CSS Definitions: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/spptsdk/html/tsovCSSStyles.asp

 

SharePoint CSS Info: http://blog.hishambaz.com/archive/2005/01/29/196.aspx

 

The author from the above link provides the following code that will help you figure out what CSS styles are being used. Just plop this in the <body>:

 

<script language="jscript">

function ClassInfo() {

if (window.event.srcElement.className != null)

{ stsclass.innerText = window.event.srcElement.className; }

            else { stsclass.innerText = ""; } }

window.document.body.onmouseover = ClassInfo;

</script>

 

<div style="border-style:solid;border-width:1px; width: 281px; height: 34px;

position: absolute; left: 286px; top: 41px; z-index:15; padding-left:4px;

padding-right:4px; padding-top:2px; padding-bottom:2px; background-color:#EEEEF4">

<p id="stsclasstitle"><font face="Tahoma" id="stsclasstitle">Classname: </font>

<font face="Tahoma"id="stsclass">&#xa0;</font>

</p></div>

 

I know there is not much documentation on this entire process, so hopefully this information will be of some use to you ;)

 

* = Program Files\Common Files\Microsoft Shared\web server extensions\60

** = When applying changes to the .aspx pages. The *\1033\STS, and the *\TEMPLATE\LAYOUTS\1033 folders contain the WSS files. The rest are SPS files.

 

Suggestions while visiting London?

I am heading over to London for a couple of weeks in November, and I would be very interested in hearing from the perspective of people with similar interests as me. Do you have any suggestions and/or advice for a first time London visitor?



Thanks for any info.

The DragDrop events have stolen my object, now I want it back...

When you initiate Control.DoDragDrop() and drag the cursor over another control that has AllowDrop = TRUE, a reference to the object in the drag data is created and not released upon DragLeave.

Here is an example demonstrating the behavior:
http://www.mdevx.com/other/temp/dragdrop_issue.zip

More Posts Next page »