|
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
|
|
|
|
|
So you have a file with line feeds that you make individual strings for, if I'm understanding you correctly. So all the items in the above example with the same timestamp are considered in the same transmission.
Assuming the headers are never broken (not so good) you could use the RX size to count the bytes to make sure of the correct sizing.
If you're considering everything between the header text (ARES_EIN---) to be one transmission, you could load a either a generic List<string> or array String[] to hold transmissions, then colorize by line without using the index in the long string in your output window.
Scott P
"Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand
|
|
|
|
|
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
|
|
|
|
|
Ok, you can do a very short mod to your existing code to get you in the direction. Use the .Lines property on the rich text box to get the lines array from it, Then do a foreach on the lines to go through them. If I remember right the colorization is done by character index, so generating that number would be a matter of accumulating the length of the lines properly.
int total = 0;
foreach(String trans in rtb.Lines){
total += s.Length;
ColorizationInfo temp = new ColorizationInfo(trans);
Colorize(rtbDoc, temp, total);
}
Do you thing something like this would work? Of course I didn't go through the parsing like you did, but you get the main idea here.
Scott P
"Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand
|
|
|
|
|
Yes, I think this will work. I will bang it out later this afternoon, and reply with results.
Thanks much.
Brian
|
|
|
|
|
That worked. Thanks for the help!
|
|
|
|
|
Hi,
Anyone know how to return the username of a running process?
Thanks,
|
|
|
|
|
|
i'm doing a scheduling system for booking venues.now i'm supposed to produce code that checks the availability of a venue and if the venue is not available it must suggest anothr slot within the schedule.
please help me out with pieces of code that i can use in order for my programme to perform this function.
|
|
|
|
|
if(!venue.IsAvailable(requestedTime))
{
DateTime newTime = venue.SuggestTime();
bool userAcceptedNewTime = false;
while(!userAccepedNewTime)
{
userAcceptedNewTime = DisplayTimeSuggestion(newTime);
}
requestedTime = newTime;
}
Simon
|
|
|
|
|
Here you go:
public DateTime FindBookableSlot(DateTime dtChosenSlot)
{
if (!BookSlot(dtChosenSlot))
{
return NextAvailableSlot(dtChosenSlot);
}
return dtChosenSlot;
} Cunningly, BookSlot would book the slot, and NextAvailableSlot will book the next available slot and tell you when it is.
|
|
|
|
|
hi all
i have a problem that how to bind the message digest(i got it through hash operate on the .doc file) to word2007.you know i just develop a project about signature.
appreciate for any reply
|
|
|
|
|
Hello
I'm trying to find out the best method to maintain graphics on a Picture Box
1- During the init process I create an image using a file, adding some draw on it
cityImage = new Bitmap(belFile);
Graphics graphics = Graphics.FromImage(cityImage);
graphics.DrawEllipse(Pens.Red, tX - 1, tY - 1, 2, 2);
this.pb_cont.Image = cityImage;
This will become the "base working image"
Now in another function I create a graphics from the picture box to draw new objects
Graphics graphics = pb_cont.CreateGraphics();<br />
graphics.DrawRectangle(Pens.Black, rX, rY, dX, dY);
But I want to get those object persistant in my PB (not affected by refresh or paint)
AND I also need to be able to get back the "base working image" if needed
How can I do that ?
Thanks for any help
|
|
|
|
|
The easiest way to do this is to implement this graphics item as an object in it's own right, with its own Paint method. Then, in calls to OnPaint on the base graphic, you simply call the Paint method on this object.
|
|
|
|
|
Thank you
But I'm not very comfortable with graphics yet
How can you translate your suggestion with the example I gives ?
Do I have to create two different public images, cloning the base one and assign the one needed to the pb ?
|
|
|
|
|
Hi guys..
I am getting this error at runtime, after a sucessfull compile.
System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidCastException: Unable to cast object of type 'SummaryDataclass[]' to type 'System.Collections.Generic.List`1[Service+SummaryDataclass]'.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write5_ArrayOfSummaryDataclass(Object o)
at Microsoft.Xml.Serialization.GeneratedAssembly.ListOfSummaryDataclassSerializer1.Serialize(Object objectToSerialize, XmlSerializationWriter writer)
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- End of inner exception stack trace ---
The key bits of code are
[WebMethod]<br />
public SummaryDataclass[] GetSummaryDataBeta(string SearchTerm)<br />
{<br />
SummaryDataclass[] summaries = null;<br />
<br />
<br />
summaries = new SummaryDataclass[ds.Tables[0].Rows.Count + SplitSearchTerms.Length];
<br />
<br />
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)<br />
{<br />
summaries[i] = new SummaryDataclass();<br />
summaries[i].Item = ds.Tables[0].Rows[i]["item"] as string;<br />
summaries[i].ItemID = (int)ds.Tables[0].Rows[i]["itemid"];<br />
summaries[i].Count = (int)ds.Tables[0].Rows[i]["tally"];<br />
summaries[i].Validate = ds.Tables[0].Rows[i]["validation"] as string;<br />
}<br />
<br />
<br />
<br />
for (int j = ds.Tables[0].Rows.Count; j < ds.Tables[0].Rows.Count + SplitSearchTerms.Length; j++)<br />
{<br />
summaries[j] = new SummaryDataclass();<br />
summaries[j].Item = SplitSearchTerms[j - ds.Tables[0].Rows.Count];<br />
summaries[j].ItemID = 0;<br />
summaries[j].Count = j;<br />
summaries[j].Validate = "Place " + j.ToString();<br />
}<br />
<br />
}<br />
return summaries;<br />
<br />
}
Does a web service not allow an array of class objects, as its return??
Any help would be apreciated.
|
|
|
|
|
aberbotimue wrote: Does a web service not allow an array of class objects, as its return??
I'm not so sure that would be a problem. But, as the errors say it can't change an array into a list, I don't see that error in the code you posted.
All i can say is that somewhere is expecting a List of SummaryDataClass and your giving it a regular array.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
I've not learnt lists yet!! so no, I hav't used one.. The only code I cut out of the post, was DB access.. I stepped through the code in debug, and it errored when It reached the "return" which is the web service method call, so I didn't call it within code myself..
|
|
|
|
|
Well, my answer seems to be a little... wrong.
But using lists are simple, you use them like this:
List<type of list> myList = new List<type of list>();
So for example you could have a list of strings and then add a string to it:
List<string> stringList = new List<string>();<br />
stringList.Add("Bacon is delicious");
You can get to the string like any other array by using stringList[0]
Lists also have some other usefull stuff, you should check them out some time.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
aberbotimue wrote:
Does a web service not allow an array of class objects, as its return??
Yes it does, I think the problem here is that you've updated the webservice, but have not refreshed the client app using this webservice.
Make sure you compile and run your webservice, then go to the app using this webservice, expand the Web references node, find the relevant service, right click and choose "Update Web Reference".
|
|
|
|
|
This is the message I am getting after I build again, then in the solution explorer, right click on my service.asmx and choose view in browser.. I.e the client is the IDE its self..??
|
|
|
|
|
hi, i want to copy a large file (1 gb) from source to destination using 5 mb buffer size with the help of streaming. can any one help me in this regards?
|
|
|
|
|
Well, you'll have to set up two streams. One to read the file, and one to write to the other.
So simply:
byte buffer = new byte[5335040];
FileStream read = ...;
FileStream write = ...;
int bytesRead = 0;
while(not at end of file)
{
bytesRead = read.Read(buffer, 5335040);
write.Write(buffer, bytesRead);
}
I might have the parameters on the methods a little wrong, but you get the idea right?
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
|
Hi,
I have a datagrid view bound to a List of objects implementing INotifyPropertyChanged. One of the object's properties is an enumeration, which I want to bind to a DataGridViewComboBoxColumn so that the user can change it's value.
The problem is that if I bind it to the enumeration property, it will only show the enumeration value it's initialized at. I've found many examples stating you should set the combobox's DataSource property to <code>Enum.GetValues(typeof(EnumerationType));</code> This shows all values in the combobox, but I don't see the point: It won't bind its values to my actual data source.
Example:
<pre>
public class Dinges : INotifyPropertyChanged
{
public enum tester
{
apple = 1, pear = 2, banana = 3
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
private tester enumerationtest = tester.apple;
public tester MyProperty
{
get { return enumerationtest; }
set
{
enumerationtest = value;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("MyProperty"));
}
}
}
public class DingesList : List<Dinges>
{
public DingesList()
{
this.Add(new Dinges());
}
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
DingesList d = new DingesList();
dingesListBindingSource.DataSource = d;
dataGridView1.DataSource = dingesListBindingSource;
// this results in the combobox in my datagrid showing "apple" as a value and no other options to choose from
// option 2 displays all possible values, but isn't bound to the actual object
comboColumn.DataSource = Enum.GetValues(typeof(WindowsApplication1.Dinges.tester));
}
}
</pre>
Any help is greatly appreciated.
Standards are great! Everybody should have one!
|
|
|
|