Thursday, June 19, 2008

I never realized this but you can set the default SMTP information in the .config file (Thanks Viktar!). This applies to the new System.Net.Mail.* classes (Not the deprecated System.Web.Mail.* classes). MSDN defines the elements here and here.

<configuration>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="network" 
         from="appointments@TrepanationNation.com"> <network host="smtp.TrepanationNation.com"
         port="25" defaultCredentials="true"/> </smtp> </mailSettings> </system.net>

The code is the same but you no longer have to specify the from and SMTP server details:

using (MailMessage message = new MailMessage())
{
    message.IsBodyHtml = true;
    message.To.Add("someguy@someserver.com");
    message.Subject = "Trepanation Appointment";
    message.Body = @"<b>This confirms your 
        Trepanation appointment this Friday.</b>";
    SmtpClient mailClient = new SmtpClient();
    mailClient.Send(message);
}
.NET 2.0 | C# | SMTP
Thursday, June 19, 2008 2:56:35 PM (GMT Standard Time, UTC+00:00)  #   |  Comments [0]  | 
 Tuesday, June 17, 2008

Telerik has a very nice online code converter here. I've recently been converting VB.NET code to C# and this tool seems to be able to convert code that many of the others out there cannot. The only thing it seems to miss is the parens when converting indexer callers. So it doesn't convert the VB.NET myDataReader("Name") to the C# myDataReader["Name"]. Not a huge deal though.

Tuesday, June 17, 2008 6:54:22 PM (GMT Standard Time, UTC+00:00)  #   |  Comments [0]  | 

Rick Strahl's .NET Rocks presentation on AJAX and jQuery (that he mentioned in May) has been published. Check it out.

.NET | AJAX | jQuery
Tuesday, June 17, 2008 3:49:31 PM (GMT Standard Time, UTC+00:00)  #   |  Comments [0]  | 
 Wednesday, June 11, 2008

The following steps outline how to install OpenFire on Windows Server 2003 as a service with Active Directory using the Pidgin client. These steps apply to Openfire 3.5.1 and may change with later versions.

  1. Download the OpenFire Windows installer and run it. Once the install is complete there should be a checkbox that says "Run OpenFire", make sure this is checked and click Finish.
  2. The OpenFire GUI should now appear, once the server is started the LaunchAdmin button will be enabled, click it. This will open the configuration wizard in a browser.
  3. Configure the server as follows:
    1. Language Selection: Choose your speak
    2. Server Settings: Accept the defaults unless you need to change these.
    3. Database Settings: This tutorial assumes an embedded database. If you need to run OpenFire in a demanding environment you will probably want to use an external database.
    4. Profile Settings: Choose the Directory Server (LDAP) option and click Continue.
      1. Connection Settings: Set the Host to an Active Directory server and accept the default port. Set the distinguished name (DN) to the base location of your users. All users in this and child objects will be available to Openfire. The first portion of the DN is the base object name. To reference a built in object like Users you would use the canonical name identifier; cn=Users. For a custom organization unit object you would use the OU identifier; ou=MyOrgUnit. The following domain objects use the domain class identifier, dc=. So for the domain denver.mycompany.int the second portion of the DN would be dc=denver,dc=mycompany,dc=int. Next specify a user that has rights to access the Active Directory store. This account only needs to be in the Domain Users group (Unless you want to be able to write back to AD). The DN of this user can be specified as a fully qualified username; MyDomain\Username. One a side note, the password field has a limit of 30 characters so if you are using a password that exceeds this length it will be truncated and your account will not authenticate. Press Test Settings to verify your settings and press Save & Continue if they test successfully.

        image

      2. User Mapping: Accept the defaults and press Save & Continue.
      3. Group Mapping: Accept the defaults and press Save & Continue.
    5. Administrator Account: Enter the username (This username is not fully qualified; just use the username without the domain) of the user who will administer the OpenFire server. You can add as many administrators as you wish. Press Continue.
    6. Once the setup is complete press Login to the admin console and login with an admin account you specified in the last step. If you run into any issues (Like not being able to add admins or a server error on the last page in the wizard) try uninstalling and reinstalling.
  4. In the admin you can set a number of settings, here are a few that I was interested in:
    1. Server Settings
      1. Server to Server Settings
        1. Service Enabled = False
      2. Registration Settings
        1. Inband Account Registration = Disabled
        2. Change Password = Disabled
        3. Anonymous Login = Disabled
      3. Offline Messages
        1. Store\Always Store
      4. Security Settings
        1. Client Connection Security = Required
  5. Now close out the OpenFire GUI, press Quit.
  6. Open a command prompt and set your working directory as C:\Program Files\Openfire\bin or whatever your OpenFire install directory is.
  7. Run the following two commands to install the OpenFire service and to start it:

    openfire-service /install
    openfire-service /start

 

The following steps demonstrate how to setup Pidgin to connect to the OpenFire server you just installed.

  1. Download and install Pidgin here.
  2. Once Pidgin is running right-click the icon in the systray and select Accounts.
  3. Add a new account.
    1. Under the Basic tab enter the following information:
      1. Protocol: XMPP
      2. Screen Name: Your domain username (This username is not fully qualified; just use the username without the domain).
      3. Domain: The name of the server OpenFire is running on.
      4. Resource: Doesn't matter.
      5. Password: Guess....
      6. Local Alias: Whatever you want.
    2. Under the Advanced tab enter the following information:
      1. Require SSL/TLS: Unchecked
      2. Force old (port 5223) SSL: Checked
      3. Allow plaintext auth...: Unchecked
      4. Connect port: 5223
      5. Connect server: Blank
      6. File transfer proxies: The name of the server with port 7777 specified (IE MyOpenFireServer:7777).
      7. Proxy type: Use the default.
    3. Click Save
  4. To browse for users goto Accounts|{username}@{servername}/{resource} (XMPP)|Search for users....
  5. In the Enter a User Directory dialog accept the default and click Search Directory.
  6. In the Advanced User Search dialog enter an asterisk (Or a search string) and click ok. This will return a list of users that you can now add as buddies.
