woensdag 25 maart 2009

Ajax And Sharepoint wss 3.0 SP1

first install Asp.net ajax extensions and modify the web.config of your sharepoint site. instructions can be found here: msdn ajax install .

a simpler and safer way to put a scriptmanager is to add it to the masterpage (can be found :C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\GLOBAL\default.master )
and add an scriptmanager :
(asp:scriptmanager runat="server" enablepartialrendering="true" id="ScriptManager1")

just afer

(webpartpages:spwebpartmanager id="m" runat="Server")


Use this abstract class to inherit your webpart from and make it ajax-enabled.

dinsdag 10 maart 2009

Windows SharePoint Services 3.0 SP1 on Vista x64/x86

You can now run sharepoint services and develop webparts on vista, no more VM's !

This nice solutions was created by Bamboom solutions.
Check out the instructions and downloads here.
For me the install was successful and really easy, and I created some webparts with VS2008 that deployed without any problem.

maandag 9 maart 2009

Working with performance counters.

this example reads out two cache performance counters.



next example creates 2 new performance counters and increments their value.

vrijdag 6 maart 2009

Simple delay calculator

Reading ID3v2 tags with taglibsharp

Taglibsharp latest build can be found on http://developer.novell.com/wiki/index.php/TagLib_Sharp
This testapp will read out every ID3v2 tag it finds and keeps a collection of mp3's which don't have any ID3v2 tag.

donderdag 5 maart 2009

VB's 'RedimPreserve' in C# (generic)

Google API - code search

Fill in a query and number of results and get a result back from google's code search service.


Set Color of console.

SetConsoleTextAttribute() can change the color of the console.

Visual studio addin - extra feature on errorlist

This code puts an extra popup commandbar on the errorlist with all the error descriptions as commandbarbuttons, each button has a lookup event (google lookup).


maandag 2 maart 2009

New C# 4.0 features

1) dynamic

"most anything that you could do with some variable, you can do with a dynamic variable."

static double SumDouble(double a, double b) { return a + b; }
static decimal SumDecimal(decimal a, decimal b) {return a + b;}

this can now be writen as :

static dynamic Sum1(dynamic a, dynamic b) { return a + b; }

or more generic :

static dynamic Sum2(T1 a, T2 b) {
dynamic
ad = a;
dynamic
bd = b;
return
ad + bd;
}


more:
Dynamically Typed Objects with C# 4.0 (xml example)



2) Named arguments, optional arguments, and default values

By giving method parameters default values.

public class ContactList
{
List<Contact> SearchForContacts(
string name = "any",
int age = -1,
string address = "any") { ... }

static void Main()
{
ContactList list = new ContactList();
var x = list.SearchForContacts(age:26);
}
}
U can then call the method like this:

list.SearchForContacts(age:26);

or

list.SearchForContacts(address:"home", name:"sam", age:30);