December 31, 2009

New Years Eve

Have a happy new year everybody!

December 30, 2009

Remote Session and Powershell

The Powershell Blog has three great posts on this:
  1. Saving remote session to your local disk
  2. Bringing remote commands to your local session
  3. How to pass arguments for remote commands

December 29, 2009

Powershell Help Reader

I came across this on the powershell blog, take a look at the site here.

December 28, 2009

Call Stack Details in Java

As I get more into Android and back into Java, I wanted to know if there was a way to find out where a method was called from. It seems that the StackTarceElement class can be used to get details about the call stack. I found a great article on this blog showing me how to to do this.

I made one addition to the code found on this blog:


public static String getCallStack(int skip)
{
StringBuilder sb = new StringBuilder();

StackTraceElement[] stackTraceElements =
Thread.currentThread().getStackTrace();

for (int i = 3 + skip ; i<stackTraceElements.length; i++)
{
StackTraceElement ste = stackTraceElements[i];
String classname = ste.getClassName();
String methodName = ste.getMethodName();
int lineNumber = ste.getLineNumber();

sb.append(classname + "." + methodName + ":" + lineNumber + "\r\n");
}

return sb.toString();
}

December 27, 2009

Back to work

After the long holiday weekend, gotta get back to work...not sure how I am going to do that.

December 26, 2009

Weekend

Hope everyone is having a great holiday weekend!

December 25, 2009

Identify Leaks and Bugs in Android Code

I found this tool that has a free trial. Let's see if it works for me...

December 24, 2009

Happy Holidays

Happy Holidays Everyone!

December 23, 2009

Log in Android

Logcat was helpful, but not formatted that nicely. I came across this which will require a python installation but will make your logs a lot easier to follow.

If you want to read the log on your device as opposed to on the emulator approach you would just run the command:
adb -d logcat
Taking this one step further, I like to use ddms.bat which will give even nicer logs, CPU usage, etc. This is very helpful when seeing memory issues on your device.

December 22, 2009

Android Icons

Why is the hardest thing always the images and icons :) I am reading a nice tutorial on creating Android Icons here.

December 21, 2009

Android SqlLite DB

I was curious if I starting writing to the db, how I can actually retrieve and read what is in there. I came across this old article and it was enough to get me on my way.

December 20, 2009

Shovel Today and Android Dev

More details tomorrow...

December 19, 2009

Snow

I really hate snow.

December 18, 2009

Weekend

Have a good weekend everyone! TGIF!

December 17, 2009

Scott Guthrie December Presentations

Download them here

December 16, 2009

Vacation

Really, I need one!

December 15, 2009

Google Phone

So I read about it yesterday and I was not going to post on it...but this bothers me. Android phone choices are getting more complex...which actually hurts the developers in some ways.

December 14, 2009

Java and POP3 with Hotmail

A simple example as we learn more on the mail protocols:

package email;

import javax.mail.*;

public class MailUtils {

public static Store getStore(Account account) throws MessagingException {
return getStore(account.Email, account.Password);
}

public static Store getStore(String email, String password) throws MessagingException {
java.util.Properties props = new java.util.Properties();
props.setProperty("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.setProperty("mail.pop3.socketFactory.fallback", "false");
props.setProperty("mail.pop3.socketFactory.port", "995");

javax.mail.Session session = Session.getDefaultInstance(props);

Store store = session.getStore("pop3");
store.connect("pop3.live.com", email, password);

return store;
}

public static Folder[] getFolders(Store store) throws MessagingException
{
return store.getDefaultFolder().list("*");
}

public static Folder getFolderByUrl(Store store, String url) throws MessagingException
{
return store.getFolder(new URLName(url));
}

public static Message[] getMessages(Folder folder) throws MessagingException {
try {
folder.open(Folder.READ_ONLY);
Message[] messages = folder.getMessages();

for(Message m : messages) {
String s = m.getSubject();
System.out.print(s);
}

return messages;
}
finally {
//folder.close(false);
}
}

}

December 13, 2009

Good Weekend

Hope everyone had a good weekend! A lot of work on POP3 and IMAP this weekend...will share the details tomorrow.

December 12, 2009

Android 2.1 Update

So far it has fixed the camera problems. Now let's see if it fixed any other quirks that it has claimed to fix.

December 11, 2009

Weekend

Have a good weekend!

December 10, 2009

Android

Just got my 2.1 update! Finally, my camera works!

December 9, 2009

Crazy Day

Just a crazy day today. Hope to post some updates tomorrow.

December 8, 2009

Powershell Hashtable

A nice little post by Jeffrey Snover can be found here.

December 7, 2009

Windows API code pack for .NET

Updated with Windows 7.

December 6, 2009

Sharepoint Foundation 2010 Beta

Download it here.

December 5, 2009

Good Weekend

Hope everyone is having a nice weekend.

December 4, 2009

REST on Android

For my upcoming application, I wanted to work with REST on Android. It seemed to be straightforward after I came across this article. I have an interesting idea for an app and I am hoping to get it on the Android Market soon.

December 3, 2009

AzMan Reports

Had to generate a whole bunch of reports from AzMan. I'll post some code this weekend that shows what I did in detail. I know I mentioned this reporting project in the past, but it had some major upgrades today....

December 2, 2009

Android Music Player and Sync

Download doubletwist to sync from your machine and MixZing from the android market (an iphone clone). Dvd Jon brings us doubletwist, but this app is legit in that no DRM is broken.

December 1, 2009

Android Wishlist?

So what is on your android wishlist? I need some ideas on what to build!

November 30, 2009

Alphabet in C#

I saw some code that someone wrote at our company and he was reading the English alphabet from a config file. Granted, that I don't like that...I was looking for an easy way to do it and add to an array not from a config...or build it on the fly. I know I can easily add it to an array like:
char[] alpheng = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
I came across this:
char[] az = Enumerable.Range('a', 'z' - 'a' + 1).Select(i => (Char)i).ToArray();
foreach (var c in az)
{
Console.WriteLine(c);
}
Even funnier was that the suggested answer was what I said at the begining of this post and then someone came after that and gave this unique solution.

November 29, 2009

Droid Yahoo Mail and Hotmail

Getting gmail is straightforward, after all it it is google based! However, what about Yahoo, Hotmail, and other providers? Here is how you would get Yahoo. You can find Hotmail here.

I have been enjoying my new phone!

November 28, 2009

Android SDK

Hope everyone had a nice day today. I downloaded the android SDK...looks very nice. Now just need to find that one app that everyone needs. Anyone have a wish-list?

November 27, 2009

Vacation Day!

Good to have a day off...allows me to play with my new phone as well :)

November 26, 2009

Opera Unite

A friend of mine recently showed me this. It is so cool! You should check it out.

November 25, 2009

MSMQ Count with C#

We had a bug in our production environment that filled up MSMQ and would be tied to a specific windows service that we had running. In order to fix this, the solution was to stop and start the windows service. The catch was that we only wanted to do this when the MessageQueue count was above a certain number. You can get access to the class here. A snippet of the main code is below:
public void Run()
{
if (TotalMessagesInAllQueues() >= MessagesCriticalCount)
{
StopService();
SendEmail();
StartService();
}
}

private ManagementObject GetServiceByName(string name)
{
List list = SearchObjects(string.Format("Select * From Win32_Service WHERE Name='{0}'", name));

if (list.Count == 0)
throw new Exception(string.Format("Service '{0}' can not be found", name));

return list[0];
}

private ulong TotalMessagesInAllQueues()
{
var list = SearchObjects("Select * From Win32_PerfRawData_MSMQ_MSMQService");
return (ulong)list[0].GetPropertyValue("TotalMessagesInAllQueues");
}

November 24, 2009

Android Programming

I have to get into that! I love my new phone...

November 23, 2009

Testing in IE5 - IE7

I am a firefox/chrome guy..but you always need to test in IE. I had an issue with a .js file that worked in IE8 but failed in 5,6,7. I could have downloaded a virtual, but someone sent me this great tool...what a time-saver!

November 22, 2009

Administrator not needed to Run Remote PowerShell Commands

I always impersonated, but it is good to read this article.

November 21, 2009

Weekend

Hope everyone is having a good weekend!

November 20, 2009

Ruby and Rake to Deploy ASP.NET and SQL II

In a follow-up to my article from yesterday. It seems that starting last night the website that I am pointing too went down. I am posting a link to the ruby file here with all credit to derek who wrote it up. The details of what he did are on his site and I hope it comes back up soon.

November 19, 2009

Ruby and Rake to Deploy ASP.NET and SQL

I currently use NAnt and some powershell to deploy most of my web applications in our environment. I was curious if I could do this with Ruby. I came across this informative article here that discusses how to use Rake and Ruby to do deployments for ASP.NET and also how to do SQL compares. Very interesting!

