IBM Doors: Performance tests with DXL

Problem

Sometimes it is necesseray to benchmark DXL scripts for their execution time.

Approach

There is a basic function called getTickCount_() that gives the current milliseconds. When subtracting the time before and after the execution we can get the execution time that was needed for the script.

Solution

int measureStart = (getTickCount_());

sleep_(1240);

int measureEnd = (getTickCount_());

print "The doing took " (measureEnd - measureStart) " seconds";

C#+LDAP: Email an Lotus Notes Gruppen per SMTP schicken

Problem

In einem Unternehmen sollen Lotus Notes Gruppen aufgelöst werden um den Mitgliedern der LN Gruppe Mails über einen normalen SMTP Server zu schicken

Ansatz

Lotus Notes besitzt i.d.R. einen LDAP Server, der die Notes Gruppen aufschlüsselt. Auf LDAP kann über C# zugegriffen werden.

Lösung

public ArrayList resolvingNotesGroups(String mailGroup)
{
 ArrayList alMailAddys = new ArrayList();

 DirectoryEntry DirEntry = new DirectoryEntry();
 {
  DirEntry.Path = "LDAP://notesldap.it.company.com";
  DirEntry.AuthenticationType = AuthenticationTypes.ServerBind;
 }
   
 DirectorySearcher search = new DirectorySearcher(DirEntry);
 DirectoryEntry de = new DirectoryEntry();

 Dictionary<String, String> dict = new Dictionary<string, string>();

 // Tweak this to refine your search
 search.Filter = "(cn=" + mailGroup + ")";// BBME_AC_Rubi
 // I limit my results while I tweak          
 search.SearchScope = SearchScope.Subtree;          

 try
 {
  SearchResultCollection src = search.FindAll();
        
  if (src.Count != 0)
  {
   foreach (SearchResult result in search.FindAll())
   {
    // Display each of the values for the property 
    // identified by the property name.
    foreach (object property in result.Properties["member"])
    {
     // CN Name ermitteln
     dict.Add(property.ToString(), "");
    }
   }
    
  }
  else
  {
   throw new Exception("GroupResolving - No Entry found for: " + search.Filter);
  }

  int indexStart;
  int indexEnd;


  foreach (KeyValuePair<string, string> entry in dict)
  {
   search.Dispose();
   search = new DirectorySearcher(DirEntry);

   indexStart = entry.Key.IndexOf("=");
   indexEnd = entry.Key.IndexOf(",");

   // Entry key only CN 
   search.Filter = "(cn=" + entry.Key.Substring(indexStart + 1, indexEnd - indexStart - 1) + ")";
   search.SearchScope = SearchScope.Subtree;

   foreach (SearchResult result in search.FindAll())
   {
    if (result != null)
    {

     de = result.GetDirectoryEntry();
     alMailAddys.Add(de.Properties["mail"].Value.ToString());
    }
    else
    {
     throw new Exception("Peolple Resolving - No Entry found for: " + search.Filter);
    }
   }
  }

 }
 catch (Exception ex)
 {
  throw new Exception("Following error occured: " + ex.Message.ToString());
 }
 finally
 {
  search.Dispose();
  DirEntry.Close();
 }

 return alMailAddys;
}}