mylifeinaminute.com

Archive for April, 2008

Custom Web Parts and Local Deployments

by liquidpooled on Apr.23, 2008, under Microsoft, Office, Sharepoint Server, Visual Studio 2005

When trying to deploy your web parts the “right” way (local content deployment, bin directory, etc.) one issue that can crop up deals with the actual compilation of your custom web part.

If you receive the following error message:

Unable to add selected web part(s).
<Web Part Name>: Assemblies that implement ASP.NET Web Parts and are installed into a partially trusted location, such as the bin directory, must be compiled with the AllowPartiallyTrustedCallersAttribute set for import to succeed.

then you need to add a line to your AssemblyInfo.cs such as the following:


[assembly: System.Security.AllowPartiallyTrustedCallers()]

A good primer on the attribute can be found here.

Leave a Comment more...

A take on anonymous methods in VB.Net

by liquidpooled on Apr.23, 2008, under Microsoft, Visual Studio 2005

One of my colleagues has been thrust into the world of VB.Net (from C#) and has been lamenting the lack of anonymous methods in Visual Basic. Here is his implementation.

Anonymous method call:


Dim pred As New GenericPredicate(Of VendorData)(vd.VendorDataID, "VendorDataID")
Dim found As VendorData = Me.vendor.Data.Find(AddressOf pred.Match)

Generic Class:


Imports System.Reflection

&amp;amp;lt;Serializable()&amp;amp;gt; _
Public Class GenericPredicate(Of T)

#
Region "Member Methods"

    Private _value As Object
    Private _property As String

#
End Region

#
Region "Constructors"

Public Sub New()
    Me._value = Nothing
    Me._property = String.Empty
End Sub

Public Sub New(ByVal val As Object, ByVal prop As String)
    Me._value = val
    Me._property = prop
End Sub

#
End Region

#
Region "Public Properties"

Public Property Value() As Object
    Get
        Return _value
    End Get
    Set(ByVal value As Object)
        _value = value
    End Set
End Property

Public Property Prop() As String
    Get
        Return _property
    End Get
    Set(ByVal value As String)
        _property = value
    End Set
End Property

#
End Region

#
Region "Functions"

Public Function Match(ByVal p As T) As Boolean
    Dim t As Type = p.GetType()
    Dim prop As PropertyInfo = t.GetProperty(Me._property)
    Dim val As Object = prop.GetValue(p, Nothing)

    Return val.Equals(Me._value)
End Function
#End Region

End
Class

Just one more way to do it.

Leave a Comment more...

On Wordpress and staying up to date

by liquidpooled on Apr.21, 2008, under News, Site News, WordPress

Within the past day I’ve found that two blogs that I manage were hacked using known vulnerabilities in earlier versions of WordPress. Since many others have gone into detailed explanations, such as this, I won’t touch on that here.

What I will say is that is worthwhile to remain diligent when it comes to security upgrades/platform updates for blogging software. No one wants to help the spammers.

Leave a Comment more...

SharePoint Calendar Style Sheet

by liquidpooled on Apr.17, 2008, under Internet Explorer, Microsoft, Office, Sharepoint Server

Heather Solomon provides a “clean and condensed” style sheet for branding the default calendar in a WSS 3.0/MOSS 2007 site.  While Heather has provided a great starting point, her sample piece just was not looking right on a MOSS 2007 Enterprise farm I was working on.

I have updated Heather’s style sheet to cover any parts that her’s was missing (at least in Internet Explorer 7 and FireFox 2.0.XXX).

The updated CSS can be found here.

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...