November 18, 2009

Add Uses to Group in Bulk using C#

So I had a task to take a list of usernames in a text document and add them to AD and map them to group(s). I am sure I could have done this quickly in Powershell, but I wanted to do it in C#. You can get the code here. The application is console based and uses some of our past AD classes.

The format was simple:
user1
user2
user3
A snippet of the code is below:
//using log4net;
//using ActiveDs;
public void Run()
{
foreach (AdUser user in ReadUsers())
{
using (user)
{
Dictionary userGroups = GetUserGroupsDn(user.Entry);

foreach (string groupDn in _groupsToAddUserTo.Keys)
{
if (userGroups.ContainsKey(groupDn))
continue; // User already in this group

AdGroup group = _groupsToAddUserTo[groupDn];

try
{
group.NativeObject.Add(user.Entry.Path);

log.Info(string.Format("User: {0} added to Group: {1}",
user.Entry.Properties["sAMAccountName"][0], group.NativeObject.Name));
}
catch (Exception)
{
log.Error(string.Format("User: {0} can't be added to Group: {1}. Possibly this is it's primary group already.",
user.Entry.Properties["sAMAccountName"][0], group.NativeObject.Name));
}
}
}
}
}
...and main:
 private void Run(string[] args)
{

//logging removed for brevity in snippet

Settings settings = SettingsReader.ReadFromConfig();

Adder adder = new Adder(settings);
adder.UsersToProcess = ReadUsersToProcess(settings.UsersFilePath);

adder.Run();
}
Anyone want to show how this can be done in powershell in 25 or so lines?

November 17, 2009

Reflection to invoke objects

So where did the ComWrapper come from yesterday? What is the point of this article in regards to reflection? Well, in short I wanted to show some some of the classes that helped me with my new AzMan library. Here is the TypeUtilities class:

