Thursday, April 10, 2008

I have a dream

I have a dream that one day we will be able to program cool stuff on the web without having to use JavaScript.

I have a dream that one day we can code for the web in one language while using proper design patterns like MVC.

I have a dream where people do not have to walk in fear if they don’t use Internet Explorer web pages won’t display properly.

I have a dream that one day you code once and it looks the same in every web browser.

I have a dream where I can have my web browser running with 7 tabs open and it uses under 100 MB of memory.

I have a dream where users on different operating systems are NOT left behind when going to web sites because they use proprietary technology.

I have a dream of open protocols that can be used by anyone to communicate without hidden API’s, DRM, or fear of prosecution for patent violation.

I have a dream where HD video content can be downloaded in seconds and not hours or days…

I have a dream where all packets are created equal and are not treated different from ISP’s because of their shape, size, or content.

I have a dream….

Monday, January 14, 2008

.NET 3.5 Linq w/Data Tables

Well I'm really starting to like LINQ. Man does it make it really easy to filter information very quickly. One question I had was how to query a DataTable. I tend to stay away from DataSet's because of the web (Async/Sync). Well I found the answer, you have to give the type similar to the syntax for generics. For example, here is a quicky:

var query = from c in table.AsEnumerable() WHERE c.Field("Week") = 25 select new { Week = c.Field("Week"), Person = c.Field("Person"), Guess = c.Field("Guess"), Actual = c.Field("Actual") }

Pretty simple syntax allows for some pretty powerful custom filtering in your DataTable. Take the results and bind them to a Grid and your done like Turkey.

-Costoda

Thursday, January 10, 2008

Getting information from Active Directory in .NET 3.5

I can first of all say that .NET 3.5 rocks when it comes to getting or putting information into Active Directory. Gone are the old days of DirectoryEntry and DirectorySearch objects. They have been replaced with a much nicer Principal Framework. Robin Meure has an awesome write up on this on his blog that I recommend you read. After talking to him, we both came up with the question on how do you read in schema properties that aren't attached to the UserPrincipal object. Well, Robin found an awesome article on MSDN that explains this.

Here is an example of a quick dirty object I put together to get the IpPhone and Department properties. Make sure you reference System.DirectoryServices.AccountManagement properly:

[DirectoryObjectClass("user")]
[DirectoryRdnPrefix("CN")]
public class ADUser:UserPrincipal
{
public ADUser(PrincipalContext context) : base(context) { }
public ADUser(PrincipalContext context, string samAccountName, string password, bool enabled) : base(context, samAccountName, password, enabled) { }

[DirectoryProperty("IpPhone")]
public string IpPhone
{
get
{
object[] result = this.ExtensionGet("IpPhone");
if (result != null && result.Length > 0)
return (string)result[0];
else
return null;
}
set
{
this.ExtensionSet("IpPhone", value);
}
}

[DirectoryProperty("Department")]
public string Department
{
get
{
object[] result = this.ExtensionGet("department");
if (result != null && result.Length > 0)
return (string)result[0];
else
return null;
}
set
{
this.ExtensionSet("department", value);
}
}
}



I hope that helps out anyone that had the same question I did.

-Costoda