/// Frank Hagen: Professional Web Developer, C# User, Reformed Über-geek RSS 2.0
# Monday, January 15, 2007

I am terribly behind on book reviews.  I finished Forever Peace a couple days before Christmas and am almost done with Inside Delta Force.  I also will post Forever War, the not-a-series forerunner of Peace that I read before Red MarsMars took so long to read that I got out of the habit.  For reference, Mars took 5 months, where Peace took 3 weeks and IDF will only be 5 weeks.

Monday, January 15, 2007 11:23:24 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Blog | Books | Life

Saturday, my wife and I decided to get a new TV.  We have been looking and researching for nearly a year.  We started out settling on a Vizio 37" LCD, but after the Christmas gifting season, and the generous contributions from our family, we splurged on a 42" plasma from Panasonic.  It's very pretty.  I bought the cables last month in anticipation of the purchase and saved $100s.  I can't believe that anyone would sell an $8 digital cable for $90!  DIGITAL!  "But I need gold plated connectors so the 1s will look more 1ish."

Anyway, I may have to start watching football again.  It really looks good.  Too bad Cox Cable only broadcasts one of the local networks in HD...

I did watch the 1st part of "Saving Private Ryan" on Sunday on our upconverting DVD player.  Wow.

Monday, January 15, 2007 11:04:16 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Life
# Monday, January 08, 2007

Despite it's horrid quality, YouTube has its uses.  Although the advent of YouTube, iTunes, and the derivitives proves that the "higher quality" demands of the consumer are largely false.  My proof:

Ok, this is for TC:  Feast yourself on some Geek Pr0n:  Wakko's America Song

I leave it as an exercise for the reader to find the countries song and the periodic table song.

Thanks to Geoff Appleby for pointing it out.

Monday, January 08, 2007 12:53:14 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
InterWebs
# Thursday, January 04, 2007

This was MUCH easier to accomplish than ADSI info gathering.  Code is below:

    public bool IsMemberOf(string szGroupName)
    {
        System.Security.Principal.WindowsPrincipal user =
            (System.Security.Principal.WindowsPrincipal)HttpContext.Current.User;
        bool bVal = user.IsInRole(szGroupName);
        return (bVal);
    }
Thursday, January 04, 2007 9:31:06 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
.NET

I don't usually like to post about other peoples' posts, but Coding Horror frequently causes exception.  If you're not reading it yet, but are me, then there must be something wrong with you!  Today Jeff posted another great article on two books I've never heard of:  The Secret Guide to Compters and CODE, both about the glorious life of the computer.  The first compares the computer experience to drugs and sex:

Computers are like drugs: you begin by spending just a little on them but soon get so excited by the experience - and so hooked - that you wind up spending more and more to feed your habit.

And

The computer will fascinate you. It'll seduce you to spend more time with it. You'll fall in love with it. You'll start buying it presents:  exotic foods (expensive programs to munch on), new clothes (a pretty little cloth cover to keep dust off), and expensive jewels (a printer and extra disks).

Sex or marriage, you decide.  Anyway Jeff Atwood does a much better write-up than I, so read his article.  I may have to get these books...

And his previous article on PC Clocks was geek chic for me too.

Thursday, January 04, 2007 9:07:33 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Blog | Life
# Tuesday, January 02, 2007

In the spirit of Me-Too:

Here are my results of the Super-Hero and -Villian likeness quizes.  What do you think?  And who are you?


My results:
You are Spider-Man
Spider-Man
75%
Green Lantern
60%
Robin
57%
Hulk
55%
Superman
50%
The Flash
45%
Iron Man
45%
Batman
40%
Supergirl
40%
Catwoman
20%
Wonder Woman
15%
You are intelligent, witty,
a bit geeky and have great
power and responsibility.
Click here to take the Superhero Personality Test

My results:
You are Magneto
Magneto
69%
Dr. Doom
65%
Lex Luthor
63%
Apocalypse
63%
The Joker
55%
Green Goblin
54%
Mr. Freeze
43%
Kingpin
40%
Riddler
37%
Dark Phoenix
29%
Catwoman
27%
Juggernaut
26%
Mystique
26%
Poison Ivy
23%
Two-Face
22%
Venom
20%
You fear the persecution of those that are different or underprivileged so much that you are willing to fight and hurt others for your cause.
Click here to take the Supervillain Personality Quiz
Tuesday, January 02, 2007 9:00:59 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Blog
# Monday, January 01, 2007

Wishing you good fortune for the coming year significantly labeled 2007.  Oops, that's pretty much an arbitrarily selected value too.

Monday, January 01, 2007 9:31:24 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Life
# Friday, December 22, 2006

In Intranet applications, it is often critical to know who your user is.  NTLM and .NET give you the ability to get the login name, which is a great identifier, but tells you nothing about them.  You get this by using:

HttpContext.Current.User.Identity.Name

though typically that can be shortened to simply User.Identity.Name.  However, with LDAP calls you can get more information, but you need to know the LDAP address of the domain controller for AD.  One tool I found that helps is ldp.exe which is available with the Windows Support Tools from Microsoft (free!).  Just connect to the AD controller and it gives you the LDAP address you can use in your System.DirectoryServices calls.

The guts of it are this: 
Make a connection to the domain controller using an LDAP address:

        szADPath = String .Format( "LDAP://CN=Users,DC={0},DC=com" , szDomain);

        DirectoryEntry entry = new DirectoryEntry (szADPath);

Create a DirectorySearcher with filters and find the user you want:

        string_szUID = HttpContext.Current.User.Identity.Name;

 

        DirectorySearcher search = new DirectorySearcher(entry);

        search.Filter = String.Format("(SAMAccountName={0})", _szUID.Substring(_szUID.IndexOf("\\") + 1));

        search.PropertiesToLoad.Add("displayName");    // Full Name (Frank Hagen)

        search.PropertiesToLoad.Add("employeeid");     // EmplID   (123456)

        search.PropertiesToLoad.Add("givenname");      // First Name (Frank)

        search.PropertiesToLoad.Add("sn");             // Last Name  (Hagen)

        SearchResult result = search.FindOne();        // Execute filtered search

Then iterate through all of the properties returned:

        foreach(string key in result.Properties.PropertyNames)

That's really all there is to it. 

Of course the data available is dependant on the quality of data input by the Network Support group.  If they don't put anything useful in, your still stuck with nothing.  We are fortunate here and are taking the employee id and querying against other sources for additional data.

I am building a class for internal projects to use this.  When I have cleaned it up and optimized it properly, I will post it.  It was hard to find good resources online for this, surprisingly, although there were many 3rd party paid products available.  Maybe I should package it up and sell it too....

Friday, December 22, 2006 10:29:05 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
.NET
<%--
--%>
Statistics
Total Posts: 189
This Year: 2
This Month: 0
This Week: 0
Comments: 74
Locations of visitors to this page
About the author/Disclaimer

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

© Copyright 2012
Frank W Hagen
Sign In
All Content © 2012, Frank W Hagen
Custom DasBlog theme based on 'Business' by Christoph De Baene