Wednesday, June 11, 2008 2:37:12 AM (GMT Standard Time, UTC+00:00)  #   |  Comments [0]  | 
 Thursday, May 29, 2008

I mistakenly grabbed the latest WiX installer from here but the latest builds for version 3 are here under the weekly releases. There was an issue with the 3.0.2925 release with referencing the NETFRAMEWORK35 property in the WixNetFxExtension. This is fixed in later releases.

BTW, WiX rocks! Visual Studio 2008 integration is very nice. If you are looking for an alternative to the stock VS setup project and need more control over the MSI, I'd check it out.

Thursday, May 29, 2008 4:34:27 PM (GMT Standard Time, UTC+00:00)  #   |  Comments [0]  | 
 Wednesday, May 21, 2008

Reachmail (the company I work for) is looking for a senior ASP.NET/C# developer. If you are a progressive developer who is a true geek, really understands OO and patterns and is looking for a change, browse to the link below to apply. We are currently located in Naperville but will be moving to downtown Chicago the 1st of July (Within walking distance of Union and Ogilvie). We really need someone who knows their stuff and doesn't require hand holding. Although we need someone who is able to work independently we don't want an independent person (IE "cowboy"); they must be a team player or they wont last long. We have a relaxed environment and a lot of growth.

The software is a permission based email marketing SAAS written primarily in classic ASP with a SQL Server 2005 back end. Parts of the system are written in VB.NET and C#. One of our goals is to get the application converted over to ASP.NET/C# and rearchitect much of the system. All of our existing .NET code has been upgraded to 3.5 and new development is obviously in 3.5 and C#.

 

.NET | C#
Wednesday, May 21, 2008 3:42:58 PM (GMT Standard Time, UTC+00:00)  #   |  Comments [0]  | 
 Friday, May 09, 2008

I found two good PDF's on the interweb of Bohr's seminal papers (Published in Phil. Mag., 1913) on atomic structure. I couldnt find part 3 unfortunately.

On the Constitution of Atoms and Molecules

Part II. – Systems containing only a Single Nucleus

Also Rutherfords papers on the gold foil experiment and large angle scattering of alpha & beta particles that led to Bohr's enunciation of the nuclear/quantized model of the atom.

The Scattering of Αlpha and Βeta Particles by Matter and the Structure of the Atom (Phil Mag 1911)

The Structure of the Atom (Phil Mag 1914)

Donald Sadoway, MIT, does a really nice job of covering the Bohr model in the following lectures (3.091 Intro to Solid State Chemistry). Requires Real Player (Or Real Alternative if you please).

Lecture 3. Rutherford model of the atom, Bohr model of hydrogen.

Lecture 4. Atomic spectra of hydrogen, matter/energy interactions involving atomic hydrogen.

Lecture 5. The Shell Model (Bohr- Sommerfeld Model) and multi-electron atoms. Quantum numbers: n, l, m, s.

Friday, May 09, 2008 5:11:49 PM (GMT Standard Time, UTC+00:00)  #   |  Comments [0]  | 
 Tuesday, May 06, 2008

Parsing a date with a custom format is as easy as pie with the DateTime.ParseExact method, check it:

DateTime.ParseExact("04292008", "MMddyyyy", null)

Where the first parameter is the value to parse, the second is a format string and for the culture info you can pass null for the current culture (Unless you need to specify one).

UPDATE:

If you need to exclude other characters in the string you can add the literal values qualified by single quotes in the format string. So for example lets say you wanted to extract the date and hour from an IIS log filename, ex08041013.log. You could pass the format string 'ex'yyMMddHH'.log' and the parse method will ignore the ex and .log portions of the string.

DateTime.ParseExact("ex08041013.log", "'ex'yyMMddHH'.log'", null)
C#
Tuesday, May 06, 2008 8:46:21 PM (GMT Standard Time, UTC+00:00)  #   |  Comments [0]  | 
 Friday, April 25, 2008

So I had FTP setup on a Server '03 box with an FTP site configured to use user isolation mode with active directory. Everything was working great then all of a sudden users cant login and this error appears in the System events in the event log:

image

This error, while true, doesn't really pinpoint the problem... But I found this wonderful article that suggested that the account used by the FTP site to access AD was changed. "Oh yeah!", I said, "I did change that, D'OH!". Easy enough to fix; just open a command prompt and use the adsutil.vbs to update the AD account in the IIS metabase.

c:\Inetpub\Adminscripts\adsutil.vbs set msftpsvc/{FTP_SITE_ID}/ADConnectionsUserName MyDomain\MyFTPADUsername

c:\Inetpub\Adminscripts\adsutil.vbs set msftpsvc/{FTP_SITE_ID}/ADConnectionsPassword S0m3P@$$W0rd 

Remember to include the domain name with the username.

Friday, April 25, 2008 6:37:51 PM (GMT Standard Time, UTC+00:00)  #   |  Comments [0]  |