//using System.Reflection;
public class TypeUtilities
{
private static string ToString(Type[] types)
{
string str = "";

foreach (Type type in types)
{
if (str.Length != 0)
str += ", ";

str += type.Name;
}

return str;
}

public static object GetProperty(object obj, string prop)
{
PropertyInfo pi = obj.GetType().GetProperty(prop);
return pi.GetValue(obj, new object[0]);
}

public static object GetProperty(Type type, object obj, string prop)
{
PropertyInfo pi = type.GetProperty(prop);
return pi.GetValue(obj, new object[0]);
}

public static Type[] GetTypes(object[] parameters)
{
Type[] types = new Type[parameters.Length];

for (int it = 0; it < parameters.Length; it++)
{
Type type = parameters[it].GetType();

if (type == typeof(ComWrapper))
{
ComWrapper wrapper = (ComWrapper)parameters[it];
type = wrapper.Type;
parameters[it] = wrapper.Object;
}

types[it] = type;
}

return types;
}

public static object InvokeOverloaded(object obj, string method, params object[] parameters)
{
Type objType = obj.GetType();
Type[] types = GetTypes(parameters);
MethodInfo mi = obj.GetType().GetMethod(method, types);
Assert(mi, objType, method, types);
return mi.Invoke(obj, parameters);
}

public static object Invoke(object obj, string method, Type[] types, object[] args)
{
Type objType = obj.GetType();
MethodInfo mi = objType.GetMethod(method, types);
Assert(mi, objType, method, types);

try
{
return mi.Invoke(obj, args);
}
catch (Exception ex)
{
Logger.Error(ex);
throw;
}
}

public static void Assert(MethodInfo mi, Type objType, string method, Type[] types)
{
if(mi == null)
throw new Exception(string.Format("Can't find method: {0}.{1}({2})", objType, method, ToString(types)));
}
Using the above classes, I'll show how in my AzMan library I was able to do things like:
while (!(entity is AzStore)) {
entity = (IAzParent)TypeUtils.GetProperty(entity, "Parent");

November 16, 2009

C# COM Wrapper

One of the classes that I use often, will show in details this with other classes that are part of my AzMan main solution.
public class ComWrapper
{
public object Object { get; set; }
public Type Type { get; private set; }

public ComWrapper(object obj, Type type)
{
this.Object = obj;
this.Type = type;
}

public static ComWrapper Create(T obj)
{
return new ComWrapper(obj, typeof(T));
}
}

November 15, 2009

One Line Powershell to show installed software

Do this with one line in powershell!

November 14, 2009

Powershell Slides

Can be found here.

November 13, 2009

Good Weekend

Have a good weekend everyone. Next week will share some AzMan administration tools built with C# that I had to do this week.

November 12, 2009

Ever have one of those days?

Well...I am having one of those today!

November 11, 2009

Ruby Part II

Yup, Ruby really does rock. I am starting to read up on Rails and what it can do. I question why I have been working with C# for so long :) Anyone else see the light when they started working with Rails?

November 10, 2009

Ruby Rocks!

Yes, it really does. I am starting to play a bit more with rails now as well.

November 9, 2009

Windows Server 2008 R2

Good post here.

November 8, 2009

Happy Sunday!

Hope everyone is having a good Sunday.

November 7, 2009

Wave first impression...

One word...very slow!

November 6, 2009

Powershell Challenge for Money

Win $1000..details can be found here.

November 5, 2009

Got my Google Wave invitation!

Sweet...finally got my Google wave invitation!

November 4, 2009

IdentityModel and WIF

Dominick Baier and I have worked on some cool AzMan thinks in the past and I saw a recent post on his blog about WIF (Windows Identity Foundation). He has put something together with examples on codeplex. You can find details here.

November 3, 2009

Sending Automated emails with powershell

James Brundage shows how in less than 25 lines of powershell code, you can create a scheduled task to email detailed reports of the installed programs on the machine. The main point here was to show that from his powerpack that he released a few weeks ago, it is simple to email reports from powershell. You can see the full article here. The code snippet that he posted is below:


New-Task |
Add-TaskAction -Hidden -Script {
$ErrorActionPreference = "Stop"
try {
$messageParameters = @{
Subject = "Installed Program report for $env:ComputerName.$env:USERDNSDOMAIN - $((Get-Date).ToShortDateString())"
Body = Get-WmiObject Win32_Product |
Select-Object Name, Version, Vendor |
Sort-Object Name |
ConvertTo-Html |
Out-String
From = "Me@MyCompany.com"
To = "Me@MyCompany.com"
SmtpServer = "SmtpHost"
}
Send-MailMessage @messageParameters -BodyAsHtml
} catch {
$_ |
Out-File $env:TEMP\ProblemsSendingHotfixReport.log.txt -Append -Width 1000
}
} |
Add-TaskTrigger -Daily -At "9:00 AM" |
Add-TaskTrigger -OnRegistration |
Register-ScheduledTask "DailyHotfixReport"

November 2, 2009

Force IE7 Compatibility Mode in IE8

We are migrating to IE8 and we wanted a way to force this. It seems that you can add a meta tag in the header, but that would have taken days with the number of pages we would have to change. I wanted to know if there is a simple way in IIS to do this. It turns out that someone else blogged about the same thing here. It seems that meta tag can easily be added as a custom HTTP Header and we are all set.

November 1, 2009

Rainy Sunday

Why can't it just be nice?

October 31, 2009

Happy Weekend!

Happy weekend everyone!

October 30, 2009

Ajax Library (Preview 6)

Read about it here.

October 29, 2009

Windows & Upgrade

Spent the night installing Windows 7 and re-installing software on my home machine. I did a clean install so everything needed to be re-installed!

October 28, 2009

Windows Management Framework is here!

You can read all about it here.

October 27, 2009

Logparser and Charts

I'll start off with this subject with some of the basics, then I'll try and get a bit more complex and perhaps even write up a helper class.

Logparser uses OWC (only 2003 and earlier...)which is a blessing and a curse. It is a curse since not much is out there on OWC but a blessing in that OWC has a lot of charts! Having said this, logparser has OWC built in, but that should not stop any developer from sending output to a jquery or flash charting application and charting it that way. It is just easier with OWC. After you install the OWC on your server, here is a quick script to see if it works:
COMTSVInputContextClassClass inputFormat = new COMTSVInputContextClassClass();
chartOuputFormat = new COMChartOutputContextClassClass();
chartOuputFormat.chartType = "ColumnStacked";

string query = "select * from abc.log"
LogQueryClass logQuery = new LogQueryClassClass();

logQuery.ExecuteBatch(query, inputFormat, chartOuputFormat);
The above code is hacked up and I did not really test it, but should do the trick. I'll start posting more detailed helper classes this week.

October 26, 2009

Crazy Day

Nutty day at work...will try and post the charts and logparser tomorrow.

October 25, 2009

nHibernate Trouble

As you know, I am using nHibernate in my new project...had some minor issues with it and will blog about it this week.

October 24, 2009

Good Weekend

I hope everyone has had a good weekend so far!

October 23, 2009

Charting with Logparser and C#

I have been asked to show some examples on how to use logparser with charts and specifically from c#. I will try and post those up this weekend.

October 22, 2009

Windows 7 is here

Yup, I have been using the evaluation copy for a couple of months now and ready to get the retail version. Good job Microsoft, this one may rival XP in stability.

October 21, 2009

jQuery Flot (charts and graphs)

Or as they call it: Attractive Javascript plotting for jQuery.

I need to do some charting and my sql reports buddy is not here so time to turn to flash or jQuery. I came across this jQuery tool and I am gonna play with it and let you know what it's like.

October 20, 2009

Powershell v2 Launch Party

Read about it on the powershell blog. It is this Thursday, so take a look today and read about it.

October 19, 2009

Combine & Minimize JavaScript using Ruby

AC shared with me this great way of combining many .js files to one big file. I am not sure if all the code was his or if some he found, so credit to whoever helped out with this. This is really a great and easy way to do this, and you can run this on a postscript or even from NAnt if you wanted. In order to use it, you will first need to download and install some software:
  1. Java
  2. Ruby (http://rubyinstaller.rubyforge.org/wiki/wiki.pl)
  3. RubyGems (http://rubyforge.org/frs/?group_id=126 & unzip to lcoation)
  4. command line > gem install rake
  5. command line > gem install rio
For those that want to know how to install Gems:
  • command line > ruby.exe c:\rubygems-1.3.1\setup.rb
Finally, make sure you have E:\Ruby\bin; (change E: to your drive) as a path variable as it makes things easier.

For the code below, I need to download jslint.js, jsmin.js, pack.js, and packer.js and store them in the same folder as well.

You then have a batch file with has just one word: rake. You run this batch file (which is in the same directory as your rake file explained below)

Now, the code is all in one little Rakefile:
require 'rio'

$rhino_compile_enabled = false
$minify_enabled = true
$jslint_enabled = false
$output_dir = "out"

puts "Starting..."

def get_files
files = []

files << as_is("http://yui.yahooapis.com/combo?2.5.2/build/yahoo-dom-event/yahoo-dom-event.js")
files << as_is("http://yui.yahooapis.com/combo?2.5.2/build/yahoo-dom-event/yahoo-dom-event.js&2.5.2/build/container/container-min.js&2.5.2/build/cookie/cookie-beta-min.js&2.5.2/build/json/json-min.js&2.5.2/build/element/element-beta-min.js&2.5.2/build/datasource/datasource-beta-min.js&2.5.2/build/connection/connection-min.js&2.5.2/build/charts/charts-experimental-min.js")

files << minify("../WebApp/js/diag.js")
files << as_is("../WebApp/js/jquery-1.3.1.min.js")
#add more files here

end

def as_is(file_path)

task file_path do
end

file_path
end

def minify(file_path)
mkdir_if_not_exist "#{$output_dir}/min"
min_path = get_min_path(file_path)

file min_path => file_path do
do_jslint file_path
do_minify file_path, min_path
end

min_path
end

def do_minify(file_path, min_path)
if $minify_enabled
`java -cp build/js.jar org.mozilla.javascript.tools.shell.Main build/min.js #{file_path} #{min_path}`
else
rio(min_path) < rio(file_path)
end
end

def do_jslint(file_path)
return unless $jslint_enabled

puts "jslint #{file_path}"

mkdir_if_not_exist "#{$output_dir}/tmp"
mkdir_if_not_exist "#{$output_dir}/jslint_errors"
tmp = "#{$output_dir}/tmp/jslint.tmp.js"

rio(tmp) < rio('jslint-options.js')
rio(tmp) << rio(file_path)

errors = `java -cp build/js.jar org.mozilla.javascript.tools.shell.Main build/jslint.js #{tmp}`

unless /jslint: No problems found/.match(errors)
rio("#{$output_dir}/jslint_errors/#{File.basename(file_path)}.err") < errors
end
end

def get_min_path(file_path)
"#{$output_dir}/min/" + File.basename(file_path) + ".min"
end

def mkdir_if_not_exist(dir_name)
Dir.mkdir dir_name unless File.exist? dir_name
end

def do_rhino_compile(file_path)
return unless $rhino_compile_enabled

puts "Rhino compiling..."
`java -cp build/js.jar org.mozilla.javascript.tools.jsc.Main #{file_path}`
puts "Rhino compilation done."
end

def get_combined_path
"#{$output_dir}/combined.js"
end

task :combine => get_files do
mkdir_if_not_exist "#{$output_dir}"
combined = get_combined_path

rio(combined) < "
/*
* Combined JavaScript.
* #{Time.now}
*/
"

get_files.each do |file_path|

puts "Combining: #{file_path}"
rio(combined) << "

/************************************************************************
* Source: #{file_path}
************************************************************************/

"
rio(combined) << rio(file_path)

puts 'next...'
end
end

task :rhino_compile do
do_rhino_compile get_combined_path
end

task :copy_combined do
rio("../WebApp/Combined/combined.js") < rio(get_combined_path)
end

task :default => [:combine, :copy_combined]
Thanks AC for this.

October 18, 2009

Cmdlet Designer Tool

This is nice.

October 17, 2009

Good Weekend

Hope everyone had a nice weekend so far!

October 16, 2009

Windows 7 Powershell Pack

Some really cool scripts. Read about it here.

October 15, 2009

AzMan Bulk Import/Export Tool V2

So I started writing a v2 a while back that was a complete UI using .NET 3.5 and XAML. It was done so that I can finally upgrade the code and play a bit with XAML. I never finished that code and plan to go back to it, but will have to label it v3.0. The v2.0 that I am adding here is a console based application based off my original work and some work done by David E. This code will do a bulk import/export for:
  • Xml store
  • AD store
  • SQL Store
The code was modified a bit and can be used like this:
AzManBulkImport.exe {source policy store}{source policy store}{copy users}
There are a few minor things to keep in mind with this new version:
  • Migrating App Groups with incorrect LDAP Strings crashes the migration.
  • There is no check to make sure the database in the connection string exists.
  • XML AzMan store defaults to no-users in policy store administrators group, meaning everyone has access. SQL AzMan says that no-one in the policy store administrators group means no one has access. Migrating an XML store without any administrators to a SQL store results in an access problem, as no-one will have access to the policy store after the policy store administrators are deleted from SQL server. There is an error message to reflect this situation.
  • David has changed the Operations migration to compare old and new operations using the Operation ID, instead of the old comparison on Operation Name.
An example of the usage can be:
AzManBulkImport.exe "mssql://Driver=SQL Server;Server=dbserver01;Trusted_Connec
tion=True;/MyAzmanDatabase/MyPolicyStore" "d:\Azman.xml" "true"
This basically says to copy from the specified SQL Server store to the specified XML Store, including all user role assignments. You can change from XML to AD Ldap connection string or Ldap connection string to SQL server.

To recap, v2.0 of this code is console based and has a few updates with the major being SQL Server capability. Some of the code is a bit rough, but it works :) I do hope to release v3.0 if I ever get time to work on it again.

You can download the code here.

October 14, 2009

AzMan Updates

I have some new tools that I will be posting later this week. It has been a crazy week for me, so just hang in there.

October 13, 2009

JSON and Powershell

I needed to convert from and to JSON within powershell. I guess it would be quite easy to write something but I came across this parser that basically did it for me. More JSON posts to come based off this new project I am working on.

October 12, 2009

MSDeploy and Powershell

A good article can be found here.

October 11, 2009

Good Weekend

Hope everyone had a good weekend!

October 10, 2009

Happy Saturday!

Happy Saturday everyone!

October 9, 2009

Crazy Production Issues Today!

We are seeing really odd things in our production environment! Logs say nothing, servers look fine, db looks fine, developers are saying it's not code :)

Ughh!

October 8, 2009

WebsiteSpark Program

I first read about it here. This is going to be helpful for me as I continue to work on my current project. It will be very nice to get a few free licenses as that will help keep costs down. An excerpt:

WebsiteSpark is designed for independent web developers and web development companies that build web applications and web sites on behalf of others. It enables you to get software, support and business resources from Microsoft at no cost for three years, and enables you to expand your business and build great web solutions using ASP.NET, Silverlight, SharePoint and PHP, and the open source applications built on top of them.

October 7, 2009

Free CDN from Microsoft

Microsoft is giving us a content delivery network for ajax and jquery! This is really cool and very helpful. You can read all about it here.

October 6, 2009

WebDeploy Auto-Complete UI

This is cool...check it out!

October 5, 2009

Working with Active Directory and C# -- sample code

After 8 posts on this, I think it makes sense to just give the link to the files here:

The ADLib code can be found here. This contains:

1. AdGroup: interface (IADsGroup) for group
2. AdUser: interface (IADsUser) for user
3. GroupType: enum of group types in AD
4. AdDomain: Policy, Password, Group and User Interaction within AD
5. Go here for the dotnetdevguide...and buy the book as well!

Active Directory and C# VII

Time to continue this series of posts on the domain side. You can download all the files from here. I will upload this file from this post this week. You can see the first post related to this class file here. This post refers to policy and password in AD.
 public DateTime GetPasswordLastChanged(DirectoryEntry entry)
{
return ((IADsUser)entry.NativeObject).PasswordLastChanged;
}

public DateTime GetPasswordExpirationDate(DirectoryEntry entry)
{
return ((IADsUser)entry.NativeObject).PasswordExpirationDate;
}

public bool ChangePasswordAtNextLogon(DirectoryEntry entry)
{
// MSDN: pswLastSet
// If this value is set to 0 and the User-Account-Control attribute
// does not contain the UF_DONT_EXPIRE_PASSWD flag, then the user must
// set the password at the next logon.

if (PasswordNeverExpires(entry))
return false;

Int64 val = 0;

try
{
val = UnboxAdsiInt64(entry.Properties["pwdLastSet"].Value);
}
catch (Exception)
{
val = 0;
}

return (val == 0);
}

public bool PasswordNeverExpires(DirectoryEntry entry)
{
return GetUserAccountControlFlag(entry, ADS_USER_FLAG.ADS_UF_DONT_EXPIRE_PASSWD);
}

public bool GetUserAccountControlFlag(DirectoryEntry entry, ADS_USER_FLAG flag)
{
int userAccountControl = (int)entry.Properties["userAccountControl"].Value;
return (userAccountControl & (int)flag) != 0;
}

///
/// Gets the Password Expiration
/// Date for a domain user
/// Returns MaxValue if never expiring
/// Returns MinValue if user must
/// change password at next logon
///

///
///
public DateTime GetPasswordExpiration(DirectoryEntry user)
{
return new PasswordExpires(GetPolicy()).GetExpiration(user);
}

private DomainPolicy GetPolicy()
{
lock(this)
{
if(_policy == null)
_policy = new DomainPolicy(OpenRootDSE());

return _policy;
}
}

October 4, 2009

Great Weekend!

I hope everyone is enjoying the weekend!

October 3, 2009

Connect with the Powershell Team

Give them feedback and tell them any issues that you see. You can get to the community from here.

October 2, 2009

Active Directory and C# VI

Time to continue this series of posts on the domain side. You can download all the files from here. I will upload this file from this post this week. You can see the first post related to this class file here. This post once again refers to the sAMAccount, Groups and SID administration in AD.

public DirectoryEntry OpenEntryBySAMAccountName(string sAMAccountName)
{
//from config
string rootPath = SearchPath;
String filter = string.Format("(&(|(objectClass=user)(objectClass=group))(sAMAccountName={0}))", sAMAccountName);
string[] propsToLoad = new string[0];

using (DirectoryEntry entry = OpenExistingEntry(rootPath))
{
if (entry == null)
throw new Exception(string.Format("Failed to open root for search by SAMAccountName. {0}", rootPath));

using (DirectorySearcher searcher = new DirectorySearcher(entry, filter, propsToLoad))
{
SearchResult sr = searcher.FindOne();

if (sr == null)
return null;

return sr.GetDirectoryEntry();
}
}
}

public List GetAllGroupsSAMAccountNames()
{
List adGroups = GetAllGroups(new string[] { "sAMAccountName" });

try
{
List groups = new List();

foreach (AdGroup adGroup in adGroups)
groups.Add((string)adGroup.Entry.Properties["sAMAccountName"].Value);

return groups;
}
finally
{
Dispose(adGroups);
}
}

public List GetAllGroups(string[] propsToLoad)
{
//from config
string rootPath = GroupsSearchPath;
String filter = "(objectClass=group)";
List groups = new List();

using (DirectoryEntry entry = OpenExistingEntry(rootPath))
{
if (entry == null)
throw new Exception(string.Format("Root to search groups by SAMAccountName failed to open. {0}", rootPath));

using (DirectorySearcher searcher = new DirectorySearcher(entry, filter, propsToLoad))
{
using (SearchResultCollection src = searcher.FindAll())
{
foreach (SearchResult sr in src)
{
groups.Add(new AdGroup(sr.GetDirectoryEntry()));
}
}
}
}

return groups;
}

private DirectoryEntry OpenRootDSE()
{
return OpenEntry("rootDSE");
}

public static Int64 UnboxAdsiInt64(object ADsLargeInteger)
{
IADsLargeInteger val = (IADsLargeInteger)ADsLargeInteger;
Int64 res = ((Int64)val.HighPart <<>
Turns out I need one more post for this to discuss password expiration and policy. Then this huge class file will be uploaded for you to use!

October 1, 2009

Active Directory and C# V

Time to continue this series of posts on the domain side. You can download all the files from here. I will upload this file from this post this week. You can see the first post related to this class file here. This post refers to the sAMAccount, Groups and SID administration in AD.
 
public AdUser OpenUserBySAMAccountName(string userSAMAccountName, params string[] propsToLoad)
{
//usersearchpath from config
string rootPath = UsersSearchPath;
String filter = string.Format("(&(objectClass=user)(sAMAccountName={0}))", userSAMAccountName);

using (DirectoryEntry entry = OpenExistingEntry(rootPath))
{
if (entry == null)
throw new Exception(string.Format("Root to search user by SAMAccountName failed to open. {0}", rootPath));

using (DirectorySearcher searcher = new DirectorySearcher(entry, filter, propsToLoad))
{
SearchResult sr = searcher.FindOne();

if (sr == null)
return null;

return new AdUser(sr.GetDirectoryEntry());
}
}
}

public string GetSidPath(DirectoryEntry entry)
{
byte[] sidBytes = (byte[])entry.Properties["objectSid"][0];
SecurityIdentifier sid = new SecurityIdentifier(sidBytes, 0);
return string.Format("LDAP://", sid.ToString());
}

public List GetUserGroups(DirectoryEntry user)
{
List groups = new List();

//we are building an '|' clause
List sids = new List();
user.RefreshCache(new string[] { "tokenGroups" });
foreach (byte[] sid in user.Properties["tokenGroups"])
{
//append each member into the filter
sids.Add(string.Format("(objectSid={0})", BuildFilterOctetString(sid)));
}

if (sids.Count == 0)
return groups;

//end our initial filter
string filter = "(|" + string.Join("", sids.ToArray()) + ")";
//GroupsSearchPath from config
DirectoryEntry searchRoot = OpenEntry(GroupsSearchPath);
using (searchRoot)
{

//we now have our filter, we can just search for the groups
DirectorySearcher ds = new DirectorySearcher(
searchRoot,
filter
);

using (SearchResultCollection src = ds.FindAll())
{
foreach (SearchResult sr in src)
{
groups.Add((string)sr.Properties["samAccountName"][0]);
}
}
}

return groups;
}

private string BuildFilterOctetString(byte[] bytes)
{
StringBuilder sb = new StringBuilder();

for (int i = 0; i < bytes.Length; i++)
{
sb.AppendFormat("\\{0}", bytes[i].ToString("X2"));
}

return sb.ToString();
}


I'll upload this file tomorrow. This will make it a lot easier to follow.

September 30, 2009

MSDeploy is RTW

Here is the link to the post, and here is the link to the tool. This is a great tool, you should take a look.

September 29, 2009

Active Directory and C# IV

To continue this series of posts, I'd now like to talk about groups and my group helper class. It is actually quite simple and kind of looks just like the User helper. You can download all the files from here. I will upload this file from this post this week. You can see the first post related to this class file here. This post refers to the groups administration in AD.
  public AdGroup OpenGroup(string groupName)
{
if (groupName.IndexOf('=') != -1)
return OpenGroupByDN(groupName);
else
{
//GroupsSearchPath from config
if (string.IsNullOrEmpty(GroupsSearchPath))
throw new Exception("To search groups by SAMAccountName the PathToSearchForGroupsBySAMAcountName setting should be specified.");

return OpenGroupBySAMAccountName(groupName);
}
}

public AdGroup OpenGroupByDN(string groupDN)
{
DirectoryEntry entry = OpenExistingEntry(groupDN);

if (entry == null)
return null;

return new AdGroup(entry);
}

public AdGroup OpenGroupBySAMAccountName(string groupSAMAccountName)
{
//GroupsSearchPath from config
string rootPath = GroupsSearchPath;

String filter = string.Format("(&(objectClass=group)(sAMAccountName={0}))", groupSAMAccountName);
string[] propsToLoad = new string[0];

using (DirectoryEntry entry = OpenExistingEntry(rootPath))
{
if (entry == null)
throw new Exception(string.Format("Root to search groups by SAMAccountName failed to open. {0}", rootPath));

using (DirectorySearcher searcher = new DirectorySearcher(entry, filter, propsToLoad))
{
SearchResult sr = searcher.FindOne();

if (sr == null)
return null;

return new AdGroup(sr.GetDirectoryEntry());
}
}
}
I'll post one more time on this and also upload the file for you to download.

September 28, 2009

Busy Day

Sorry, will have to continue our AD posts tomorrow...a crazy day as one of our production servers failed and our disaster recovery plan did not kick in correctly!

September 27, 2009

Playing with NHibernate

In my new project, I am playing with NHibernate. So far, very interesting. I had known of NHibernate back from my Java days with Hibernate, but never really played with it a lot. I'll share with you guys things that I come across with it as I continue to work with it.

September 26, 2009

Good Weekend

Hope everyone is having a great weekend!

September 25, 2009

Active Directory and C# III

To continue this series of posts, I'd now like to talk about groups and my group helper class. It is actually quite simple and kind of looks just like the User helper. You can download all the files from here. I will upload this file from this post next week.

Before we get started, I wanted to tell you all that if you do any AD programming you should look at a book written by Joe Kaplan and Ryan Dunn . It is really the best book out there. The authors also have a site here for you to look at and a forum which is helpful. My next bit of code actually relies on code from their book. They have the code available on thei site and it can be found here. You can use the entire build or just some of the files. The main one for me was PasswordExpires (Listing 10.8, 10.9, & 10.10 in full). I use a few others in the root of their project as well ... it might be just easier to include their project. Go out and buy the book though...it is great!
using System;
using System.Collections.Generic;
using System.Text;
using System.DirectoryServices;
using System.Security.Principal;
using DotNetDevGuide.DirectoryServices;
using ActiveDs;
using DotNetDevGuide.DirectoryServices.Chapter10;

namespace AdLib
{
public class AdDomain
{
private const int ADS_UF_ACCOUNTDISABLE = 2;
private DomainPolicy _policy;

//UsersSearchPath can be from a config location
public void CreateUser(string userName, Dictionary props)
{
CreateUser(userName, UsersSearchPath, props);
}

public void CreateUser(string userName, string path, Dictionary props)
{
path = GetFullPath(path);

using (DirectoryEntry parent = OpenEntry(path))
{
DirectoryEntry user = parent.Children.Add(
String.Format("CN={0}", userName),
"user"
);

using (user)
{
// Set default props
user.Properties["sAMAccountName"].Add(userName);
user.CommitChanges();


// Set user defined props
foreach (string propName in props.Keys)
{
if (propName.ToLower() == "password")
continue;

user.Properties[propName].Add(props[propName]);
user.CommitChanges();
}

if (props.ContainsKey("password"))
((IADsUser)user.NativeObject).SetPassword((string)props["password"]);

user.CommitChanges();

EnableAccount(user);
}
}
}

private void EnableAccount(DirectoryEntry entry)
{
int userAccountControl = (int)entry.Properties["userAccountControl"][0];
userAccountControl &= ~ADS_UF_ACCOUNTDISABLE;
entry.Properties["userAccountControl"][0] = userAccountControl;
entry.CommitChanges();
}

//GroupsSearchPath can be from a config location
public void CreateGroup(string groupName, int type)
{
CreateGroup(groupName, type, GroupsSearchPath);
}

public void CreateGroup(string groupName, int type, string groupOU)
{
groupOU = GetFullPath(groupOU);

using (DirectoryEntry parent = OpenEntry(groupOU))
{
DirectoryEntry group = parent.Children.Add(
String.Format("CN={0}", groupName),
"group"
);

using (group)
{
group.Properties["sAMAccountName"].Add(groupName);

if(type != (int)GroupType.Unknown)
group.Properties["groupType"].Add(type);

group.CommitChanges();
}
}
}

private string GetFullPath(string subPath)
{
//server from config
if (string.IsNullOrEmpty(Server))
return string.Format("LDAP://{0}", subPath);
else
//server from config
return string.Format("LDAP://{0}/{1}", Server, subPath);
}

public DirectoryEntry OpenEntry(string path)
{
if (path.StartsWith("LDAP://", StringComparison.InvariantCultureIgnoreCase) == false)
{
path = GetFullPath(path);
}

return new DirectoryEntry(
path,
Username, //from config
Password, //from config
AuthenticationTypes.Secure
);
}
I'll finish this class up next week.

September 24, 2009

Active Directory and C# II

To continue this series of posts, I'd now like to talk about groups and my group helper class. It is actually quite simple and kind of looks just like the User helper. You can download all the files from here.
using System;
using System.Collections.Generic;
using System.Text;
using System.DirectoryServices;
using ActiveDs;

namespace AdLib
{
public class AdGroup : IDisposable
{
private DirectoryEntry _entry;
private IADsGroup _group;

public AdGroup(DirectoryEntry entry)
{
if (entry == null)
throw new ArgumentNullException("entry");

_entry = entry;
_group = (IADsGroup)entry.NativeObject;
}

public DirectoryEntry Entry
{
get { return _entry; }
}

public IADsGroup NativeObject
{
get { return _group; }
}

#region IDisposable Members

public void Dispose()
{
_entry.Dispose();
}

void IDisposable.Dispose()
{
Dispose();
}

#endregion
}
}
Of course, we would also need to understand what a GroupType in AD really is:
using System;
using System.Collections.Generic;
using System.Text;

namespace AdLib
{
[Flags]
public enum GroupType : int
{
Unknown = 0,
LocalDistribution = 4,
LocalSecurity = (4 | -2147483648),
GlobalDistribution = 2,
GlobalSecurity = (2 | -2147483648),
UniversalDistribution = 8,
UniversalSecurity = (8 | -2147483648)
}
}
In the next post, we will talk about domains and eventually how this all fits together.

September 23, 2009

Active Directory and C#

I have done a lot of work in the last few years with AD and C#. I figured now that I shared a whole bunch of AzMan stuff, it is only logical that I share some AD helper classes as well. Some of the code can of course be written differently now in the world of .NET 3.5. However, what is written is still relevant and works well. Like the AzMan posts, this will be a bunch of posts tied together to make an application. Unlike AzMan, this will be slower since there is a A LOT more in AD than in AzMan.

One thing that I'll point out is that I rely on ActiveDS more than DirectoryEntry....so for those against this, I am sorry :)

I'd like to start off with the AdUser class that I use from my AdLibrary which you can download from here:
using System;
using System.Collections.Generic;
using System.Text;
using ActiveDs;
using System.DirectoryServices;

namespace AdLib
{
public class AdUser : IDisposable
{
private DirectoryEntry _entry;
private IADsUser _user;

public AdUser(DirectoryEntry entry)
{
if (entry == null)
throw new ArgumentNullException("entry");

_entry = entry;
_user = (IADsUser)entry.NativeObject;
}

public DirectoryEntry Entry
{
get { return _entry; }
}

public IADsUser NativeObject
{
get { return _user; }
}

#region IDisposable Members

public void Dispose()
{
_entry.Dispose();
}

void IDisposable.Dispose()
{
Dispose();
}

#endregion
}
}
To be honest, not much can be done with this. However, combined with all the other classes in the upcoming posts you will see how it all ties together.

September 22, 2009

Powershell Recycle App Pool

I had a need for this today on a IIS 6 box and came across this post on Stack Overflow. SO always has the answer for these things. This script combined with the last post on remoting I should be able to do this from a remote machine! I'll let you know if it works.

September 21, 2009

Powershell Remoting without Admin Permissions

This article shows how it can be done by adding Powershell Session Users to the local group and setting some other permissions. This is great since before this I always was doing some form of impersonation to get this to work!

September 20, 2009

Happy Sunday!

I hope everyone has a great day today!

September 19, 2009

Debug with Powershell ISE

This is a great post on debugging in powershell. You will also find links to basic debugging in the ISE.

September 18, 2009

Using the AzMan Helper Classes VI

We have seen how to add a store,create an application, add an operation, add tasks, create roles, add application groups, and add users via SID or UPN to groups in AzMan using C#. All of these are available here.

Here is the sixth and final post regarding the usage of these helper classes:
public string[] GetApplicationGroupMemberNames(string storeUrl, string applicationName, string applicationGroupName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup applicationGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
return ApplicationGroupHelper.GetApplicationGroupMemberNames(applicationGroup);
}


public bool IsApplicationGroupMemberNameExists(string storeUrl, string applicationName, string applicationGroupName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup applicationGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
return ApplicationGroupHelper.IsApplicationGroupMemberNameExists(applicationGroup, memberName);
}

//Get the SIDs
public string[] GetApplicationGroupMembers(string storeUrl, string applicationName, string applicationGroupName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup applicationGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
return ApplicationGroupHelper.GetApplicationGroupMembers(applicationGroup);
}

public bool IsApplicationGroupMemberExists(string storeUrl, string applicationName, string applicationGroupName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup applicationGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
return ApplicationGroupHelper.IsApplicationGroupMemberExists(applicationGroup, memberSID);
}


This concludes what is basically almost everything in AzMan via C#. In the upcoming weeks, I will move to show some more Active Directory code using C#.

September 17, 2009

Using the AzMan Helper Classes V

We have seen how to add a store,create an application, add an operation, add tasks, create roles, add application groups, and add users via SID or UPN to groups in AzMan using C#. All of these are available here.

Here is the fifth post regarding the usage of these helper classes:
 public void AddMemberToApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.AddMember(memberSID, null);
appGroup.Submit(0, null);
}

public void RemoveMemberFromApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.DeleteMember(memberSID, null);
appGroup.Submit(0, null);
}

public void AddMemberNameToApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.AddMemberName(memberName, null);
appGroup.Submit(0, null);
}

public void RemoveMemberNameFromApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.DeleteMemberName(memberName, null);
appGroup.Submit(0, null);
}

//Add Member to denied list
public void AddDeniedMemberToApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.AddNonMember(memberSID, null);
appGroup.Submit(0, null);
}

public void RemoveDeniedMemberFromApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.DeleteNonMember(memberSID, null);
appGroup.Submit(0, null);
}

public void AddDeniedMemberNameToApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.AddNonMember(memberName, null);
appGroup.Submit(0, null);
}

