Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
S

solutionsville

@solutionsville
About
Posts
53
Topics
20
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • MultiThreading help
    S solutionsville

    Thank you Dave, that helps me on where to look. Much appreciated.

    C# help database

  • MultiThreading help
    S solutionsville

    The crash that occurs occasionally. Is Exception Unhandled System.IndexOutOfRangeException: 'Index was outside of the bounds of the array.'. This occursis an at the GetCnaInfo(CNA cna) of the code I previously posted, where it reads updates.Add(qb.Query);. I have stepped thru the code, set break points where the query starts, and I am not finding what the issues is that is causing the IndexOutOfRangeException. Sometimes this will run all the way thru the routine and not error. Clear the field in the database and run the routine again and then I get this error. Thanks,

    C# help database

  • MultiThreading help
    S solutionsville

    Hi, I inherited a program from a programmer that has since left the company. He built it with threading and the program crashes I think due to starting more threads than the system can handle. I am thinking that I need to implement a Thread Pool for this code, and am unsure how I should do that not having done it before, and complicating the matter of modifying the existing code. So, here is the existing code that uses the threading;

    using my.data;
    using System;
    using System.Collections.Concurrent;
    using System.Collections.Generic;
    using System.Data.SqlClient;
    using System.Threading;

    namespace CnaFirmware
    {

    public class DbUpdateFromField
    {
        Dictionary cnas;
        ConcurrentQueue ConsoleQueue;
        EventWaitHandle UpdateComplete;
        ClsUdpDispatcher UdpDispatcher;
        List updates;
    
        // this class starts a thread that downloads config data from all cnas, then updates the cna\_firmware table.
        class CNA
        {
            public string ip;
            public string firmware;
            public int cktid;
            public bool updated;
            public bool error;
    
            public CNA(string i, string f, int c)
            {
                this.ip = i;
                this.firmware = f;
                this.cktid = c;
                this.updated = false;
                this.error = false;
            }
        }
    
        public DbUpdateFromField(ClsUdpDispatcher disp, ConcurrentQueue q, EventWaitHandle op\_done)
        {
            UdpDispatcher = disp;
            ConsoleQueue = q;
            UpdateComplete = op\_done;
            Log("start");
            updates = new List();
            cnas = new Dictionary();
            new Thread(() => Start()).Start();
        }
    
        void Start()
        {
            GetIpList();
            GetCnaData();
        }
        void Log(string s)
        {
            ConsoleQueue.Enqueue("DbUpdate: " + s);
        }
    
        void GetCnaData()
        {
            SqlConnection DB;
            foreach (var v in cnas)
            {
                // get data from each cna, in sequence (not concurrent)
                new Thread(() => GetCnaInfo(v.Value)).Start();
            }
            // loop through all the cnas until either error or complete flag is set
            bool done;
            do
            {
                Thread.Sleep(50);
                done = tr
    
    C# help database

  • How would I handle an Error with this piece of code.
    S solutionsville

    I have a web page that opens and checks status of other locations via a web link. If I get an error where a location is not responding, what is the best way to handle this type of error. Here is the link; XPathDocument doc40 = new XPathDocument("http://10.50.6.40:8585/api/get\_status?password=f9c598aa58bff2a605495709f772775f&application=Widgetpage"); string state40 = doc40.CreateNavigator().SelectSingleNode("alwaysup-get-status-response/applications/application/state").Value; Label40.Text = state40; If the page does not respone, I want a popup that it is not responding and continue to load the page. Thanks,

    ASP.NET question json help

  • Text parser
    S solutionsville

    That worked. Thanks for the help!

    C# help question lounge

  • Text parser
    S solutionsville

    Yes, I think this will work. I will bang it out later this afternoon, and reply with results. Thanks much. Brian

    C# help question lounge

  • Text parser
    S solutionsville

    You are correct in your understanding. Same timestamp and same stationid e.g. [129008]. The information up to the end of the [] info is the same length. From that point on the length of the message is dictated by the type of message. Thanks for the suggestions. Brian

    C# help question lounge

  • Text parser
    S solutionsville

    Good suggestion. I need to learn Regex regardless. No I am not running this real time. It is a static log that is opened after the fact. First I do a string collection and create a single line of the HEX, and put the RX/TX items at a specific location to facilitate finding the correct item in the HEX to highlight and simplfy pattern searching. Once it is in a single line format, then I look for the location to highlight, then color accordingly. Here is the raw; Correct format; 2008/04/24 19:16:50 [128009]ARES_EINDICATION 010.050.082.101 103.2.01 (19d1) RX 68 bytes 2008/04/24 19:16:50 [128009] 19 D1 26 02 34 E8 AA 20 76 97 51 28 50 76 38 64 2008/04/24 19:16:50 [128009] 49 00 58 02 02 C7 88 01 C7 88 AA 50 76 38 64 49 2008/04/24 19:16:50 [128009] 20 76 97 51 28 D8 07 04 18 13 10 2F 00 00 10 0A 2008/04/24 19:16:50 [128009] 06 0A 06 06 0A 06 0A 06 06 06 06 06 06 06 06 73 2008/04/24 19:16:50 [128009] 74 69 9C F6 Incorrect/missing format; 2008/04/24 19:16:51 [128009]ARES_EINDICATION 010.050.082.104 107.1.01 (1ac1) RX 68 bytes Brian

    C# help question lounge

  • Text parser
    S solutionsville

    I have a routine that takes identifies a specific location on each line of HEX and highlights it. It works fine until it gets to a line that the sniffer did not capture any HEX. From that point on it is highlighting random spots in the file. How should I handle identifing the error, and then continue past it without causing it to randomize the locations? Here is a sample of what I would normally see in the HEX (all one line); 2008/04/24 19:16:50 [128009]ARES_EINDICATION 010.050.082.101 103.2.01 (19d1) RX 68 bytes 19 D1 26 02 34 E8 AA 20 76 97 51 28 50 76 38 64 49 00 58 02 02 C7 88 01 C7 88 AA 50 76 38 64 49 20 76 97 51 28 D8 07 04 18 13 10 2F 00 00 10 0A 06 0A 06 06 0A 06 0A 06 06 06 06 06 06 06 06 73 74 69 9C F6 Here is a sample of the line with the error in it (all one line); 2008/04/24 19:16:51 [128009]ARES_EINDICATION 010.050.082.104 107.1.01 (1ac1) RX 68 bytes This is the snippit of the code to find the sequence numbers; private void findSequenceNumbers() { toolStripStatusLabel.Enabled = true; toolStripStatusLabel.Visible = true; //Find the ARES and ATCS L3 Sequence Numbers and change to Blue/BOLD color int lineNum = 0; bool startingNewLine = true; FontStyle style = FontStyle.Bold; string[] lines = rtbDoc.Lines; string text = rtbDoc.Text; rtbDoc.Enabled = false; for (int i = 0; i < text.Length; i++) { if (startingNewLine) { //Find and highlight ARES EINDICATION Sequence Numbers if (lines[lineNum].Contains("]ARES_EINDICATION")) { i += 154; rtbDoc.Select(i, 2); rtbDoc.SelectionFont = new Font(rtbDoc.SelectionFont, rtbDoc.SelectionFont.Style ^ style); rtbDoc.SelectionColor = Color.Blue; } //Find and highlight ARES INDICATION Sequence Number else if (lines[lineNum].Contains("]ARES_INDICATION")) { i += 154; rtbDoc.Select(i, 2); rtbDoc.SelectionFont = new Font(rtbDoc.SelectionFont, rtbDoc.SelectionFont.Style ^ style); rtbDoc.SelectionColor = Color.Blue; } //Find and highlight CODELINE INDICATION MESS

    C# help question lounge

  • Query Help
    S solutionsville

    Thanks Paul. I Appreciate it. Brian

    Database database help question

  • Query Help
    S solutionsville

    Hello Paul, and thank you for your response. I need to get better explaining my brainstorming! Ok, the Zipcode table has Zipcode, City, State Code fields. The State Table has State Code, State Abrieviation, and State Name. The two tables are related by the State Code field. I would think that if I enter the zip, then perform an after update event that queries the Zipcode table and populates the State field of the form. So, with the above in mind, would you think that this query would work? SELECT [ZIP Codes].[City], [States].[State Abbreviation] FROM [ZIP Codes], States WHERE [Zip Codes].[ZIP Code] = '44107' and [States].[State Code] = (SELECT [ZIP Codes].[State Code] FROM [ZIP Codes] WHERE [ZIP Codes].[ZIP Code] = '44107') ORDER BY [ZIP Codes].[ZIP Code]; Thanks,

    Database database help question

  • Query Help
    S solutionsville

    I have a Access Form, with a series of three combo boxes. Box 1 - City Box 2 - State Box 3 - ZIP When I input the zip code, I want to populate the other two boxes based on the result of the ZIP code. I have a ZIP codee table, which has ZIP, CITY, and a second table that has State. How should I write the query in order to accomplish this? Thanks,

    Database database help question

  • import HOST file into a table
    S solutionsville

    Thanks Paul.

    Database database tools

  • import HOST file into a table
    S solutionsville

    Hello Paul. I guess I was kinda vauge... Mind is elsewhere. Funeral today. I want to write an SQL script that looks at the Windows HOSTS File and reads the IP / host name into two columns of a table. I next want to write a SQL Script that I can run as a job and validate the entries in the hosts file and if they have changed then modify the table data. I will also send a diff email to myself noting any changes(the email piece I have figured out). Thanks,

    Database database tools

  • import HOST file into a table
    S solutionsville

    I would like to import my HOST file into a DB Table and the periodically run a script to verify if all the entries are the same, changed, deleted, etc.

    Database database tools

  • Conversion help
    S solutionsville

    The reason is for faster search indexing. I found this after I posted; Create FUNCTION [dbo].[Dot2LongIP]( @IP VarChar(15) ) RETURNS BigInt AS BEGIN DECLARE @ipA BigInt, @ipB Int, @ipC Int, @ipD Int, @ipI BigInt SELECT @ipA = LEFT(@ip, PATINDEX('%.%', @ip) - 1 ) SELECT @ip = RIGHT(@ip, LEN(@ip) - LEN(@ipA) - 1 ) SELECT @ipB = LEFT(@ip, PATINDEX('%.%', @ip) - 1 ) SELECT @ip = RIGHT(@ip, LEN(@ip) - LEN(@ipB) - 1 ) SELECT @ipC = LEFT(@ip, PATINDEX('%.%', @ip) - 1 ) SELECT @ip = RIGHT(@ip, LEN(@ip) - LEN(@ipC) - 1 ) SELECT @ipD = @ip RETURN ( @ipA * 256*256*256 ) + ( @ipB * 256*256 ) + ( @ipC * 256 ) + @ipD END RETURN @ipI END This does speed it up and seems to meet my needs. Thanks,

    Database help

  • Conversion help
    S solutionsville

    I want to take an IP address e.g. 111.222.333.444 and convert it to either a float or an unsigned datatype. Thanks,

    Database help

  • sp_send_dbmail as HTML Email
    S solutionsville

    The answer was a simple. I missed a double quote in this field; N''

    Database html database mcp

  • sp_send_dbmail as HTML Email
    S solutionsville

    I took the books online sample and modified it with my data. When I run the query it sends the email, with the Header, and nothing else. The Table data never shows. Here is the code I used; USE NMS_RT DECLARE @tableHTML NVARCHAR(MAX) ; SET @tableHTML = N'

    MCP Alarms for previous 24 Hours

    ' + N'

    Database html database mcp

  • DateTime Query
    S solutionsville

    The answer was; WHERE [TimeStamp]>= Convert(varchar(10), DateADD(DAY, -1, GETDATE()), 101) AND [TimeStamp] < Convert(varchar(10), GETDATE(), 101) This gave the info for the previous day only. Brian

    Database database tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups