Chris Eargle

Life Student of the Kodefu Arts

Create Vista Icons in VS 2008

by chris 8. August 2008 12:00

Axialis has released a free add-in for VS 2008 that creates the 256x256 icons used in Vista. Download IconWorkshop™ Lite and free yourself from the 32x32 bit tyranny!

 

 

Here's the download page:

http://www.axialis.com/download/iwlite.html

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

download, icon, vista, addin, visual studio

Zen

E-mail | Kick it! | DZone it! | del.icio.us
Permalink | Comments (0) | Post RSSRSS comment feed

String to Stream

by chris 7. August 2008 12:31

Sometimes a string isn't enough, you need a stream. Unfortunately, there isn't a direct method to stick a string into a stream. But we are saved! MemoryStream will take bytes... here's how to convert your string into a series of bytes so you can get that all important StringStream. No, I'm not going to make a StringStream class though you certainly can fulfill your masochistic class explosion desires.

String request = "I can has cheezburger?";

MemoryStream stream = new MemoryStream(Encoding.Unicode.GetBytes(request));

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

string, stream

Techniques

E-mail | Kick it! | DZone it! | del.icio.us
Permalink | Comments (0) | Post RSSRSS comment feed

Hung Database Restore

by chris 4. August 2008 13:08

When doing a deployment today, the build script errored out with a SQL timeout.

C:\Projects\MyProject.proj (2374,3): error: PROJDB: Error # -2 on Line 0: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

The line in the msbuild script was executing a backup/restore script to refresh the database for one of our teams. I decided to change the StatementTimeout for the ExecuteDDL task and try again. This time I received another error.

C:\Projects\MyProject.proj (2374,3): error: PROJDB: Error # 4060 on Line 65536: Cannot open database "PROJDB" requested by the login. The login failed.
C:\Projects\MyProject.proj (2374,3): error: PROJDB: Error # 18456 on Line 65536: Login failed for user 'DOMAIN\BuildUser'.

Why would my database login be messed up? I jumped onto the database server through Management Studio and discovered that the database was stuck in the Restore state. I waited for a while to see if it would go away, but it became clear that it was hung. I googled around to see what needed to be done to fix it. Someone suggested that running the following command would take it out of that state: RESTORE DATABASE <dbname> WITH RECOVERY. It didn't. Instead, I received an error that you can't alter the database while it is being restored.

I finally solved the problem by deleting the database, adding a new database with the same name back, then running the restore script.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

sql server, database

General

E-mail | Kick it! | DZone it! | del.icio.us
Permalink | Comments (0) | Post RSSRSS comment feed

MSI Compilation Error

by chris 24. July 2008 10:13

While building a new Web Deployment project, I received the error "Unable to build project output group 'Content Files from (Active)." I checked all of my settings and everything seemed to be correct.

I found a support article on Microsoft's Help and Support site describing why this occurs. Apparently, if you have missing files in your project this will happen. In this case, it turns out that a folder of images had been moved in the source tree but not in the project file. This was causing them to all show the the yellow exclamation symbol. Even though the project has "warnings as errors" turned on, the compiler will not complain about missing content files since it does not need to do anything with them.

If you get the error, quickly scan the project you're deploying for any missing files. It will be a file with the Build Action set to Content.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

msi, deployment

Kodefu

E-mail | Kick it! | DZone it! | del.icio.us
Permalink | Comments (0) | Post RSSRSS comment feed

Moving Parts and Timeouts

by chris 15. June 2008 16:41

Last week I was tasked with changing our build script from using sql scripts to build the database, to running sql scripts to backup and restore a "gold standard" database. Aside from a few permission issues, things went mostly well. However, in the process I updated MSBuild Community Tasks to the nightly build version. I had an error I thought it might help with, but it turned out not to be the case. I kept the unreleased version in production because it generated clearer messages in the ExecuteDDL task. For those of you that don't know, version 1.2.0.306 gives truly awful information in the event a sql script fails.

Fast forward to tonight. I had to roll out a demonstration version of the software from the previous iteration. This meant changing views in the source control system so it would execute the previous versions scripts. When I ran it, received this error (traceable info changed): C:\MyData\Project\base\src\Project.proj (1550,3):  error : ProjectCDDB: Error # -2 on Line 0: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

I used the ultracool "MSBuild Output" report to get color coding so I could easily trace down which file was causing the error. I then looked at it's size. Sure enough, it was a beast. But it used to run, and it worked when I manually executed it, so what was different? MSBuild Community Tasks, of course.

I pulled down the latest source and opened up ExecuteDDL. Sure enough, there was a new property in the class... StatementTimeout, defaulted to 30 seconds. That's probably not the best timeout for a sql script that exceeds 5 megabytes.

I changed the timeout to 120 seconds; yet another problem solved. I suppose this sort of thing is bound to happen when you're changing version of libraries and then forced to use chronomancy to pretend it's a month in the past.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

