Someone had a very happy night. ;)

Someone had a very happy night. ;)

0 notes

Copyright Dates

So shortly after New Year my awesome company tweeted this:

image

So I thought I might actually sit down and explain how this works. 

First off you technically don’t need copyrights on your web pages. Just like you technically don’t need watermarks on your images for them to be yours. But having them on the page declares to everyone this belongs to somebody else and that you can’t just take it.

So here are the two basic super each example of how to do this:

PHP

© <?= date("Y") ?> My Company, Inc. All Rights Reserved.

ASP.NET C#

© <%: DateTime.Now.Year %> My Company, Inc. All Rights Reserved.

So there you go. Fairly straightforward and easy to do. It would be awesome if more people did it…so you should go do it! :)

0 notes

Making an Active Directory Portal

While researching a project for my lovely wife yesterday I stumbled upon this awesome gem. 

internal UserPrincipal GetUser(string userName)
{
    PrincipalContext principalContext = new PrincipalContext(ContextType.Domain, "YourADController",
                                               "YourADContainer",
                                               "ADAdminUser", "ADAdminPassword");

    UserPrincipal user = UserPrincipal.FindByIdentity(principalContext, userName);

    return user;
}

internal void ResetPassword(string userName, string newPassword)
{
    try
    {
        //
        // Update normal AD attributes
        //
        UserPrincipal user = GetUser(userName);
        user.SetPassword(newPassword);
    }
    catch (PasswordException)
    {
        throw new Exception("Password does not meet complexity requirements");
    }
}

internal void SetPassword(string userName, string oldPassword, string newPassword)
{
    try
    {
        //
        // Update normal AD attributes
        //
        UserPrincipal user = GetUser(userName);
        user.ChangePassword(oldPassword, newPassword);
    }
    catch (PasswordException)
    {
        throw new Exception("Password does not meet complexity requirements");
    }
}

Basically this a partial example of how to interact with Active Directory using ASP.NET MVC3 specifically. After playing with the example and doing a little bit more work I found the ability to integrate rather awesome.

Now I hope this is obvious but this sort of integration is _**only**_ possible using ASP.net. So for open source places this is a mute point. ;)

0 notes

Code Blocks

Well after a little bit of work my site should properly display codes blocks:

//Hello!
echo "Hello world!";

I know pretty cool right! ;)

0 notes

40 Reasons Why Guns Should Be Banned

May you will agree or maybe you won’t…but here it is…

http://libertarianchristians.com/2009/02/13/40-reasons-to-ban-guns/

Let me know your thoughts on Facebook. :)

0 notes

Conquer Tumblr in a morning

So my blog is now running through Tumbler. Why you ask? Firstly because Tumblr has a simple implementation and with some simple work it can post to any website:

https://github.com/greenygh0st/PHPTumblr

So why you might ask? Why do all that extra work to have it on a website separate from Tumblr? Well I can think of at least a few reasons. First control. Second companies may want to have the blog show up on their site. Anyways there are lots of awesome reasons. ;)

Any questions? Grab me on FB or Twitter.

0 notes

Experimenting

So tonight I am experimenting with Tumbler…not really sure what I think about it yet. Hopefully I can use their API to just tie it into my blog.

We shall see.

0 notes