public void RemoveDeniedMemberNameFromApplicationGroup(string storeUrl, string applicationName, string applicationGroupName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzApplicationGroup appGroup = ApplicationGroupHelper.GetApplicationGroup(app, applicationGroupName);
appGroup.DeleteNonMemberName(memberName, null);
appGroup.Submit(0, null);
}

September 16, 2009

Using the AzMan Helper Classes IV

To everyone who has sent me "thanks" emails regarding these AzMan tutorials, you are very welcome. It has always been perplexing to me why there are not many examples of AzMan out there. Anyway, back to the next post on this...

We have seen how to add a store,create an application, add an operation, add tasks, create roles, add application groups, and add users via SID or UPN to groups in AzMan using C#. All of these are available here.

Here is the fourth post regarding the usage of these helper classes:
 public string[] GetRoleDefinitions(string storeUrl, string applicationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return RoleDefinitionHelper.GetRoleDefinitionNames(app);
}

public void AddRoleDefinition(string storeUrl, string applicationName, string roleDefinitionName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
RoleDefinitionHelper.AddRoleDefinition(app, roleDefinitionName);
}

public void RemoveRoleDefinition(string storeUrl, string applicationName, string roleDefinitionName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
RoleDefinitionHelper.RemoveRoleDefinition(app, roleDefinitionName);
}