msbuild

Kodefu

E-mail | Kick it! | DZone it! | del.icio.us
Permalink | Comments (0) | Post RSSRSS comment feed

C# 3.0 Presentation

by chris 25. April 2008 02:08

The examples I showed in my C# 3.0 presentation were based on the examples provided in the Visual Studio 2008 Training Kit. The source code for the new features in C# 3.0 are located, by default, in C:\VS2008TrainingKit\Labs\WhatsNewC#. There are other great labs in this kit as well.

  • Building Web Apps
  • Building WPF Apps
  • CardSpace
  • Client Application Services
  • Dynamic Sites
  • Intro to ASP.NET Ajax
  • JSON
  • LINQ to SQL
  • Silverlight Monster Factory
  • LINQ in VB9
  • VSTO (Excel, Outlook, SharePoint, Word)
  • Windows Communication Foundation
  • Windows Workflow Foundation
  • What's New in VB9
  • Workflow Services
  • WPF Data Binding

That's an exhausting list of material to learn!

Of course, code alone doesn't give you a lot of information. Here are the topics I touched upon with links to MSDN.

C# 2.0

·         Partial Types

·         Aliases

·         Static Classes

·         Property Access Modifiers

·         Generics

·         Nullable Types

·         Null coalescing operator

·         yield

·         Delegates

o   Inference

o   Covariance/Contravariance

o   Anonymous methods

 

C# 3.0

·         Auto-Implemented Properties

·         Object and Collection Initializers

·         Implicitly typed variables

·         Anonymous types

·         Extension Methods

·         Lambda Expressions

·         Expression Trees

·         LINQ

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

linq, lamdba

Presentation

E-mail | Kick it! | DZone it! | del.icio.us
Permalink | Comments (1) | Post RSSRSS comment feed

Augusta Meeting Tonight

by chris 24. April 2008 07:58

I am presenting on new language features in C# 3.0 at the inaugral meeting of the Augusta Developers Guild tonight. It will be nearly devoid of slides, as I've decided the words on the screen will be more of a distraction than anything. So, let's code, lambda!

Currently rated 5.0 by 3 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

E-mail | Kick it! | DZone it! | del.icio.us
Permalink | Comments (0) | Post RSSRSS comment feed

WCF 3.5 Security Guidelines

by chris 17. April 2008 08:16

The patterns & practices WCF Security Guidance project has released the the WCF 3.5 Security Guidelines. This is useful if you're trying to follow the best practices for securing your services.

Here are the categories and topics for the initial release of the guidelines. For more in depth information, go to the site.  

Categories

  • Auditing and Logging
  • Authentication
  • Authorization
  • Binding
  • Configuration Management
  • Exception Management
  • Hosting
  • Impersonation and Delegation
  • Input/Data Validation
  • Proxy Considerations
  • Deployment considerations 

Auditing and Logging

  • Use WCF auditing to audit your service
  • If non-repudiation is important, consider setting SuppressAuditFailure property to false
  • Use message logging to log operations on your service
  • Instrument for user management events
  • Instrument for significant business operations
  • Protect log files from unauthorized access
  • Do not log sensitive information

Authentication

  • Know your authentication options
  • Use Windows Authentication when you can
  • If you support non-WCF clients using windows authentication and message security, consider using the Kerberos direct option
  • If your users are in AD, but you can’t use windows authentication, consider using username authentication
  • If your clients have certificates, consider using client certificate authentication
  • If you need to streamline certificate distribution to your clients for message encryption, consider using the negotiate credentials option
  • If your users are in a custom store, consider using username authentication with a custom validator
  • If your users are in a SQL membership store, use the SQL Membership Provider
  • If your partner applications need to be authenticated when calling WCF services, use client certificate authentication.
  • If you are using username authentication, use SQL Server Membership Provider instead of custom authentication
  • If you need to support intermediaries and a variety of transports between client and service, use message security to protect credentials
  • If you are using username authentication, validate user login information
  • Do not store passwords directly in the user store
  • Enforce strong passwords
  • Protect access to your credential store
  • If you are using Windows Forms to connect to WCF, do not cache credentials

Authorization

  • If you use ASP.NET roles, use the ASP.NET Role Provider
  • If you use windows groups for authorization, use ASP.NET Role Provider with AspNetWindowsTokenRoleProvider
  • If you store role information in SQL, consider using the SQL Server Role Provider for roles authorization
  • If you store role information in Windows Groups, consider using the WCF PrincipalPermissionAttribute class for roles authorization
  • If you need to authorize access to WCF operations, use declarative authorization
  • If you need to perform fine-grained authorization based on business logic, use imperative authorization

