davers's Profile User Rating: -----

Reputation: 1 Apprentice
Group:
Active Members
Active Posts:
62 (0.05 per day)
Joined:
07-April 11
Profile Views:
1,153
Last Active:
User is offline Sep 25 2014 11:22 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   davers has not set their status

Posts I've Made

  1. In Topic: Loop within a loop.

    Posted 25 Sep 2014

    Awesome n0rman! :) Thanks everyone for the help! I really appreciate it!!!

    Dave
  2. In Topic: Loop within a loop.

    Posted 25 Sep 2014

    You are correct...both cases are good. I wound up just creating a dictionary... although, it took me a bit to figure it out. Here's how I'm doing it now:
                IEnumerable<int> result2 = Enumerable.Range(1, Convert.ToInt32(myValue)).Except(hostList);
    
                List<int> intsLists = new List<int>(result2);
    
                Dictionary<string, int> dictionary = new Dictionary<string, int>();
    
                for (int i = 0; i < ListNeedToADD.Count; i++)
                {
                    dictionary.Add(ListNeedToADD[i].ToString(), intsLists[i]);
                }
    
                foreach (KeyValuePair<string, int> keyValuePair in dictionary)
                {
                    insertReportLimits(attribTable, keyValuePair.Key, keyValuePair.Value, con);
                }
    
    


    I did need to convert my IEnumerable list to just a List.. but I'm ok with that. I've tested it and it works, what do you think!

    Thanks for the reply!

    Dave
  3. In Topic: Windows service and LDAP change notifications

    Posted 22 Mar 2013

    Hmm...Ok, I guess I'm confused again. So I need to put a stop in there even though the connection needs to remain open to receive AD LDS change notifications? :helpsmilie:

    Dave
  4. In Topic: Windows service and LDAP change notifications

    Posted 22 Mar 2013

    Wow! I can't believe this took so long to click in my head. So, I'm pretty sure this is what you were talking about:

            protected override void onstart(string[] args)
            {
                thread = new Thread(this.WorkerThread);
                thread.Start();
    
                myDte1 = DateTime.Now.ToString(GlobalVariables.logFileFormat);
                myDte2 = DateTime.Now.ToString(GlobalVariables.logFormat);
                myDte3 = DateTime.Now.ToString("G");
    
                string myString1 = String.Format("[" + myDte2 + "] SERVICE : Service started...");
    
                using (StreamWriter w = File.AppendText(GlobalVariables.myLogFldr + "SPSChange.log." + myDte1 + ".txt"))
                {
                    Log(myString1, w);
                }  
            }
    
            public void WorkerThread()
            {
                try
                {
                    ChangeNotifier notifier = new ChangeNotifier(connect);
    
                    notifier.Register("OU=ACDAgents,OU=CM,OU=DEFINITY Servers,OU=dem,DC=starfish", SearchScope.Subtree);
                    notifier.ObjectChanged += new EventHandler<ObjectChangedEventArgs>(notifier_ObjectChanged);
    
                    string myString2 = String.Format("[" + myDte2 + "] DEBUG : Connected to DEM!");
    
                    using (StreamWriter w = File.AppendText(GlobalVariables.myLogFldr + "SPSChange.log." + myDte1 + ".txt"))
                    {
                        Log(myString2, w);
                    }
                }
                catch (Exception ex)
                {
                    string myString3 = String.Format("[" + myDte2 + "] ERROR : Can not connect to DEM! - " + ex.Message);
    
                    using (StreamWriter w = File.AppendText(GlobalVariables.myLogFldr + "SPSChange.log." + myDte1 + ".txt"))
                    {
                        Log(myString3, w);
                    }
                }
    
                while (true)
                {
                    myDte1 = DateTime.Now.ToString(GlobalVariables.logFileFormat);
                    myDte2 = DateTime.Now.ToString(GlobalVariables.logFormat);
                    myDte3 = DateTime.Now.ToString("G");
    
                    string myString1 = String.Format("[" + myDte2 + "] HEARTBEAT : I'm running already!!");
    
                    using (StreamWriter w = File.AppendText(GlobalVariables.myLogFldr + "SPSChange.log." + myDte1 + ".txt"))
                    {
                        Log(myString1, w);
                    }
    
                    Thread.Sleep(300000);
                }
            }
    


    there's a lot of logging stuff that's in there...but I think you'll see the threading I'm using. I have it write to my log every 5 minutes just so I know it's still there. Is that what you had in mind Skydiver?

    Thanks again for all your help!!!

    Dave
  5. In Topic: Windows service and LDAP change notifications

    Posted 20 Mar 2013

    Hey Gang! I've tried implementing what Skydiver has suggested above, and my service works in "debug" mode, but I can't get it to install. I get error 1053: "The service did not respond to the start or control request in a timely fashion". I've read that that can be to the service getting stuck in an eternal loop...etc. I'm wondering if perhaps the:

                        while (_keepGoing)
                            ;
    


    could be the cause? Does anyone have any ideas?

    Thanks!

    Dave

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

davers hasn't added any friends yet.

Comments

davers has no profile comments yet. Why not say hello?