public bool IsRoleDefinitionExists(string storeUrl, string applicationName, string roleDefinitionName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return RoleDefinitionHelper.IsRoleDefinitionExists(app, roleDefinitionName);
}

public string[] GetApplicationGroups(string storeUrl, string applicationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return ApplicationGroupHelper.GetApplicationGroupNames(app);
}

public void AddApplicationGroup(string storeUrl, string applicationName, string applicationGroupName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
ApplicationGroupHelper.AddApplicationGroup(app, applicationGroupName);
}

public void RemoveApplicationGroup(string storeUrl, string applicationName, string applicationGroupName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
ApplicationGroupHelper.RemoveApplicationGroup(app, applicationGroupName);
}

public bool IsApplicationGroupExists(string storeUrl, string applicationName, string applicationGroupName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return ApplicationGroupHelper.IsApplicationGroupExists(app, applicationGroupName);
}
I'll have 1-2 more posts on this and then move onto something else.

September 15, 2009

Using the AzMan Helper Classes III

We have seen how to add a store,create an application, add an operation, add tasks, create roles, add application groups, and add users via SID or UPN to groups in AzMan using C#. All of these are available here.

Here is the third post regarding the usage of these helper classes:
public void AddMemberToRole(string storeUrl, string applicationName, string roleName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
RoleMemberHelper.AddRoleMember(role, memberSID);
}
public void RemoveMemberFromRole(string storeUrl, string applicationName, string roleName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
RoleMemberHelper.RemoveRoleMember(role, memberSID);
}