Binding

  • If you need to support clients over the internet, consider using wsHttpBinding.
  • If you need to expose your WCF service to legacy clients as an ASMX web service, use basicHttpBinding
  • If you need to support remote WCF clients within an intranet, consider using netTcpBinding.
  • If you need to support local WCF clients, consider using netNamedPipeBinding.
  • If you need to support disconnected queued calls, use netMsmqBinding.
  • If you need to support bidirectional communication between WCF Client and WCF service, use wsDualHttpBinding.

Configuration Management

  • Use Replay detection to protect against message replay attacks
  • If you host your service in a Windows service, expose a metadata exchange (mex) binding
  • If you don’t want to expose your WSDL, turn off HttpGetEnabled and metadata exchange (mex)
  • Manage bindings and endpoints in config not code
  • Associate names with the service configuration when you create service behavior, endpoint behavior, and binding configuration
  • Encrypt configuration sections that contain sensitive data

Exception Management

  • Use structured exception handling
  • Do not divulge exception details to clients in production
  • Use a fault contract to return error information to clients
  • Use a global exception handler to catch unhandled exceptions

Hosting

  • If you are hosting your service in a Windows Service, use a least privileged custom domain account
  • If you are hosting your service in IIS, use a least privileged service account
  • Use IIS to host your service unless you need to use a transport that IIS does not support

Impersonation and Delegation

  • Know the impersonation options
  • If you have to flow the original caller, use constrained delegation
  • Consider LogonUser when you need to impersonate but you don’t have trusted delegation
  • Consider S4U when you need a Windows token and you don’t have the original caller’s credentials
  • Use programmatic impersonation to impersonate based on business logic
  • When impersonating programmatically be sure to revert to original context
  • Only impersonate on operations that require it
  • Use OperationBehavior to impersonate declaratively

Input/Data Validation

  • If you need to validate parameters, use parameter inspectors
  • If your service has operations that accept message or data contracts, use schemas to validate your messages
  • If you need to do schema validation, use message inspectors
  • Validate operation parameters for length, range, format and type
  • Validate parameter input on the server
  • Validate service responses on the client
  • Do not rely on client-side validation
  • Avoid user-supplied file name and path input
  • Do not echo untrusted input

Proxy Considerations

  • Publish your metadata over HTTPS to protect your clients from proxy spoofing
  • If you turn off mutual authentication, be aware of service spoofing

Deployment considerations

  • Do not use temporary certificates in production
  • If you are using a custom domain account in the identity pool for your WCF application, create an SPN for Kerberos to authenticate the client.
  • If you are using a custom service account and need to use trusted for delegation, create an SPN
  • If you are hosting your service in a Windows Service, using a custom domain identity, and ASP.NET needs to use constrained trusted for delegation when calling the service, create an SPN
  • Use IIS to host your service unless you need to use a transport that IIS does not support
  • Use a least privileged account to run your WCF service
  • Protect sensitive data in your configuration files

My Related Posts

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

wcf, security, guidelines

Training

E-mail | Kick it! | DZone it! | del.icio.us
Permalink | Comments (0) | Post RSSRSS comment feed

.NET 3.5 Enhancements Training Kit

by chris 16. April 2008 08:59

Microsoft has released a training kit for .NET Framework 3.5 Enhancements. It includes labs, demos, and Power Point files for the following technologies:

  • ASP.NET MVC
  • ASP.NET Dynamic Data
  • ASP.NET AJAX History
  • ASP.NET Silverlight controls
  • ADO.NET Data Services
  • ADO.NET Entity Framework

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

download, mvc, ajax, entity, silverlight

Training

E-mail | Kick it! | DZone it! | del.icio.us
Permalink | Comments (0) | Post RSSRSS comment feed

Sessions Galore

by chris 7. March 2008 08:11

I've been busy since the South Florida Code Camp. I've been promoted to the Architecture Team on the South Carolina Integrated Tax System project, and I've been to two more code camps.

The speaker list was already full when I tried to get in on the Raleigh Code Camp. I was still able to do a session on Continuous Integration due to another speaker's VM crashing. I had very few attendees since it wasn't advertised. However, as long as I have one person interested in the topic then I'm good to go.

Last weekend I did two sessions at the Roanoke Code Camp. The Design Principles presentation went very well, with enough crowd participation to keep it interesting. The Continuous Integration session went smoothly, but the crowd was somewhat quiet. Afterwards, one of the attendees told me that he thought it was a follow-up to the Design Principles session (apparently confusing MSBuild with Building Software). So, it's possible the crowd was quiet because they had no background in what I was presenting on. This was exacerbated by the fact I was in the same room.

From now on, if I'm going to do multiple sessions I will try to do related topics (design or agile processes) or request to be in different rooms.

This coming Wednesday I will be presenting on Continuous Integration at the Triangle .Net User Group in Raleigh. I've currently been running two 30 minute modules: 1) MSBuild, 2) CI / Cruise Control.NET. I will put together a new module this weekend so I can fill out the time more appropriately for a user group meeting. I'll probably take it back to fleshing out the build process with running more tests and integrating the generated reports into CruiseControl.NET.

