I almost never post here anymore. I just logged in today to host an image. Having a family leaves little time for anything besides work, the gym, brewing beer and even barely time to drink a few beers. All in all a good just but man it’s gone by fast.

She’s almost three years old and so darn sweet it’s unreal.   Kisses me, pats my cheek and hugs me.   Says “daddy come lay by me” when she’s watching cartoons in her bed and tells me “I’m happy daddy”.   She can be so sweet when she’s not destroying my house.

 

A very interesting approach to using AutoMapper.   I’m bookmarking it here so I don’t lose it.   I’ve used it and it works but not sure if I will continue using it.

20120605-214634.jpg

, ,

Playing with a phone app I want to use for sharing quick pictures on my blog. Done with Facebook for content hats mine.

20120604-074855.jpg

, ,

I suppose it’s about due since I have a strong desire to write about my favorite hobby in beer brewing.   So please check out Bayou Beer which is a great name for a website focused around Louisiana beer and brewing.

That’s not a type0 it seems like 2011 was never actually here and I can’t believe 2012 is already days in.    This had to be one of the quickest years I’ve ever experienced and I know it’s got to be mostly because of our daughter Ella.   She’s so action packed and non-stop fun we can’t imagine how people keep up with more than one.    The last big thing she learned how to do in 2011 was opening door knobs herself which essentially takes the gloves off for 2012.   I had no idea how much different things would be the day she could get out of her room in the morning without our help.

2012 goal number 1 is building our house.   We’ve had our property for 3 years now and I’ve painfully watched my wife and father in law dueling over house plan designs.  I personally settled everything I wanted in the house around a year ago but as we all know the last 10% takes longest and I’m personally never worried about the last 10% of anything.   Hopefully I can press them to finish it and let us get that project done.

Driving from Lake Charles a few back with a coworker who’s about two decades older than me we were discussing kids and cough remedies given the time of year and colds going around and he shared with me the recipe his grandmother used to make back in the day. My how things have changed because I’m pretty sure you’ll get on national news for giving this to your children as a cough remedy. His grandmother would take a bottle of Jack Daniels and dissolve those large hard peppermint sticks in to it and then flavor it to taste with honey and lemon juice. That was what they used for cough syrup and it worked great. It also apparently would knock you out for a few hours which is about what you’d expect the results to be on kids. It actually sounds like a fairly tasty concoction. Certainly more so than say Jagermeister or one of those type of liqours. (yuck.)

Here’s a fun little piece of code I scraped together today for an ongoing issue we’ve been having. Seems for years nobody can figure out how to locate whether a user(jodom for example) exists in our Active Directory and how to add them to a group via C#. A few people have tried but always given up and used a web service built by a consultant that no one knows what happened to the source code. The service is a pain because it dies silently whether the user exists or not and whether it succeeds or not.(really dude)

The code isn’t that difficult as you can see and I’m almost certain my peers came up with something similar on previous attempts. I’m almost certain their failure was the result of not being able to obtain appropriate DN because nobody even our network engineers had heard of LDP Tool for Querying Active Directory(LDAP) which will assist you in building LDAP queries in C#. There’s obviously a disconnect there in the developer community because I must of ran through a dozen HELP threads on various .NET boards concerning this topic.

So….code is below and should work fine to add/remove a user to a group that the userName/password provided has Management rights to. It first uses the DirectorySearcher to find the DN of the account and then uses that DN for the Add/Delete. There might be a simpler(mo better) way to do it but this hammer works so swing it.

string NTId = "jsmith";
bool IsAdding = true;
string userName = "UserWithManagementRightsToGroup";
string password = "Password";
var exists = this.ObjectContext.SomeEntitys.Where(p => p.EmployeeID == NTId);
DirectorySearcher userSearcher = new DirectorySearcher();
userSearcher.Filter = "(&(objectclass=user)(objectCategory=person)" + "(sAMAccountName=" + NTId + "))";
if (userSearcher != null)
{
userSearcher.PropertiesToLoad.Add("distinguishedName");
SearchResult searchResult = null;
using (SearchResultCollection src = userSearcher.FindAll())
{
if (src.Count > 0)
{
searchResult = src[0];
string DN = searchResult.Properties["distinguishedName"][0].ToString();
try
{
DirectoryEntry entry = new DirectoryEntry("LDAP://domain.com/" +
"CN=My_Users,OU=Security Groups,DC=domain,DC=com",
userName, password);
 
if (IsAdding == true && !entry.Properties["member"].Contains(DN))
entry.Properties["member"].Add(DN);
else if (IsAdding == false && entry.Properties["member"].Contains(DN))
entry.Properties["member"].Remove(DN);
else if (IsAdding == true && entry.Properties["member"].Contains(DN))
OnError(new DomainServiceErrorInfo(new CustomError("Attempted to add user that is already in group. : " + NTId)));
else if (IsAdding == false && !entry.Properties["member"].Contains(DN))
OnError(new DomainServiceErrorInfo(new CustomError("Could not remove because user was not in group. : " + NTId)));
 
entry.CommitChanges();
entry.Close();
}
catch (Exception uhoh)
{
}
}
}
}

Kind of interesting story I came across today. A lady got burned at the stake for being a Witch a few hundred years ago for prescribing the following to a neighbor who’s symptoms sounded like a bad fever/cold/flu.

A tonic of one part ginger, cloves, aniseed, liquorice and some strong ale blended together.. Served every morning before breakfast and the lady needed to walk a bit before eating.

I guess it didn’t help her case that her ghost friend told her to do it which is what got her the wrong end of the witch treatment. However I found it interesting and decided to use my good friend the Internet to breakdown what was good about this tonic:

ginger – reduces nausea, vomiting, and cold sweating. Very potent anti-inflammatory compounds effective against pain and swelling.
liquorice – soothes a sore throat, loosens bronchial congestion, reduces inflammation, soothes digestive and gastrointestinal issues, helpful with stomach ulcers.
Cloves – A stimulant that acts as a stimulant and improves circulation. Helps stabilize blood flow and regulate your body temperature. Helps with coughs, stops vomiting, headaches, asthma and a bunch of other random things.
Aniseed – Helps remove phlegm from the bronchial tube and helps with digestive disorders, upset stomach, gas.
Strong Ale – Well I found all sorts of things about B vitamins in strong ale, anti-inflammatory and other properties of hops but lets face it: beer makes you feel better.

It sounds like this lady got the torch for creating a 16th century cold medicine….bummer……but it was fun to research what these ingredients do.