//add by UPN
public void AddMemberNameToRole(string storeUrl, string applicationName, string roleName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
RoleMemberHelper.AddRoleMemberName(role, memberName);
}

public void RemoveMemberNameFromRole(string storeUrl, string applicationName, string roleName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
RoleMemberHelper.RemoveRoleMemberName(role, memberName);
}

//Get a list of role member names for a specified role
public string[] GetRoleMemberNames(string storeUrl, string applicationName, string roleName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
return RoleMemberHelper.GetRoleMemberNames(role);
}

public bool IsRoleMemberNameExists(string storeUrl, string applicationName, string roleName, string memberName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
return RoleMemberHelper.IsRoleMemberNameExists(role, memberName);
}

//Get a list of role member SIDs for a specified role
public string[] GetRoleMembers(string storeUrl, string applicationName, string roleName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
return RoleMemberHelper.GetRoleMembers(role);
}

public bool IsRoleMemberExists(string storeUrl, string applicationName, string roleName, string memberSID)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
IAzRole role = RoleHelper.GetRole(app, roleName);
return RoleMemberHelper.IsRoleMemberExists(role, memberSID);
}

September 14, 2009

Using the AzMan Helper Classes II

We have seen how to add a store,create an application, add an operation, add tasks, create roles, add application groups, and add users via SID or UPN to groups in AzMan using C#. All of these are available here.

Here is the second post regarding the usage of these helper classes:
//Get list of operation names of the application
public string[] GetOperations(string storeUrl, string applicationName)
{
ArrayList operationNames = new ArrayList();

IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
foreach (IAzOperation operation in app.Operations)
{
operationNames.Add(operation.Name);
}

return (string[])operationNames.ToArray(typeof(string));
}

public void AddOperation(string storeUrl, string applicationName, string operationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
OperationHelper.AddOperation(app, operationName);
}

public void RemoveOperation(string storeUrl, string applicationName, string operationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
OperationHelper.RemoveOperation(app, operationName);
}

public bool IsOperationExists(string storeUrl, string applicationName, string operationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return OperationHelper.IsOperationExists(app, operationName);
}

public string[] GetRoles(string storeUrl, string applicationName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return RoleHelper.GetRoleNames(app);
}

public void AddRole(string storeUrl, string applicationName, string roleName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
RoleHelper.AddRole(app, roleName);
}

public void RemoveRole(string storeUrl, string applicationName, string roleName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
RoleHelper.RemoveRole(app, roleName);
}

public bool IsRoleExists(string storeUrl, string applicationName, string roleName)
{
IAzApplication app = ApplicationHelper.GetApplication(storeUrl, applicationName);
return RoleHelper.IsRoleExists(app, roleName);
}

September 13, 2009

CodePlex Foundation?

Thanks Microsoft for this! But, did you really have to use codeplex and confuse us with the current Codeplex.com site?

September 12, 2009

What's new in Powershell V2.0

Nice slideshow on this!

September 11, 2009

Using the AzMan Helper Classes

We have seen how to add a store,create an application, add an operation, add tasks, create roles, add application groups, and add users via SID or UPN to groups in AzMan using C#. All of these are available here. The question is, how do I use those classes. I will show below some practical uses:
public void AddStore(string storeUrl)
{
StoreHelper.CreateStore(storeUrl);
}

public void RemoveStore(string storeUrl)
{
StoreHelper.RemoveStore(storeUrl);
}

public bool IsStoreExists(string storeUrl)
{
return StoreHelper.IsStoreExists(storeUrl);
}

//Get list of application names
public string[] GetApplications(string storeUrl)
{
IAzAuthorizationStore store = StoreHelper.GetStore(storeUrl);
return ApplicationHelper.GetApplicationNames(store);
}

public void AddApplication(string storeUrl, string applicationName)
{
IAzAuthorizationStore store = StoreHelper.GetStore(storeUrl);
ApplicationHelper.AddApplication(store, applicationName);
}

public void RemoveApplication(string storeUrl, string applicationName)
{
IAzAuthorizationStore store = StoreHelper.GetStore(storeUrl);
ApplicationHelper.RemoveApplication(store, applicationName);
}

public bool IsApplicationExists(string storeUrl, string applicationName)
{
IAzAuthorizationStore store = StoreHelper.GetStore(storeUrl);
return ApplicationHelper.IsApplicationExists(store, applicationName);
}

Here are some very, very, very basic uses of the helper classes. I'll add a few more simple uses over the next day or so.

September 10, 2009