After next week, I will have done 8 sessions at 6 events in 5 locations. It's still early in the year so perhaps I should set my goal to 20 locations instead of 20 events? When do you want me to come to Charleston, Lou?

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

code camp

Path Notes

E-mail | Kick it! | DZone it! | del.icio.us
Permalink | Comments (1) | Post RSSRSS comment feed
<< Previous posts

Powered by BlogEngine.NET 1.3.1.0
Theme by Mads Kristensen

About the author

Chris Eargle Chris Eargle
Enterprise .NET developer in Columbia, SC.

E-mail me Send mail

Calendar

<<  August 2008  >>
MoTuWeThFrSaSu
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

View posts in large calendar

Pages

    Recent posts

    • Create Vista Icons in VS 2008Comments: 0Rating: 0 / 0
    • String to StreamComments: 0Rating: 0 / 0
    • Hung Database RestoreComments: 0Rating: 0 / 0
    • MSI Compilation ErrorComments: 0Rating: 0 / 0
    • Moving Parts and TimeoutsComments: 0Rating: 0 / 0
    • C# 3.0 PresentationComments: 1Rating: 0 / 0
    • Augusta Meeting TonightComments: 0Rating: 5 / 3
    • WCF 3.5 Security GuidelinesComments: 0Rating: 0 / 0
    • .NET 3.5 Enhancements Training KitComments: 0Rating: 0 / 0
    • Sessions GaloreComments: 1Rating: 0 / 0

    Recent comments

    • C# 3.0 Presentation (1)
      vijay wrote: Good post Thanks, Vijay [More]
    • Format Solution (4)
      Joe wrote: I added a couple of lines to FormatProjectItem() t… [More]
    • Sessions Galore (1)
      Lou wrote: I'll have to get you down here soon - I'll e-mail … [More]
    • Redeemed (3)
      Fred Beiderbecke wrote: It wasn't you, it was some of the others in the ro… [More]
    • South Florida Code Camp (1)
      Jason Meridth wrote: You've mentioned the only latest difference betwee… [More]
    • Redeemed (3)
      Chris Eargle wrote: Hmm, the only thing derisive I remember saying abo… [More]
    • Redeemed (3)
      Fred Beiderbecke wrote: I was in the afternoon session and enjoyed it (exc… [More]
    • Format Solution (4)
      Tony Evans wrote: Just what I was looking for. Thanks! :o) [More]
    • XML Nugget of Joy (2)
      Chris Eargle wrote: How do you retrieve the description, and in what c… [More]
    • XML Nugget of Joy (2)
      Wesley Wilson wrote: That's pretty neat. I've just started using attrib… [More]

    Archive

    • 2008
      • August (3)
      • July (1)
      • June (1)
      • April (4)
      • March (1)
      • February (4)
      • January (5)
    • 2007
      • December (5)
      • November (1)
      • October (6)
      • September (3)
      • August (1)
      • June (1)

    Authors

    • RSS feed for chrischris (36)

    Tags

    • activex
    • addin
    • ado.net data services
    • ajax
    • architecture
    • astoria
    • beta
    • c#
    • code camp
    • com
    • consolas
    • continuous integration
    • ctp
    • database
    • deployment
    • design
    • download
    • ebook
    • entity
    • expression blend
    • font
    • framework
    • gadget
    • grid
    • guidelines
    • icon
    • lamdba
    • linq
    • macro
    • msbuild
    • msi
    • mvc
    • powertoy
    • preview
    • ray ozzie
    • regasm
    • security
    • serialization
    • silverlight
    • source code
    • sql server
    • starter kit
    • stream
    • string
    • trial
    • usability
    • ux
    • vbscript
    • vista
    • visual studio
    • vs2008
    • wcf
    • web
    • winforms
    • wpf
    • xml

    Categories

    • RSS feed for Bleeding EdgeBleeding Edge (3)
    • RSS feed for GeneralGeneral (1)
    • RSS feed for KodefuKodefu (8)
    • RSS feed for Path NotesPath Notes (6)
    • RSS feed for PresentationPresentation (2)
    • RSS feed for TechniquesTechniques (2)
    • RSS feed for TrainingTraining (5)
    • RSS feed for WeaponsWeapons (4)
    • RSS feed for ZenZen (4)

    Archive

    Blogroll

    • RSS feed for Structure Too BigStructure Too Big
      • MSDN Event Thursday in...
      • WorldMaps Update
      • ASP.NET University!
    • RSS feed for Chris CraftChris Craft
      • Pimp My Phone – D...
      • Pimp My Phone – D...
      • Pimp My Phone – D...
    Download OPML file OPML

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    Sign in