AzMan Add/Remove Members to Role by SID or UPN with C#

We have already seen how to add a store,create an application, add an operation, add tasks, create roles, and add application groups in AzMan using C#. Now, let's go on to adding users by name or SID to those roles using c#. I have uploaded a helper class here which has some comments not included in the short snippets below as well as some other methods (check if exists etc.). This class was designed to work with XML and AD (sorry not sql server yet).

One of the cool things is that you can add a member to a role by a SID. This though has to be done via code. Below you can find how to ao a bunch of this via SIDs...the helper class shows how you can do the same thing with UPN as well:
 public static void AddRoleMember(IAzRole role, string memberSID)
{
if (memberSID == null || memberSID.Length == 0)
{
throw new ArgumentNullException("memberSID", "Member SID can not be null or empty.");
}
if (role == null)
{
throw new ArgumentNullException("role", "Role can not be null.");
}

role.AddMember(memberSID, null);
role.Submit(0, null);
}
Now let's remove that member by SID from the role
 public static void RemoveRoleMember(IAzRole role, string memberSID)
{
if (memberSID == null || memberSID.Length == 0)
{
throw new ArgumentNullException("memberSID", "Member SID can not be null or empty.");
}
if (role == null)
{
throw new ArgumentNullException("role", "Role can not be null.");
}

role.DeleteMember(memberSID, null);
role.Submit(0, null);
}
How about returning true if role member SID exists?
 public static bool IsRoleMemberExists(IAzRole role, string memberSID)
{
if (memberSID == null || memberSID.Length == 0)
{
throw new ArgumentNullException("memberSID", "Member SID can not be null or empty.");
}

if (role == null)
{
throw new ArgumentNullException("role", "Role can not be null.");
}

foreach (string sid in GetRoleMemberNames(role))
{
if (String.Compare(memberSID, sid) == 0)
{
return true;
}
}

return false;
}

September 9, 2009

AzMan Create/Remove/Get SIDs or UPN ApplicationGroup with C#

We have already seen how to add a store,create an application, add an operation, add tasks, and create roles in AzMan using C#. Now, let's go on to creating an application group within AzMan as well as get the group member names and the group members by their SIDs or UPN using c#. I have uploaded a helper class here which has some comments not included in the short snippets below as well as some other methods (check if exists etc.). This class was designed to work with XML and AD (sorry not sql server yet).
 public static IAzApplicationGroup AddApplicationGroup(IAzApplication app, string applicationGroupName)
{
if (applicationGroupName == null || applicationGroupName.Length == 0)
{
throw new ArgumentNullException("applicationGroupName", "ApplicationGroup name can not be null or empty.");
}
if (app == null)
{
throw new ArgumentNullException("app", "Application can not be null.");
}

IAzApplicationGroup applicationGroup = app.CreateApplicationGroup(applicationGroupName, null);

applicationGroup.Submit(0, null);

return applicationGroup;
}
Now let's remove that group:
 public static void RemoveApplicationGroup(IAzApplication app, string applicationGroupName)
{
if (applicationGroupName == null || applicationGroupName.Length == 0)
{
throw new ArgumentNullException("applicationGroupName", "ApplicationGroup name can not be null or empty.");
}
if (app == null)
{
throw new ArgumentNullException("app", "Application can not be null.");
}

app.DeleteApplicationGroup(applicationGroupName , null);

app.Submit(0, null);
}
We need to get by the SID as well:
public static string[] GetApplicationGroupMembers(IAzApplicationGroup applicationGroup)
{
if (applicationGroup == null)
{
throw new ArgumentNullException("applicationGroup", "Application group can not be null.");
}

Array sourceApplicationGroupMembers = (Array)applicationGroup.Members;
string[] applicationGroupMembers = new string[sourceApplicationGroupMembers.Length];
sourceApplicationGroupMembers.CopyTo(applicationGroupMembers, 0);
return applicationGroupMembers;
}
Check the actual helper class on how to get the user based off UPN as well as a few other methods.

September 8, 2009

AzMan Create/Remove/Get Role with C#

We have already seen how to add a store,create an application, add an operation, and create tasks in AzMan using C#. Now, let's go on to creating a role using c#. I have uploaded a helper class here which has some comments not included in the short snippets below as well as some other methods (check if exists etc.). This class was designed to work with XML and AD (sorry not sql server yet).
public static IAzRole AddRole(IAzApplication app, string roleName)
{
if (roleName == null || roleName.Length == 0)
{
throw new ArgumentNullException("roleName", "Role name can not be null or empty.");
}
if (app == null)
{
throw new ArgumentNullException("app", "Application can not be null.");
}

IAzRole role = app.CreateRole(roleName, null);

role.Submit(0, null);

return role;
}
Now let's remove that role:
public static void RemoveRole(IAzApplication app, string roleName)
{
if (roleName == null || roleName.Length == 0)
{
throw new ArgumentNullException("roleName", "Role name can not be null or empty.");
}
if (app == null)
{
throw new ArgumentNullException("app", "Application can not be null.");
}

app.DeleteRole(roleName , null);

app.Submit(0, null);
}
Get role by name:
 public static IAzRole GetRole(IAzApplication app, string roleName)
{
if (roleName == null || roleName.Length == 0)
{
throw new ArgumentNullException("roleName", "Role name can not be null or empty.");
}
if (app == null)
{
throw new ArgumentNullException("app", "Application can not be null.");
}

return app.OpenRole(roleName, null);
}

September 7, 2009

Vacation Day

Taking the day off to spend with family. Some interest was sparked with my AzMan posts in the last week, so I will continue with that tomorrow.

September 6, 2009

Up Bright and Early

Time for a nice long run!

September 5, 2009

Long Weekend

Hope everyone is enjoying this long weekend!

September 4, 2009

AzMan Create/Remove/Get Task with C#

We have already seen how to add a store,create an application, and add an operation in AzMan using C#. Now, let's go on to creating a task using c#. I have uploaded a helper class here which has some comments not included in the short snippets below as well as some other methods (check if exists etc.). This class was designed to work with XML and AD (sorry not sql server yet).
public static IAzTask AddRoleDefinition(IAzApplication app, string roleDefinitionName)
{
if (roleDefinitionName == null || roleDefinitionName.Length == 0)
{
throw new ArgumentNullException("roleDefinitionName", "RoleDefinition name can not be null or empty.");
}
if (app == null)
{
throw new ArgumentNullException("app", "Application can not be null.");
}

IAzTask roleDefinition = app.CreateTask(roleDefinitionName, null);
roleDefinition.IsRoleDefinition = 1;
roleDefinition.Submit(0, null);

return roleDefinition;
}
Now let's delete that task:
public static void RemoveRoleDefinition(IAzApplication app, string roleDefinitionName)
{
if (roleDefinitionName == null || roleDefinitionName.Length == 0)
{
throw new ArgumentNullException("roleDefinitionName", "RoleDefinition name can not be null or empty.");
}
if (app == null)
{
throw new ArgumentNullException("app", "Application can not be null.");
}

app.DeleteTask(roleDefinitionName , null);

app.Submit(0, null);
}
Get task by name:
public static IAzTask GetRoleDefinition(IAzApplication app, string roleDefinitionName)
{
if (roleDefinitionName == null || roleDefinitionName.Length == 0)
{
throw new ArgumentNullException("roleDefinitionName", "RoleDefinition name can not be null or empty.");
}
if (app == null)
{
throw new ArgumentNullException("app", "Application can not be null.");
}

return app.OpenTask(roleDefinitionName, null);
}

September 3, 2009

AzMan Create/Remove/Get Operation with C#

Seems this is kind of shaping up into a bit of a series. As a background since someone asked me yesterday, all this code was used within a webservice for AzMan a few years ago. The idea was that the MMC console is really bad, and we wanted a better way to add things. Also, not everyone had access to the server and we wanted to make this web based for those users.

We have already seen how to add a store and create an application in AzMan using C#. Now, let's go on to creating an operation using c#. I have uploaded a helper class here which has some comments not included in the short snippets below as well as some other methods. This class was designed to work with XML and AD (sorry not sql server yet).
public static IAzOperation AddOperation(IAzApplication app, string operationName)
{
if (operationName == null || operationName.Length == 0)
{
throw new ArgumentNullException("operationName", "Operation name can not be null or empty.");
}
if (app == null)
{
throw new ArgumentNullException("app", "Application can not be null.");
}

IAzOperation operation = app.CreateOperation(operationName, null);

operation.Submit(0, null);

return operation;
}
Now let's delete that operation:
 public static void RemoveOperation(IAzApplication app, string operationName)
{
if (operationName == null || operationName.Length == 0)
{
throw new ArgumentNullException("operationName", "Operation name can not be null or empty.");
}
if (app == null)
{
throw new ArgumentNullException("app", "Application can not be null.");
}

app.DeleteOperation(operationName , null);

app.Submit(0, null);
}
Get operation by name:
public static IAzOperation GetOperation(IAzApplication app, string operationName)
{
if (operationName == null || operationName.Length == 0)
{
throw new ArgumentNullException("operationName", "Operation name can not be null or empty.");
}
if (app == null)
{
throw new ArgumentNullException("app", "Application can not be null.");
}

return app.OpenOperation(operationName, null);
}

September 2, 2009

AzMan Create/Remove Application with C#

As I continue to go through my old AzMan projects, I am going to show some more helper classes that I whipped up. I already showed how easy it is to create a store, but what about an application? Well, this is also easily done with the current API. I have uploaded a helper class here which has some comments not included in the short snippets below as well as simple checking for existing store. This class was designed to work with XML and AD (sorry not sql server yet).

Some examples:
public static IAzApplication AddApplication(IAzAuthorizationStore store, string applicationName)
{
if (applicationName == null || applicationName.Length == 0)
{
throw new ArgumentNullException("applicationName", "Application name can not be null or empty.");
}
if (store == null)
{
throw new ArgumentNullException("store", "Store can not be null.");
}

IAzApplication app = store.CreateApplication(applicationName, null);

app.Submit(0, null);

return app;
}

Here is how to remove that application:
public static void RemoveApplication(IAzAuthorizationStore store, string applicationName)
{
if (applicationName == null || applicationName.Length == 0)
{
throw new ArgumentNullException("applicationName", "Application name can not be null or empty.");
}
if (store == null)
{
throw new ArgumentNullException("store", "Store can not be null.");
}

store.DeleteApplication(applicationName , null);

store.Submit(0, null);
}

How about just getting the application:
public static IAzApplication GetApplication(string storeUrl, string applicationName)
{
if (applicationName == null || applicationName.Length == 0)
{
throw new ArgumentNullException("applicationName", "Application name can not be null or empty.");
}
if (storeUrl == null || storeUrl.Length == 0)
{
throw new ArgumentNullException("storeUrl", "Store URL can not be null or empty.");
}

//http://www.box.net/shared/ubs0oebs0l to get storehelper
IAzAuthorizationStore store = StoreHelper.GetStore(storeUrl);
return store.OpenApplication(applicationName, null);
}

What about getting application names from the store?
public static string[] GetApplicationNames(IAzAuthorizationStore store)
{
if (store == null)
{
throw new ArgumentNullException("store", "Store can not be null.");
}

ArrayList applicationNames = new ArrayList();

foreach (IAzApplication app in store.Applications)
{
applicationNames.Add(app.Name);
}

return (string[])applicationNames.ToArray(typeof(string));
}

September 1, 2009

Software Transactional Memory

I recently came across this on MSDN.

"Software Transactional Memory (STM.NET) is a mechanism for efficient isolation of shared state. The programmer demarcates a region of code as operating within a transaction that is “atomic” and “isolated” from other transacted code running concurrently."

This is an experimental release allowing c# coders to try this technology out. It requires VS 2008 and is only available now for c#. I will have to find a machine to test this out though since I am on 64 bit and it only supports 32.

Exciting though to see this...

August 31, 2009

PowerShell Interview with Jeffrey Snover

Take a look here.

August 30, 2009

Compare Hotfixes on Server using Powershell

I came across this script on the Powershell Code Repository site. Props to the author as this is very helpful. I am showing the code below as sometimes hitting the community site is very slow:
Function Compare-InstalledHotfix {
param (
[parameter(Mandatory=$true,Position=0)]
$server1,

[parameter(Mandatory=$true,Position=1)]
$server2,

[parameter(Mandatory=$true,Position=3)]
[Management.Automation.PSCredential]
$credential
)

$server1HotFix = get-hotfix -computer $server1 -Credential $credential | select HotfixId
$server2HotFix = get-hotfix -computer $server2 -Credential $credential | select HotfixId

$comparedHotfixes = compare-object $server2HotFix $server1HotFix -IncludeEqual

$result = @();

foreach ($c in $comparedHotfixes) {
$kbinfo = "" | select KB,$server1,$server2
$kbinfo.KB = $c.InputObject.HotfixId
switch ($c.SideIndicator)
{
"==" {
write-host -ForegroundColor Green "Both servers have $($c.InputObject.HotfixId)"
$kbinfo.($server1) = $true
$kbinfo.($server2) = $true
$result += $kbinfo
}

"=>" {
write-host -ForegroundColor Yellow "$server1 has $($c.InputObject.HotfixId) but $server2 doesn't"
$kbinfo.($server1) = $true
$kbinfo.($server2) = $false
$result += $kbinfo
}

"<=" { write-host -ForegroundColor Magenta "$server2 has $($c.InputObject.HotfixId) but $server1 doesn't" $kbinfo.($server1) = $false $kbinfo.($server2) = $true $result += $kbinfo } } # End Switch } # End foreach $result } # End Function

August 29, 2009

Good Weekend

Hope everyone is having a great weekend!

August 28, 2009

AzMan Create/Remove Store with C#

I was looking through some old projects I did in AzMan as some are relevant to questions I received over the last few weeks. One person wanted to be able to create/remove a store through c#. This is easily done with the current API. I have uploaded a helper class here which has some comments not included in the short snippets below as well as simple checking for existing store. This class was designed to work with XML and AD (sorry not sql server yet).

Some examples:
public static IAzAuthorizationStore CreateStore(string storeUrl)
{
if (storeUrl == null || storeUrl.Length == 0)
{
throw new ArgumentNullException("storeUrl", "Store URL can not be null or empty.");
}

IAzAuthorizationStore store = new AzAuthorizationStoreClass();
store.Initialize(1, storeUrl, null);

store.Submit(0, null);

return store;
}

Here is how to remove that store:

public static void RemoveStore(string storeUrl)
{
if (storeUrl == null || storeUrl.Length == 0)
{
throw new ArgumentNullException("storeUrl", "Store URL can not be null or empty.");
}

IAzAuthorizationStore store = GetStore(storeUrl);

store.Delete(null);
}

August 27, 2009

Powershell and XAML

Someone asked me if you can load up xaml in powershell. My response was "What can't powershell do!". The only thing is that you must start powershell using a single-threaded apartment like:
powershell -sta -file MyXAML.ps1
Here is one way of doing it with the xaml file not directly in the powershell script:
Add-Type -AssemblyName PresentationFramework
[System.Reflection.Assembly]::LoadFrom(".\lib\WPFToolkit.dll")
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

function LoadXaml
{
param($fileName)

[xml]$xaml = [IO.File]::ReadAllText($fileName)
$reader = (New-Object System.Xml.XmlNodeReader $xaml)
[Windows.Markup.XamlReader]::Load( $reader )
}

# Load XAML
$app = new-object System.Windows.Application
$form = LoadXaml('.\dialog.xaml')
Your dialog.xaml file can look like:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
>
Title="Window1" Height="300" Width="408">
<Canvas>
<Button x:Name='button1'
Width='75'
Height='23'
Canvas.Left='118'
Canvas.Top='10'
Content='Click Here' />
</Canvas>
</Window>

August 26, 2009

Log4net ADO.NET Appender

Here is a simple way to make sure you don't have to put the connectionstring in the config file for Log4Net and instead just pull it from the connectionString setting:
using System;
using System.Collections.Generic;
using System.Configuration;
using log4net.Appender;
using System.Data.Common;

namespace Log4net.Appender
{
public class AppSettingsConnectionStringAdoNetAppender : AdoNetAppender
{
string _connectionStringName;

public string ConnectionStringName
{
get { return _connectionStringName; }

set
{
if (string.IsNullOrEmpty(value))
throw new ArgumentException("Null or empty connection string name.");

try
{
ConnectionStringSettings connectionString =
ConfigurationManager.ConnectionStrings[value];

DbProviderFactory factory = DbProviderFactories.GetFactory(
connectionString.ProviderName);

using (DbConnection connection = factory.CreateConnection())
{
this.ConnectionType = connection.GetType().ToString();
this.ConnectionString = connectionString.ConnectionString;
}

_connectionStringName = value;
}
catch(Exception ex)
{
throw new ArgumentException("We can't initialize connection string from the name passed. " + value, ex);
}
}
}
}
}
Take this code and add it to your appender library or create your own library and build the assembly. After that, in your log4net config file you can call the appender now like any other appender:
<appender name="My_AdoNetAppender" type="Log4Net.Appender.AppSettingsConnectionStringAdoNetAppender, JLFramework.Log4Net.Appender">
</appender>

August 25, 2009

Quiet Day

I don't know if it is a good thing or bad thing to have a really quiet day right after coming back from vacation. Anyway, I am working on my new projects and still trying to come up with a good domain name. I never thought it would be this hard!