473,327 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Trim a multiple line message to a single line

This is an example of the data;

2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002 404.2.01 (6511)
RX 74 bytes
2007/07/27 11:00:03 [153006] 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13
48
2007/07/27 11:00:03 [153006] 52 00 52 02 02 C7 83 D7 07 07 1B 0B 00 00 00
00
2007/07/27 11:00:03 [153006] 28 0A 06 06 06 06 06 06 06 06 06 06 06 0A 06
06
2007/07/27 11:00:03 [153006] 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06
06
2007/07/27 11:00:03 [153006] 06 06 06 06 06 06 06 06 06 40
The Date/Time and [] information are the same for this one item.

I want to strip off all of the Date/Time and extra [] info and make one big
line.

Any help appreciated.
Aug 2 '07 #1
19 2414
Hello Brian,
2007/07/27 11:00:03 [153006]
My guess is that these aren't the same length for every line. If they were
it would be easy:

regex = "^.{num}";
input = "...";
replacement = "";
result = Regex.Replace(regex, input, replacement, RegexOptions.MultiLine);

If the part between [] is variable in length you'd have to choose a more
advanced way:

^[^\[]+\[[^\]]+\]

It's hard to read. But essentially it says:
^ start at the beginning of a line
[^\[]+ get everything that is not a [
\[ get the opening [
[^\]]+ get everything that is not a ]
\] get the closing ]

and replace that with an empty string.

should do the job.

Another option is to construct a strignbuilder, readline every line of the
original input, use substring of the first ] to chop of the first part and
add the resulting string to the stringbuilder.

The first solution (regex) is shorter and once you understand the regex easy
to understand and maintain.
The second solution (stringbuilder) is a bit more complex in lines of code,
easier to understand if you're not used to regex and probably a tad faster.

Jesse
Aug 2 '07 #2
Jesse the data inside of the [] is static six digits for each line.

The total number of lines may vary anywhere from one to as much as 8 lines
of data.

The line should look like this when pieced together;

2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002 404.2.01 (6511)
RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48 52 00 52 02 02
C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06 06 06 06 06 06 0A 06
06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
06 40

All in one big line without word wrap.

The next entry would be a different header (ARES_INDICATION for example).
"Jesse Houwing" wrote:
Hello Brian,
2007/07/27 11:00:03 [153006]

My guess is that these aren't the same length for every line. If they were
it would be easy:

regex = "^.{num}";
input = "...";
replacement = "";
result = Regex.Replace(regex, input, replacement, RegexOptions.MultiLine);

If the part between [] is variable in length you'd have to choose a more
advanced way:

^[^\[]+\[[^\]]+\]

It's hard to read. But essentially it says:
^ start at the beginning of a line
[^\[]+ get everything that is not a [
\[ get the opening [
[^\]]+ get everything that is not a ]
\] get the closing ]

and replace that with an empty string.

should do the job.

Another option is to construct a strignbuilder, readline every line of the
original input, use substring of the first ] to chop of the first part and
add the resulting string to the stringbuilder.

The first solution (regex) is shorter and once you understand the regex easy
to understand and maintain.
The second solution (stringbuilder) is a bit more complex in lines of code,
easier to understand if you're not used to regex and probably a tad faster.

Jesse

Aug 2 '07 #3
Hello Brian,

Could you send a sample file with two of these data blocks f what they should
look like and how you receive them directly to my email? I'll reply back
to this thread with a solution when I have time to go over it. My newsreader
keeps messing up your samples, so it would be easier if I had two text files.
Jesse

Jesse the data inside of the [] is static six digits for each line.

The total number of lines may vary anywhere from one to as much as 8
lines of data.

The line should look like this when pieced together;

2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002 404.2.01
(6511)
RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48 52 00 52
02 02
C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06 06 06 06 06
06 0A 06
06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
06 06 06 40

All in one big line without word wrap.

The next entry would be a different header (ARES_INDICATION for
example).

"Jesse Houwing" wrote:
>Hello Brian,
>>2007/07/27 11:00:03 [153006]
My guess is that these aren't the same length for every line. If they
were it would be easy:

regex = "^.{num}";
input = "...";
replacement = "";
result = Regex.Replace(regex, input, replacement,
RegexOptions.MultiLine);
If the part between [] is variable in length you'd have to choose a
more advanced way:

^[^\[]+\[[^\]]+\]

It's hard to read. But essentially it says:
^ start at the beginning of a line
[^\[]+ get everything that is not a [
\[ get the opening [
[^\]]+ get everything that is not a ]
\] get the closing ]
and replace that with an empty string.

should do the job.

Another option is to construct a strignbuilder, readline every line
of the original input, use substring of the first ] to chop of the
first part and add the resulting string to the stringbuilder.

The first solution (regex) is shorter and once you understand the
regex easy
to understand and maintain.
The second solution (stringbuilder) is a bit more complex in lines of
code,
easier to understand if you're not used to regex and probably a tad
faster.
Jesse

Aug 2 '07 #4
Sent you an email with a sampling.

"Jesse Houwing" wrote:
Hello Brian,

Could you send a sample file with two of these data blocks f what they should
look like and how you receive them directly to my email? I'll reply back
to this thread with a solution when I have time to go over it. My newsreader
keeps messing up your samples, so it would be easier if I had two text files.
Jesse

Jesse the data inside of the [] is static six digits for each line.

The total number of lines may vary anywhere from one to as much as 8
lines of data.

The line should look like this when pieced together;

2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002 404.2.01
(6511)
RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48 52 00 52
02 02
C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06 06 06 06 06
06 0A 06
06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
06 06 06 40

All in one big line without word wrap.

The next entry would be a different header (ARES_INDICATION for
example).

"Jesse Houwing" wrote:
Hello Brian,

2007/07/27 11:00:03 [153006]

My guess is that these aren't the same length for every line. If they
were it would be easy:

regex = "^.{num}";
input = "...";
replacement = "";
result = Regex.Replace(regex, input, replacement,
RegexOptions.MultiLine);
If the part between [] is variable in length you'd have to choose a
more advanced way:

^[^\[]+\[[^\]]+\]

It's hard to read. But essentially it says:
^ start at the beginning of a line
[^\[]+ get everything that is not a [
\[ get the opening [
[^\]]+ get everything that is not a ]
\] get the closing ]
and replace that with an empty string.

should do the job.

Another option is to construct a strignbuilder, readline every line
of the original input, use substring of the first ] to chop of the
first part and add the resulting string to the stringbuilder.

The first solution (regex) is shorter and once you understand the
regex easy
to understand and maintain.
The second solution (stringbuilder) is a bit more complex in lines of
code,
easier to understand if you're not used to regex and probably a tad
faster.
Jesse


Aug 2 '07 #5
Hello Brian,

You can do this quite easily with either a regex or a simple function I'll
try to demonstrate both:

basically you need a regex that matches the \r\ndate+time+[number] that is
followed by two spaces and replace it with a space

so the regex looks like this (I simplified it a bit, but given the fact that
all the lines are very well layed out I don't thing you have to make it more
differcult :).

\r\n[^\]]+\][ ]{2}

now replace this by " " and you're all set.

So:
private static Regex _rx = new Regex(@"\r\n[^\]]+\][ ]{2}", RegexOptions.Compiled);

private string LayoutInput(string input)
{
return _rx.Replace(input, " ");
}

Or you could use a StringReader/StringBuilder combination:

private string LayoutInput(string input)
{
StringReader sr = new StringReader(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine())!= null)
{
if (line.Length < 29) { throw new InvalidOperationException("invalid
input"); /* or simply continue; */ }

if (line[29] != ' ')
{
if (sb.Length 0)
{
sb.Append("\r\n");
}
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
return sb.ToString();
}

I haven't used much error checking to make sure the format is correct. But
I think you can go on from here.

Jesse
Sent you an email with a sampling.

"Jesse Houwing" wrote:
>Hello Brian,

Could you send a sample file with two of these data blocks f what
they should look like and how you receive them directly to my email?
I'll reply back to this thread with a solution when I have time to go
over it. My newsreader keeps messing up your samples, so it would be
easier if I had two text files.

Jesse
>>Jesse the data inside of the [] is static six digits for each line.

The total number of lines may vary anywhere from one to as much as 8
lines of data.

The line should look like this when pieced together;

2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002
404.2.01
(6511)
RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48 52 00
52
02 02
C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06 06 06 06 06
06 0A 06
06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
06
06 06 06 40
All in one big line without word wrap.

The next entry would be a different header (ARES_INDICATION for
example).

"Jesse Houwing" wrote:

Hello Brian,

2007/07/27 11:00:03 [153006]
>
My guess is that these aren't the same length for every line. If
they were it would be easy:

regex = "^.{num}";
input = "...";
replacement = "";
result = Regex.Replace(regex, input, replacement,
RegexOptions.MultiLine);
If the part between [] is variable in length you'd have to choose a
more advanced way:
^[^\[]+\[[^\]]+\]

It's hard to read. But essentially it says:
^ start at the beginning of a line
[^\[]+ get everything that is not a [
\[ get the opening [
[^\]]+ get everything that is not a ]
\] get the closing ]
and replace that with an empty string.
should do the job.

Another option is to construct a strignbuilder, readline every line
of the original input, use substring of the first ] to chop of the
first part and add the resulting string to the stringbuilder.

The first solution (regex) is shorter and once you understand the
regex easy
to understand and maintain.
The second solution (stringbuilder) is a bit more complex in lines
of
code,
easier to understand if you're not used to regex and probably a tad
faster.
Jesse

Aug 2 '07 #6
Thank you Jesse, that will help a bunch. I have C# classes scheduled
Aug/Sep/Oct so that I can try to avoid more questions in the future.

V/R

Brian

"Jesse Houwing" wrote:
Hello Brian,

You can do this quite easily with either a regex or a simple function I'll
try to demonstrate both:

basically you need a regex that matches the \r\ndate+time+[number] that is
followed by two spaces and replace it with a space

so the regex looks like this (I simplified it a bit, but given the fact that
all the lines are very well layed out I don't thing you have to make it more
differcult :).

\r\n[^\]]+\][ ]{2}

now replace this by " " and you're all set.

So:
private static Regex _rx = new Regex(@"\r\n[^\]]+\][ ]{2}", RegexOptions.Compiled);

private string LayoutInput(string input)
{
return _rx.Replace(input, " ");
}

Or you could use a StringReader/StringBuilder combination:

private string LayoutInput(string input)
{
StringReader sr = new StringReader(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine())!= null)
{
if (line.Length < 29) { throw new InvalidOperationException("invalid
input"); /* or simply continue; */ }

if (line[29] != ' ')
{
if (sb.Length 0)
{
sb.Append("\r\n");
}
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
return sb.ToString();
}

I haven't used much error checking to make sure the format is correct. But
I think you can go on from here.

Jesse
Sent you an email with a sampling.

"Jesse Houwing" wrote:
Hello Brian,

Could you send a sample file with two of these data blocks f what
they should look like and how you receive them directly to my email?
I'll reply back to this thread with a solution when I have time to go
over it. My newsreader keeps messing up your samples, so it would be
easier if I had two text files.

Jesse

Jesse the data inside of the [] is static six digits for each line.

The total number of lines may vary anywhere from one to as much as 8
lines of data.

The line should look like this when pieced together;

2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002
404.2.01
(6511)
RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48 52 00
52
02 02
C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06 06 06 06 06
06 0A 06
06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06 06 06 06
06
06 06 06 40
All in one big line without word wrap.

The next entry would be a different header (ARES_INDICATION for
example).

"Jesse Houwing" wrote:

Hello Brian,

2007/07/27 11:00:03 [153006]

My guess is that these aren't the same length for every line. If
they were it would be easy:

regex = "^.{num}";
input = "...";
replacement = "";
result = Regex.Replace(regex, input, replacement,
RegexOptions.MultiLine);
If the part between [] is variable in length you'd have to choose a
more advanced way:
^[^\[]+\[[^\]]+\]

It's hard to read. But essentially it says:
^ start at the beginning of a line
[^\[]+ get everything that is not a [
\[ get the opening [
[^\]]+ get everything that is not a ]
\] get the closing ]
and replace that with an empty string.
should do the job.

Another option is to construct a strignbuilder, readline every line
of the original input, use substring of the first ] to chop of the
first part and add the resulting string to the stringbuilder.

The first solution (regex) is shorter and once you understand the
regex easy
to understand and maintain.
The second solution (stringbuilder) is a bit more complex in lines
of
code,
easier to understand if you're not used to regex and probably a tad
faster.
Jesse


Aug 2 '07 #7
Hello Brian,
Thank you Jesse, that will help a bunch. I have C# classes scheduled
Aug/Sep/Oct so that I can try to avoid more questions in the future.
You're very welcome and don't hesitate to ask questions that is what these
newsgroups are for after all. Just make sure you've tried ;)

Jesse

>
V/R

Brian

"Jesse Houwing" wrote:
>Hello Brian,

You can do this quite easily with either a regex or a simple function
I'll try to demonstrate both:

basically you need a regex that matches the \r\ndate+time+[number]
that is followed by two spaces and replace it with a space

so the regex looks like this (I simplified it a bit, but given the
fact that all the lines are very well layed out I don't thing you
have to make it more differcult :).

\r\n[^\]]+\][ ]{2}

now replace this by " " and you're all set.

So:
private static Regex _rx = new Regex(@"\r\n[^\]]+\][ ]{2}",
RegexOptions.Compiled);
private string LayoutInput(string input)
{
return _rx.Replace(input, " ");
}
Or you could use a StringReader/StringBuilder combination:

private string LayoutInput(string input)
{
StringReader sr = new StringReader(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine())!= null)
{
if (line.Length < 29) { throw new InvalidOperationException("invalid
input"); /* or simply continue; */ }
if (line[29] != ' ')
{
if (sb.Length 0)
{
sb.Append("\r\n");
}
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
return sb.ToString();
}
I haven't used much error checking to make sure the format is
correct. But I think you can go on from here.

Jesse
>>Sent you an email with a sampling.

"Jesse Houwing" wrote:

Hello Brian,

Could you send a sample file with two of these data blocks f what
they should look like and how you receive them directly to my
email? I'll reply back to this thread with a solution when I have
time to go over it. My newsreader keeps messing up your samples, so
it would be easier if I had two text files.

Jesse

Jesse the data inside of the [] is static six digits for each
line.
>
The total number of lines may vary anywhere from one to as much as
8 lines of data.
>
The line should look like this when pieced together;
>
2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002
404.2.01
(6511)
RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48 52 00
52
02 02
C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06 06 06 06
06
06 0A 06
06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06 06 06
06
06
06 06 06 40
All in one big line without word wrap.
The next entry would be a different header (ARES_INDICATION for
example).
>
"Jesse Houwing" wrote:
>
>Hello Brian,
>>
>>2007/07/27 11:00:03 [153006]
>>>
>My guess is that these aren't the same length for every line. If
>they were it would be easy:
>>
>regex = "^.{num}";
>input = "...";
>replacement = "";
>result = Regex.Replace(regex, input, replacement,
>RegexOptions.MultiLine);
>If the part between [] is variable in length you'd have to choose
>a
>more advanced way:
>^[^\[]+\[[^\]]+\]
>It's hard to read. But essentially it says:
>^ start at the beginning of a line
>[^\[]+ get everything that is not a [
>\[ get the opening [
>[^\]]+ get everything that is not a ]
>\] get the closing ]
>and replace that with an empty string.
>should do the job.
>Another option is to construct a strignbuilder, readline every
>line of the original input, use substring of the first ] to chop
>of the first part and add the resulting string to the
>stringbuilder.
>>
>The first solution (regex) is shorter and once you understand the
>regex easy
>to understand and maintain.
>The second solution (stringbuilder) is a bit more complex in
>lines
>of
>code,
>easier to understand if you're not used to regex and probably a
>tad
>faster.
>Jesse

Aug 2 '07 #8
Ok, Jessee, I have a new Wrinkle for you.

Lets say I want a specific hex pair highlighted in Blue on every line that
starts out with ARES_INDICATION or ARES_EINDICATION.

It would be the 34 item from the left.

If you have the Example.txt I emailed you, the last line in the how I want
it to look the field would the C7 that follows the 02 02 hex.

If not I can send it to you again.

"Jesse Houwing" wrote:
Hello Brian,
Thank you Jesse, that will help a bunch. I have C# classes scheduled
Aug/Sep/Oct so that I can try to avoid more questions in the future.

You're very welcome and don't hesitate to ask questions that is what these
newsgroups are for after all. Just make sure you've tried ;)

Jesse


V/R

Brian

"Jesse Houwing" wrote:
Hello Brian,

You can do this quite easily with either a regex or a simple function
I'll try to demonstrate both:

basically you need a regex that matches the \r\ndate+time+[number]
that is followed by two spaces and replace it with a space

so the regex looks like this (I simplified it a bit, but given the
fact that all the lines are very well layed out I don't thing you
have to make it more differcult :).

\r\n[^\]]+\][ ]{2}

now replace this by " " and you're all set.

So:
private static Regex _rx = new Regex(@"\r\n[^\]]+\][ ]{2}",
RegexOptions.Compiled);
private string LayoutInput(string input)
{
return _rx.Replace(input, " ");
}
Or you could use a StringReader/StringBuilder combination:

private string LayoutInput(string input)
{
StringReader sr = new StringReader(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine())!= null)
{
if (line.Length < 29) { throw new InvalidOperationException("invalid
input"); /* or simply continue; */ }
if (line[29] != ' ')
{
if (sb.Length 0)
{
sb.Append("\r\n");
}
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
return sb.ToString();
}
I haven't used much error checking to make sure the format is
correct. But I think you can go on from here.

Jesse

Sent you an email with a sampling.

"Jesse Houwing" wrote:

Hello Brian,

Could you send a sample file with two of these data blocks f what
they should look like and how you receive them directly to my
email? I'll reply back to this thread with a solution when I have
time to go over it. My newsreader keeps messing up your samples, so
it would be easier if I had two text files.

Jesse

Jesse the data inside of the [] is static six digits for each
line.

The total number of lines may vary anywhere from one to as much as
8 lines of data.

The line should look like this when pieced together;

2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002
404.2.01
(6511)
RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48 52 00
52
02 02
C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06 06 06 06
06
06 0A 06
06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06 06 06
06
06
06 06 06 40
All in one big line without word wrap.
The next entry would be a different header (ARES_INDICATION for
example).

"Jesse Houwing" wrote:

Hello Brian,
>
>2007/07/27 11:00:03 [153006]
>>
My guess is that these aren't the same length for every line. If
they were it would be easy:
>
regex = "^.{num}";
input = "...";
replacement = "";
result = Regex.Replace(regex, input, replacement,
RegexOptions.MultiLine);
If the part between [] is variable in length you'd have to choose
a
more advanced way:
^[^\[]+\[[^\]]+\]
It's hard to read. But essentially it says:
^ start at the beginning of a line
[^\[]+ get everything that is not a [
\[ get the opening [
[^\]]+ get everything that is not a ]
\] get the closing ]
and replace that with an empty string.
should do the job.
Another option is to construct a strignbuilder, readline every
line of the original input, use substring of the first ] to chop
of the first part and add the resulting string to the
stringbuilder.
>
The first solution (regex) is shorter and once you understand the
regex easy
to understand and maintain.
The second solution (stringbuilder) is a bit more complex in
lines
of
code,
easier to understand if you're not used to regex and probably a
tad
faster.
Jesse


Aug 3 '07 #9
Hello Brian,

Did you go for the regex or the stringbuilder solution?

Jesse
Ok, Jessee, I have a new Wrinkle for you.

Lets say I want a specific hex pair highlighted in Blue on every line
that starts out with ARES_INDICATION or ARES_EINDICATION.

It would be the 34 item from the left.

If you have the Example.txt I emailed you, the last line in the how I
want it to look the field would the C7 that follows the 02 02 hex.

If not I can send it to you again.

"Jesse Houwing" wrote:
>Hello Brian,
>>Thank you Jesse, that will help a bunch. I have C# classes scheduled
Aug/Sep/Oct so that I can try to avoid more questions in the future.
You're very welcome and don't hesitate to ask questions that is what
these newsgroups are for after all. Just make sure you've tried ;)

Jesse
>>V/R

Brian

"Jesse Houwing" wrote:

Hello Brian,

You can do this quite easily with either a regex or a simple
function I'll try to demonstrate both:

basically you need a regex that matches the \r\ndate+time+[number]
that is followed by two spaces and replace it with a space

so the regex looks like this (I simplified it a bit, but given the
fact that all the lines are very well layed out I don't thing you
have to make it more differcult :).

\r\n[^\]]+\][ ]{2}

now replace this by " " and you're all set.

So:
private static Regex _rx = new Regex(@"\r\n[^\]]+\][ ]{2}",
RegexOptions.Compiled);
private string LayoutInput(string input)
{
return _rx.Replace(input, " ");
}
Or you could use a StringReader/StringBuilder combination:
private string LayoutInput(string input)
{
StringReader sr = new StringReader(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine())!= null)
{
if (line.Length < 29) { throw new
InvalidOperationException("invalid
input"); /* or simply continue; */ }
if (line[29] != ' ')
{
if (sb.Length 0)
{
sb.Append("\r\n");
}
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
return sb.ToString();
}
I haven't used much error checking to make sure the format is
correct. But I think you can go on from here.
Jesse

Sent you an email with a sampling.
>
"Jesse Houwing" wrote:
>
>Hello Brian,
>>
>Could you send a sample file with two of these data blocks f what
>they should look like and how you receive them directly to my
>email? I'll reply back to this thread with a solution when I have
>time to go over it. My newsreader keeps messing up your samples,
>so it would be easier if I had two text files.
>>
>Jesse
>>
>>Jesse the data inside of the [] is static six digits for each
>>line.
>>>
>>The total number of lines may vary anywhere from one to as much
>>as 8 lines of data.
>>>
>>The line should look like this when pieced together;
>>>
>>2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002
>>404.2.01
>>(6511)
>>RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48 52
>>00
>>52
>>02 02
>>C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06 06 06
>>06
>>06
>>06 0A 06
>>06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06 06 06
>>06
>>06
>>06 06 06 40
>>All in one big line without word wrap.
>>The next entry would be a different header (ARES_INDICATION for
>>example).
>>"Jesse Houwing" wrote:
>>>
>>>Hello Brian,
>>>>
>>>>2007/07/27 11:00:03 [153006]
>>>>>
>>>My guess is that these aren't the same length for every line.
>>>If they were it would be easy:
>>>>
>>>regex = "^.{num}";
>>>input = "...";
>>>replacement = "";
>>>result = Regex.Replace(regex, input, replacement,
>>>RegexOptions.MultiLine);
>>>If the part between [] is variable in length you'd have to
>>>choose
>>>a
>>>more advanced way:
>>>^[^\[]+\[[^\]]+\]
>>>It's hard to read. But essentially it says:
>>>^ start at the beginning of a line
>>>[^\[]+ get everything that is not a [
>>>\[ get the opening [
>>>[^\]]+ get everything that is not a ]
>>>\] get the closing ]
>>>and replace that with an empty string.
>>>should do the job.
>>>Another option is to construct a strignbuilder, readline every
>>>line of the original input, use substring of the first ] to
>>>chop
>>>of the first part and add the resulting string to the
>>>stringbuilder.
>>>The first solution (regex) is shorter and once you understand
>>>the
>>>regex easy
>>>to understand and maintain.
>>>The second solution (stringbuilder) is a bit more complex in
>>>lines
>>>of
>>>code,
>>>easier to understand if you're not used to regex and probably a
>>>tad
>>>faster.
>>>Jesse

Aug 3 '07 #10
I wnt with the Stringbuilder solution. It seemed easier to follow to me than
the Regex one.

"Jesse Houwing" wrote:
Hello Brian,

Did you go for the regex or the stringbuilder solution?

Jesse
Ok, Jessee, I have a new Wrinkle for you.

Lets say I want a specific hex pair highlighted in Blue on every line
that starts out with ARES_INDICATION or ARES_EINDICATION.

It would be the 34 item from the left.

If you have the Example.txt I emailed you, the last line in the how I
want it to look the field would the C7 that follows the 02 02 hex.

If not I can send it to you again.

"Jesse Houwing" wrote:
Hello Brian,

Thank you Jesse, that will help a bunch. I have C# classes scheduled
Aug/Sep/Oct so that I can try to avoid more questions in the future.

You're very welcome and don't hesitate to ask questions that is what
these newsgroups are for after all. Just make sure you've tried ;)

Jesse

V/R

Brian

"Jesse Houwing" wrote:

Hello Brian,

You can do this quite easily with either a regex or a simple
function I'll try to demonstrate both:

basically you need a regex that matches the \r\ndate+time+[number]
that is followed by two spaces and replace it with a space

so the regex looks like this (I simplified it a bit, but given the
fact that all the lines are very well layed out I don't thing you
have to make it more differcult :).

\r\n[^\]]+\][ ]{2}

now replace this by " " and you're all set.

So:
private static Regex _rx = new Regex(@"\r\n[^\]]+\][ ]{2}",
RegexOptions.Compiled);
private string LayoutInput(string input)
{
return _rx.Replace(input, " ");
}
Or you could use a StringReader/StringBuilder combination:
private string LayoutInput(string input)
{
StringReader sr = new StringReader(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine())!= null)
{
if (line.Length < 29) { throw new
InvalidOperationException("invalid
input"); /* or simply continue; */ }
if (line[29] != ' ')
{
if (sb.Length 0)
{
sb.Append("\r\n");
}
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
return sb.ToString();
}
I haven't used much error checking to make sure the format is
correct. But I think you can go on from here.
Jesse

Sent you an email with a sampling.

"Jesse Houwing" wrote:

Hello Brian,
>
Could you send a sample file with two of these data blocks f what
they should look like and how you receive them directly to my
email? I'll reply back to this thread with a solution when I have
time to go over it. My newsreader keeps messing up your samples,
so it would be easier if I had two text files.
>
Jesse
>
>Jesse the data inside of the [] is static six digits for each
>line.
>>
>The total number of lines may vary anywhere from one to as much
>as 8 lines of data.
>>
>The line should look like this when pieced together;
>>
>2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002
>404.2.01
>(6511)
>RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48 52
>00
>52
>02 02
>C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06 06 06
>06
>06
>06 0A 06
>06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06 06 06
>06
>06
>06 06 06 40
>All in one big line without word wrap.
>The next entry would be a different header (ARES_INDICATION for
>example).
>"Jesse Houwing" wrote:
>>
>>Hello Brian,
>>>
>>>2007/07/27 11:00:03 [153006]
>>>>
>>My guess is that these aren't the same length for every line.
>>If they were it would be easy:
>>>
>>regex = "^.{num}";
>>input = "...";
>>replacement = "";
>>result = Regex.Replace(regex, input, replacement,
>>RegexOptions.MultiLine);
>>If the part between [] is variable in length you'd have to
>>choose
>>a
>>more advanced way:
>>^[^\[]+\[[^\]]+\]
>>It's hard to read. But essentially it says:
>>^ start at the beginning of a line
>>[^\[]+ get everything that is not a [
>>\[ get the opening [
>>[^\]]+ get everything that is not a ]
>>\] get the closing ]
>>and replace that with an empty string.
>>should do the job.
>>Another option is to construct a strignbuilder, readline every
>>line of the original input, use substring of the first ] to
>>chop
>>of the first part and add the resulting string to the
>>stringbuilder.
>>The first solution (regex) is shorter and once you understand
>>the
>>regex easy
>>to understand and maintain.
>>The second solution (stringbuilder) is a bit more complex in
>>lines
>>of
>>code,
>>easier to understand if you're not used to regex and probably a
>>tad
>>faster.
>>Jesse


Aug 3 '07 #11
Hello Brian,

I have no clue how to give text a different colour. I am sure though that
you would need to use a RichTextBox. I'd guess you'd have to insert some
RTF control characters. Where to insert them would be easy to find out if
it's always the 34th Hex pair.

private string LayoutInput(string input)
{
StringReader sr = new StringReader(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine())!= null)
{
if (line.Length < 29) { throw new InvalidOperationException("invalid
input"); }
if (line[29] != ' ')
{
// This is the line that holds the type
if (line.SubString(29).StartsWith("ARES_"))
{
// find the position of the 34th pair. That would
be right behind the 34th space following ARES_
// Alternatively, you could hardcode this position,
this is more flexible
int pos = 29;
for (int i = 0; i < 34 && pos < line.Length; i++)
{
pos = line.Substring(pos).IndexOf(' ', pos);
}
// If a pair was found 34 pairs out
if (pos 29)
{
sb.Append(line.Substring(0, pos)); // Add everything
up to the place we need to insert the control characters
sb.Append(/*control characters to change the color*/);
sb.Append(line.Substring(pos, 2)); // Add the
HEX pair
sb.Append(/*control characters to reset the color*/);
sb.Append(line.Substring(pos + 2)); // Add the
remainder of the string
continue;
}
// Otherwise just fall throught o the default behaviour...
}
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
}

It's all in one function now, but I'd place the extra checks in a subfunction
should they grow any further.

I tried to find a string function that automatically gives the xth position
of a substring (IndexOf(what, from, count, number) but I couldn't find it...
too bad ;)).
Again you could use a regex for this...

Regex.Replace("(?<base>ARES_(\S+\s){34})(?<hexpair >[A-F0-9]{2})", "$1" +
"control character for colour" + "$2" + "control character for normal colour");

It's actually easier for me to read than the function above, but that is
partly due to the fact that I'm presenting courses in .NET Regular Expressions
as part of my job.

Jesse
I wnt with the Stringbuilder solution. It seemed easier to follow to
me than the Regex one.

"Jesse Houwing" wrote:
>Hello Brian,

Did you go for the regex or the stringbuilder solution?

Jesse
>>Ok, Jessee, I have a new Wrinkle for you.

Lets say I want a specific hex pair highlighted in Blue on every
line that starts out with ARES_INDICATION or ARES_EINDICATION.

It would be the 34 item from the left.

If you have the Example.txt I emailed you, the last line in the how
I want it to look the field would the C7 that follows the 02 02 hex.

If not I can send it to you again.

"Jesse Houwing" wrote:

Hello Brian,

Thank you Jesse, that will help a bunch. I have C# classes
scheduled Aug/Sep/Oct so that I can try to avoid more questions in
the future.
>
You're very welcome and don't hesitate to ask questions that is
what these newsgroups are for after all. Just make sure you've
tried ;)

Jesse

V/R
>
Brian
>
"Jesse Houwing" wrote:
>
>Hello Brian,
>>
>You can do this quite easily with either a regex or a simple
>function I'll try to demonstrate both:
>>
>basically you need a regex that matches the
>\r\ndate+time+[number] that is followed by two spaces and replace
>it with a space
>>
>so the regex looks like this (I simplified it a bit, but given
>the fact that all the lines are very well layed out I don't thing
>you have to make it more differcult :).
>>
>\r\n[^\]]+\][ ]{2}
>>
>now replace this by " " and you're all set.
>>
>So:
>private static Regex _rx = new Regex(@"\r\n[^\]]+\][ ]{2}",
>RegexOptions.Compiled);
>private string LayoutInput(string input)
>{
>return _rx.Replace(input, " ");
>}
>Or you could use a StringReader/StringBuilder combination:
>private string LayoutInput(string input)
>{
>StringReader sr = new StringReader(input);
>StringBuilder sb = new StringBuilder(input.Length);
>string line;
>while ((line = sr.ReadLine())!= null)
>{
>if (line.Length < 29) { throw new
>InvalidOperationException("invalid
>input"); /* or simply continue; */ }
>if (line[29] != ' ')
>{
>if (sb.Length 0)
>{
>sb.Append("\r\n");
>}
>sb.Append(line);
>}
>else
>{
>sb.Append(line.Substring(30));
>}
>}
>return sb.ToString();
>}
>I haven't used much error checking to make sure the format is
>correct. But I think you can go on from here.
>Jesse
>>Sent you an email with a sampling.
>>>
>>"Jesse Houwing" wrote:
>>>
>>>Hello Brian,
>>>>
>>>Could you send a sample file with two of these data blocks f
>>>what they should look like and how you receive them directly to
>>>my email? I'll reply back to this thread with a solution when I
>>>have time to go over it. My newsreader keeps messing up your
>>>samples, so it would be easier if I had two text files.
>>>>
>>>Jesse
>>>>
>>>>Jesse the data inside of the [] is static six digits for each
>>>>line.
>>>>>
>>>>The total number of lines may vary anywhere from one to as
>>>>much as 8 lines of data.
>>>>>
>>>>The line should look like this when pieced together;
>>>>>
>>>>2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002
>>>>404.2.01
>>>>(6511)
>>>>RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48
>>>>52
>>>>00
>>>>52
>>>>02 02
>>>>C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06 06 06
>>>>06
>>>>06
>>>>06 0A 06
>>>>06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06 06
>>>>06
>>>>06
>>>>06
>>>>06 06 06 40
>>>>All in one big line without word wrap.
>>>>The next entry would be a different header (ARES_INDICATION
>>>>for
>>>>example).
>>>>"Jesse Houwing" wrote:
>>>>>Hello Brian,
>>>>>>
>>>>>>2007/07/27 11:00:03 [153006]
>>>>>>>
>>>>>My guess is that these aren't the same length for every line.
>>>>>If they were it would be easy:
>>>>>>
>>>>>regex = "^.{num}";
>>>>>input = "...";
>>>>>replacement = "";
>>>>>result = Regex.Replace(regex, input, replacement,
>>>>>RegexOptions.MultiLine);
>>>>>If the part between [] is variable in length you'd have to
>>>>>choose
>>>>>a
>>>>>more advanced way:
>>>>>^[^\[]+\[[^\]]+\]
>>>>>It's hard to read. But essentially it says:
>>>>>^ start at the beginning of a line
>>>>>[^\[]+ get everything that is not a [
>>>>>\[ get the opening [
>>>>>[^\]]+ get everything that is not a ]
>>>>>\] get the closing ]
>>>>>and replace that with an empty string.
>>>>>should do the job.
>>>>>Another option is to construct a strignbuilder, readline
>>>>>every
>>>>>line of the original input, use substring of the first ] to
>>>>>chop
>>>>>of the first part and add the resulting string to the
>>>>>stringbuilder.
>>>>>The first solution (regex) is shorter and once you understand
>>>>>the
>>>>>regex easy
>>>>>to understand and maintain.
>>>>>The second solution (stringbuilder) is a bit more complex in
>>>>>lines
>>>>>of
>>>>>code,
>>>>>easier to understand if you're not used to regex and probably
>>>>>a
>>>>>tad
>>>>>faster.
>>>>>Jesse

Aug 3 '07 #12
Jesse, I appreciate all your help so far, and have now come up with something
I am once again unsure how to fix.;

In the Example.txt file I sent you, when the lines are combined into one
they are a little jumbled. I would like to format the line so that the RX and
TX portion all start at the 78th position from the left. Everything to the
left of that would never go past the 75th position.

I know that I can perform a StringBuilder.Insert, just not sure how or where
to add it into this code.

Here is the code for what we made work.
---begin code---
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace DatReader
{
class Streamer
{
public static string LayoutInput(string input)
{
StreamReader sr = File.OpenText(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine()) != null)
{
if (line.Length < 29) { throw new
InvalidOperationException("invalid input"); }
if (line[29] != ' ')

{
sb.Append("\r\n");
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
return sb.ToString();
}
}
}
---end code---

Thanks,

"Jesse Houwing" wrote:
Hello Brian,

I have no clue how to give text a different colour. I am sure though that
you would need to use a RichTextBox. I'd guess you'd have to insert some
RTF control characters. Where to insert them would be easy to find out if
it's always the 34th Hex pair.

private string LayoutInput(string input)
{
StringReader sr = new StringReader(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine())!= null)
{
if (line.Length < 29) { throw new InvalidOperationException("invalid
input"); }
if (line[29] != ' ')
{
// This is the line that holds the type
if (line.SubString(29).StartsWith("ARES_"))
{
// find the position of the 34th pair. That would
be right behind the 34th space following ARES_
// Alternatively, you could hardcode this position,
this is more flexible
int pos = 29;
for (int i = 0; i < 34 && pos < line.Length; i++)
{
pos = line.Substring(pos).IndexOf(' ', pos);
}
// If a pair was found 34 pairs out
if (pos 29)
{
sb.Append(line.Substring(0, pos)); // Add everything
up to the place we need to insert the control characters
sb.Append(/*control characters to change the color*/);
sb.Append(line.Substring(pos, 2)); // Add the
HEX pair
sb.Append(/*control characters to reset the color*/);
sb.Append(line.Substring(pos + 2)); // Add the
remainder of the string
continue;
}
// Otherwise just fall throught o the default behaviour...
}
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
}

It's all in one function now, but I'd place the extra checks in a subfunction
should they grow any further.

I tried to find a string function that automatically gives the xth position
of a substring (IndexOf(what, from, count, number) but I couldn't find it...
too bad ;)).
Again you could use a regex for this...

Regex.Replace("(?<base>ARES_(\S+\s){34})(?<hexpair >[A-F0-9]{2})", "$1" +
"control character for colour" + "$2" + "control character for normal colour");

It's actually easier for me to read than the function above, but that is
partly due to the fact that I'm presenting courses in .NET Regular Expressions
as part of my job.

Jesse
I wnt with the Stringbuilder solution. It seemed easier to follow to
me than the Regex one.

"Jesse Houwing" wrote:
Hello Brian,

Did you go for the regex or the stringbuilder solution?

Jesse

Ok, Jessee, I have a new Wrinkle for you.

Lets say I want a specific hex pair highlighted in Blue on every
line that starts out with ARES_INDICATION or ARES_EINDICATION.

It would be the 34 item from the left.

If you have the Example.txt I emailed you, the last line in the how
I want it to look the field would the C7 that follows the 02 02 hex.

If not I can send it to you again.

"Jesse Houwing" wrote:

Hello Brian,

Thank you Jesse, that will help a bunch. I have C# classes
scheduled Aug/Sep/Oct so that I can try to avoid more questions in
the future.

You're very welcome and don't hesitate to ask questions that is
what these newsgroups are for after all. Just make sure you've
tried ;)

Jesse

V/R

Brian

"Jesse Houwing" wrote:

Hello Brian,
>
You can do this quite easily with either a regex or a simple
function I'll try to demonstrate both:
>
basically you need a regex that matches the
\r\ndate+time+[number] that is followed by two spaces and replace
it with a space
>
so the regex looks like this (I simplified it a bit, but given
the fact that all the lines are very well layed out I don't thing
you have to make it more differcult :).
>
\r\n[^\]]+\][ ]{2}
>
now replace this by " " and you're all set.
>
So:
private static Regex _rx = new Regex(@"\r\n[^\]]+\][ ]{2}",
RegexOptions.Compiled);
private string LayoutInput(string input)
{
return _rx.Replace(input, " ");
}
Or you could use a StringReader/StringBuilder combination:
private string LayoutInput(string input)
{
StringReader sr = new StringReader(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine())!= null)
{
if (line.Length < 29) { throw new
InvalidOperationException("invalid
input"); /* or simply continue; */ }
if (line[29] != ' ')
{
if (sb.Length 0)
{
sb.Append("\r\n");
}
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
return sb.ToString();
}
I haven't used much error checking to make sure the format is
correct. But I think you can go on from here.
Jesse
>Sent you an email with a sampling.
>>
>"Jesse Houwing" wrote:
>>
>>Hello Brian,
>>>
>>Could you send a sample file with two of these data blocks f
>>what they should look like and how you receive them directly to
>>my email? I'll reply back to this thread with a solution when I
>>have time to go over it. My newsreader keeps messing up your
>>samples, so it would be easier if I had two text files.
>>>
>>Jesse
>>>
>>>Jesse the data inside of the [] is static six digits for each
>>>line.
>>>>
>>>The total number of lines may vary anywhere from one to as
>>>much as 8 lines of data.
>>>>
>>>The line should look like this when pieced together;
>>>>
>>>2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002
>>>404.2.01
>>>(6511)
>>>RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48
>>>52
>>>00
>>>52
>>>02 02
>>>C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06 06 06
>>>06
>>>06
>>>06 0A 06
>>>06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06 06
>>>06
>>>06
>>>06
>>>06 06 06 40
>>>All in one big line without word wrap.
>>>The next entry would be a different header (ARES_INDICATION
>>>for
>>>example).
>>>"Jesse Houwing" wrote:
>>>>Hello Brian,
>>>>>
>>>>>2007/07/27 11:00:03 [153006]
>>>>>>
>>>>My guess is that these aren't the same length for every line.
>>>>If they were it would be easy:
>>>>>
>>>>regex = "^.{num}";
>>>>input = "...";
>>>>replacement = "";
>>>>result = Regex.Replace(regex, input, replacement,
>>>>RegexOptions.MultiLine);
>>>>If the part between [] is variable in length you'd have to
>>>>choose
>>>>a
>>>>more advanced way:
>>>>^[^\[]+\[[^\]]+\]
>>>>It's hard to read. But essentially it says:
>>>>^ start at the beginning of a line
>>>>[^\[]+ get everything that is not a [
>>>>\[ get the opening [
>>>>[^\]]+ get everything that is not a ]
>>>>\] get the closing ]
>>>>and replace that with an empty string.
>>>>should do the job.
>>>>Another option is to construct a strignbuilder, readline
>>>>every
>>>>line of the original input, use substring of the first ] to
>>>>chop
>>>>of the first part and add the resulting string to the
>>>>stringbuilder.
>>>>The first solution (regex) is shorter and once you understand
>>>>the
>>>>regex easy
>>>>to understand and maintain.
>>>>The second solution (stringbuilder) is a bit more complex in
>>>>lines
>>>>of
>>>>code,
>>>>easier to understand if you're not used to regex and probably
>>>>a
>>>>tad
>>>>faster.
>>>>Jesse


Aug 5 '07 #13
Hello Brian,
Jesse, I appreciate all your help so far, and have now come up with
something I am once again unsure how to fix.;

In the Example.txt file I sent you, when the lines are combined into
one they are a little jumbled. I would like to format the line so that
the RX and TX portion all start at the 78th position from the left.
Everything to the left of that would never go past the 75th position.

I know that I can perform a StringBuilder.Insert, just not sure how or
where to add it into this code.

Here is the code for what we made work.
Basically you have two options.
1) Find the location and insert as many spaces as needed.
2) Find the location, split the string. Now use stringBuilder.AppendFormat
function
if you use the following format: "{0, -78}{1}" and the two parts of the string
you have collected using substring it will padd the string to 78 positions
if needed:

/* might need more specific searching for RX/TX */
if (line.InfexOf("TX") 0 || line.InfexOf("RX") 0)
{
int charactersTillPoint = /* Find out the position */
string part0 = line.SubString(0, charactersTillPoint);
string part1 = line.SubString(charactersTillPoint);
sb.AppendFormat("{0, -78}{1}", part0, part1);
}
I've inserted where to mark it with #####
---begin code---
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace DatReader
{
class Streamer
{
public static string LayoutInput(string input)
{
StreamReader sr = File.OpenText(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine()) != null)
{
if (line.Length < 29) { throw new
InvalidOperationException("invalid input"); }
if (line[29] != ' ')
{
sb.Append("\r\n");

#### This is where to insert
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
return sb.ToString();
}
}
}
---end code---

Thanks,

"Jesse Houwing" wrote:
>Hello Brian,

I have no clue how to give text a different colour. I am sure though
that you would need to use a RichTextBox. I'd guess you'd have to
insert some RTF control characters. Where to insert them would be
easy to find out if it's always the 34th Hex pair.

private string LayoutInput(string input)
{
StringReader sr = new StringReader(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine())!= null)
{
if (line.Length < 29) { throw new InvalidOperationException("invalid
input"); }
if (line[29] != ' ')
{
// This is the line that holds the type
if (line.SubString(29).StartsWith("ARES_"))
{
// find the position of the 34th pair. That would
be right behind the 34th space following ARES_
// Alternatively, you could hardcode this position,
this is more flexible
int pos = 29;
for (int i = 0; i < 34 && pos < line.Length; i++)
{
pos = line.Substring(pos).IndexOf(' ', pos);
}
// If a pair was found 34 pairs out
if (pos 29)
{
sb.Append(line.Substring(0, pos)); // Add everything
up to the place we need to insert the control characters
sb.Append(/*control characters to change the color*/);
sb.Append(line.Substring(pos, 2)); // Add the
HEX pair
sb.Append(/*control characters to reset the color*/);
sb.Append(line.Substring(pos + 2)); // Add the
remainder of the string
continue;
}
// Otherwise just fall throught o the default behaviour...
}
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
}
It's all in one function now, but I'd place the extra checks in a
subfunction should they grow any further.

I tried to find a string function that automatically gives the xth
position of a substring (IndexOf(what, from, count, number) but I
couldn't find it... too bad ;)).

Again you could use a regex for this...

Regex.Replace("(?<base>ARES_(\S+\s){34})(?<hexpai r>[A-F0-9]{2})",
"$1" + "control character for colour" + "$2" + "control character for
normal colour");

It's actually easier for me to read than the function above, but that
is partly due to the fact that I'm presenting courses in .NET Regular
Expressions as part of my job.

Jesse
>>I wnt with the Stringbuilder solution. It seemed easier to follow to
me than the Regex one.

"Jesse Houwing" wrote:

Hello Brian,

Did you go for the regex or the stringbuilder solution?

Jesse

Ok, Jessee, I have a new Wrinkle for you.
>
Lets say I want a specific hex pair highlighted in Blue on every
line that starts out with ARES_INDICATION or ARES_EINDICATION.
>
It would be the 34 item from the left.
>
If you have the Example.txt I emailed you, the last line in the
how I want it to look the field would the C7 that follows the 02
02 hex.
>
If not I can send it to you again.
>
"Jesse Houwing" wrote:
>
>Hello Brian,
>>
>>Thank you Jesse, that will help a bunch. I have C# classes
>>scheduled Aug/Sep/Oct so that I can try to avoid more questions
>>in the future.
>>>
>You're very welcome and don't hesitate to ask questions that is
>what these newsgroups are for after all. Just make sure you've
>tried ;)
>>
>Jesse
>>
>>V/R
>>>
>>Brian
>>>
>>"Jesse Houwing" wrote:
>>>
>>>Hello Brian,
>>>>
>>>You can do this quite easily with either a regex or a simple
>>>function I'll try to demonstrate both:
>>>>
>>>basically you need a regex that matches the
>>>\r\ndate+time+[number] that is followed by two spaces and
>>>replace it with a space
>>>>
>>>so the regex looks like this (I simplified it a bit, but given
>>>the fact that all the lines are very well layed out I don't
>>>thing you have to make it more differcult :).
>>>>
>>>\r\n[^\]]+\][ ]{2}
>>>>
>>>now replace this by " " and you're all set.
>>>>
>>>So:
>>>private static Regex _rx = new Regex(@"\r\n[^\]]+\][ ]{2}",
>>>RegexOptions.Compiled);
>>>private string LayoutInput(string input)
>>>{
>>>return _rx.Replace(input, " ");
>>>}
>>>Or you could use a StringReader/StringBuilder combination:
>>>private string LayoutInput(string input)
>>>{
>>>StringReader sr = new StringReader(input);
>>>StringBuilder sb = new StringBuilder(input.Length);
>>>string line;
>>>while ((line = sr.ReadLine())!= null)
>>>{
>>>if (line.Length < 29) { throw new
>>>InvalidOperationException("invalid
>>>input"); /* or simply continue; */ }
>>>if (line[29] != ' ')
>>>{
>>>if (sb.Length 0)
>>>{
>>>sb.Append("\r\n");
>>>}
>>>sb.Append(line);
>>>}
>>>else
>>>{
>>>sb.Append(line.Substring(30));
>>>}
>>>}
>>>return sb.ToString();
>>>}
>>>I haven't used much error checking to make sure the format is
>>>correct. But I think you can go on from here.
>>>Jesse
>>>>Sent you an email with a sampling.
>>>>>
>>>>"Jesse Houwing" wrote:
>>>>>
>>>>>Hello Brian,
>>>>>>
>>>>>Could you send a sample file with two of these data blocks f
>>>>>what they should look like and how you receive them directly
>>>>>to my email? I'll reply back to this thread with a solution
>>>>>when I have time to go over it. My newsreader keeps messing
>>>>>up your samples, so it would be easier if I had two text
>>>>>files.
>>>>>>
>>>>>Jesse
>>>>>>
>>>>>>Jesse the data inside of the [] is static six digits for
>>>>>>each line.
>>>>>>>
>>>>>>The total number of lines may vary anywhere from one to as
>>>>>>much as 8 lines of data.
>>>>>>>
>>>>>>The line should look like this when pieced together;
>>>>>>>
>>>>>>2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002
>>>>>>404.2.01
>>>>>>(6511)
>>>>>>RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48
>>>>>>52
>>>>>>00
>>>>>>52
>>>>>>02 02
>>>>>>C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06 06
>>>>>>06
>>>>>>06
>>>>>>06
>>>>>>06 0A 06
>>>>>>06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06
>>>>>>06
>>>>>>06
>>>>>>06
>>>>>>06
>>>>>>06 06 06 40
>>>>>>All in one big line without word wrap.
>>>>>>The next entry would be a different header (ARES_INDICATION
>>>>>>for
>>>>>>example).
>>>>>>"Jesse Houwing" wrote:
>>>>>>>Hello Brian,
>>>>>>>>
>>>>>>>>2007/07/27 11:00:03 [153006]
>>>>>>>>>
>>>>>>>My guess is that these aren't the same length for every
>>>>>>>line. If they were it would be easy:
>>>>>>>>
>>>>>>>regex = "^.{num}";
>>>>>>>input = "...";
>>>>>>>replacement = "";
>>>>>>>result = Regex.Replace(regex, input, replacement,
>>>>>>>RegexOptions.MultiLine);
>>>>>>>If the part between [] is variable in length you'd have to
>>>>>>>choose
>>>>>>>a
>>>>>>>more advanced way:
>>>>>>>^[^\[]+\[[^\]]+\]
>>>>>>>It's hard to read. But essentially it says:
>>>>>>>^ start at the beginning of a line
>>>>>>>[^\[]+ get everything that is not a [
>>>>>>>\[ get the opening [
>>>>>>>[^\]]+ get everything that is not a ]
>>>>>>>\] get the closing ]
>>>>>>>and replace that with an empty string.
>>>>>>>should do the job.
>>>>>>>Another option is to construct a strignbuilder, readline
>>>>>>>every
>>>>>>>line of the original input, use substring of the first ] to
>>>>>>>chop
>>>>>>>of the first part and add the resulting string to the
>>>>>>>stringbuilder.
>>>>>>>The first solution (regex) is shorter and once you
>>>>>>>understand
>>>>>>>the
>>>>>>>regex easy
>>>>>>>to understand and maintain.
>>>>>>>The second solution (stringbuilder) is a bit more complex
>>>>>>>in
>>>>>>>lines
>>>>>>>of
>>>>>>>code,
>>>>>>>easier to understand if you're not used to regex and
>>>>>>>probably
>>>>>>>a
>>>>>>>tad
>>>>>>>faster.
>>>>>>>Jesse

Aug 5 '07 #14
Jesse, Here is what I did to get it working. At first I didn't realize that I
needed to declare the int. Because of the position of the TX in some lines I
had to move the format out to the 86th pos.

Thanks a bunch!

using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace DatReader
{
class Streamer
{
public static string LayoutInput(string input)
{
StreamReader sr = File.OpenText(input);
StringBuilder sb = new StringBuilder(input.Length);
bool firstLine = true;
string line;
while ((line = sr.ReadLine()) != null)
{
if (line.Length < 29) { throw new
InvalidOperationException("invalid input"); }
if (line[29] != ' ')
{
int txPos;
int rxPos = -1;
if (firstLine)
firstLine = false;
else
sb.Append("\r\n");
if (((txPos = line.IndexOf("TX")) -1) || ((rxPos =
line.IndexOf("RX")) 0))
{
int charactersTillPoint;
if (txPos -1)
charactersTillPoint = txPos;
else
charactersTillPoint = rxPos;
string part0 = line.Substring(0, charactersTillPoint);
string part1 = line.Substring(charactersTillPoint);
sb.Append(part0.PadRight(86));
sb.Append(part1);
}
else
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
return sb.ToString();
}
}
}

"Jesse Houwing" wrote:
Hello Brian,
Jesse, I appreciate all your help so far, and have now come up with
something I am once again unsure how to fix.;

In the Example.txt file I sent you, when the lines are combined into
one they are a little jumbled. I would like to format the line so that
the RX and TX portion all start at the 78th position from the left.
Everything to the left of that would never go past the 75th position.

I know that I can perform a StringBuilder.Insert, just not sure how or
where to add it into this code.

Here is the code for what we made work.

Basically you have two options.
1) Find the location and insert as many spaces as needed.
2) Find the location, split the string. Now use stringBuilder.AppendFormat
function
if you use the following format: "{0, -78}{1}" and the two parts of the string
you have collected using substring it will padd the string to 78 positions
if needed:

/* might need more specific searching for RX/TX */
if (line.InfexOf("TX") 0 || line.InfexOf("RX") 0)
{
int charactersTillPoint = /* Find out the position */
string part0 = line.SubString(0, charactersTillPoint);
string part1 = line.SubString(charactersTillPoint);
sb.AppendFormat("{0, -78}{1}", part0, part1);
}
I've inserted where to mark it with #####
---begin code---
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace DatReader
{
class Streamer
{
public static string LayoutInput(string input)
{
StreamReader sr = File.OpenText(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine()) != null)
{
if (line.Length < 29) { throw new
InvalidOperationException("invalid input"); }
if (line[29] != ' ')
{
sb.Append("\r\n");


#### This is where to insert
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
return sb.ToString();
}
}
}
---end code---

Thanks,

"Jesse Houwing" wrote:
Hello Brian,

I have no clue how to give text a different colour. I am sure though
that you would need to use a RichTextBox. I'd guess you'd have to
insert some RTF control characters. Where to insert them would be
easy to find out if it's always the 34th Hex pair.

private string LayoutInput(string input)
{
StringReader sr = new StringReader(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine())!= null)
{
if (line.Length < 29) { throw new InvalidOperationException("invalid
input"); }
if (line[29] != ' ')
{
// This is the line that holds the type
if (line.SubString(29).StartsWith("ARES_"))
{
// find the position of the 34th pair. That would
be right behind the 34th space following ARES_
// Alternatively, you could hardcode this position,
this is more flexible
int pos = 29;
for (int i = 0; i < 34 && pos < line.Length; i++)
{
pos = line.Substring(pos).IndexOf(' ', pos);
}
// If a pair was found 34 pairs out
if (pos 29)
{
sb.Append(line.Substring(0, pos)); // Add everything
up to the place we need to insert the control characters
sb.Append(/*control characters to change the color*/);
sb.Append(line.Substring(pos, 2)); // Add the
HEX pair
sb.Append(/*control characters to reset the color*/);
sb.Append(line.Substring(pos + 2)); // Add the
remainder of the string
continue;
}
// Otherwise just fall throught o the default behaviour...
}
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
}
It's all in one function now, but I'd place the extra checks in a
subfunction should they grow any further.

I tried to find a string function that automatically gives the xth
position of a substring (IndexOf(what, from, count, number) but I
couldn't find it... too bad ;)).

Again you could use a regex for this...

Regex.Replace("(?<base>ARES_(\S+\s){34})(?<hexpair >[A-F0-9]{2})",
"$1" + "control character for colour" + "$2" + "control character for
normal colour");

It's actually easier for me to read than the function above, but that
is partly due to the fact that I'm presenting courses in .NET Regular
Expressions as part of my job.

Jesse

I wnt with the Stringbuilder solution. It seemed easier to follow to
me than the Regex one.

"Jesse Houwing" wrote:

Hello Brian,

Did you go for the regex or the stringbuilder solution?

Jesse

Ok, Jessee, I have a new Wrinkle for you.

Lets say I want a specific hex pair highlighted in Blue on every
line that starts out with ARES_INDICATION or ARES_EINDICATION.

It would be the 34 item from the left.

If you have the Example.txt I emailed you, the last line in the
how I want it to look the field would the C7 that follows the 02
02 hex.

If not I can send it to you again.

"Jesse Houwing" wrote:

Hello Brian,
>
>Thank you Jesse, that will help a bunch. I have C# classes
>scheduled Aug/Sep/Oct so that I can try to avoid more questions
>in the future.
>>
You're very welcome and don't hesitate to ask questions that is
what these newsgroups are for after all. Just make sure you've
tried ;)
>
Jesse
>
>V/R
>>
>Brian
>>
>"Jesse Houwing" wrote:
>>
>>Hello Brian,
>>>
>>You can do this quite easily with either a regex or a simple
>>function I'll try to demonstrate both:
>>>
>>basically you need a regex that matches the
>>\r\ndate+time+[number] that is followed by two spaces and
>>replace it with a space
>>>
>>so the regex looks like this (I simplified it a bit, but given
>>the fact that all the lines are very well layed out I don't
>>thing you have to make it more differcult :).
>>>
>>\r\n[^\]]+\][ ]{2}
>>>
>>now replace this by " " and you're all set.
>>>
>>So:
>>private static Regex _rx = new Regex(@"\r\n[^\]]+\][ ]{2}",
>>RegexOptions.Compiled);
>>private string LayoutInput(string input)
>>{
>>return _rx.Replace(input, " ");
>>}
>>Or you could use a StringReader/StringBuilder combination:
>>private string LayoutInput(string input)
>>{
>>StringReader sr = new StringReader(input);
>>StringBuilder sb = new StringBuilder(input.Length);
>>string line;
>>while ((line = sr.ReadLine())!= null)
>>{
>>if (line.Length < 29) { throw new
>>InvalidOperationException("invalid
>>input"); /* or simply continue; */ }
>>if (line[29] != ' ')
>>{
>>if (sb.Length 0)
>>{
>>sb.Append("\r\n");
>>}
>>sb.Append(line);
>>}
>>else
>>{
>>sb.Append(line.Substring(30));
>>}
>>}
>>return sb.ToString();
>>}
>>I haven't used much error checking to make sure the format is
>>correct. But I think you can go on from here.
>>Jesse
>>>Sent you an email with a sampling.
>>>>
>>>"Jesse Houwing" wrote:
>>>>
>>>>Hello Brian,
>>>>>
>>>>Could you send a sample file with two of these data blocks f
>>>>what they should look like and how you receive them directly
>>>>to my email? I'll reply back to this thread with a solution
>>>>when I have time to go over it. My newsreader keeps messing
>>>>up your samples, so it would be easier if I had two text
>>>>files.
>>>>>
>>>>Jesse
>>>>>
>>>>>Jesse the data inside of the [] is static six digits for
>>>>>each line.
>>>>>>
>>>>>The total number of lines may vary anywhere from one to as
>>>>>much as 8 lines of data.
>>>>>>
>>>>>The line should look like this when pieced together;
>>>>>>
>>>>>2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002
>>>>>404.2.01
>>>>>(6511)
>>>>>RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48
>>>>>52
>>>>>00
>>>>>52
>>>>>02 02
>>>>>C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06 06
>>>>>06
>>>>>06
>>>>>06
>>>>>06 0A 06
>>>>>06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06
>>>>>06
>>>>>06
>>>>>06
>>>>>06
>>>>>06 06 06 40
>>>>>All in one big line without word wrap.
>>>>>The next entry would be a different header (ARES_INDICATION
>>>>>for
>>>>>example).
>>>>>"Jesse Houwing" wrote:
>>>>>>Hello Brian,
>>>>>>>
>>>>>>>2007/07/27 11:00:03 [153006]
>>>>>>>>
>>>>>>My guess is that these aren't the same length for every
>>>>>>line. If they were it would be easy:
Aug 6 '07 #15
Jesse I thought I would let you know how I did the highlight/change color of
specific text;

private void findSequenceNumbers()
{
toolStripStatusLabel.Visible = toolStripProgressBar.Visible =
true;
toolStripProgressBar.Value = 0;
int lineNum = 0;
bool startingNewLine = true;
FontStyle style = FontStyle.Bold;
string[] lines = rtbTextBox.Lines;
string text = rtbTextBox.Text;
toolStripProgressBar.Maximum = text.Length;
for (int i = 0; i < text.Length; i++)
{
if (startingNewLine)
{
if ((lines[lineNum].Contains("ARES_EINDICATION")) ||
(lines[lineNum].Contains("ARES_INDICATION")))
{
i += 169;
rtbTextBox.Select(i, 2);
rtbTextBox.SelectionFont = new
Font(rtbTextBox.SelectionFont, rtbTextBox.SelectionFont.Style ^ style);
rtbTextBox.SelectionColor = Color.DarkBlue;
}
else if
(lines[lineNum].Contains("]CODELINE_INDICATION_MSG"))
{
i += 160;
rtbTextBox.Select(i, 2);
rtbTextBox.SelectionFont = new
Font(rtbTextBox.SelectionFont, rtbTextBox.SelectionFont.Style ^ style);
rtbTextBox.SelectionColor = Color.DarkBlue;
}
else
{
i += lines[lineNum].Length - 1;
}
startingNewLine = false;
Application.DoEvents();
}
if (text[i] == '\n')
{
startingNewLine = true;
lineNum++;
}
toolStripProgressBar.Value = i;
}
toolStripStatusLabel.Visible = toolStripProgressBar.Visible =
false;
}
Many Thanks,

Brian

"Jesse Houwing" wrote:
Hello Brian,
Jesse, I appreciate all your help so far, and have now come up with
something I am once again unsure how to fix.;

In the Example.txt file I sent you, when the lines are combined into
one they are a little jumbled. I would like to format the line so that
the RX and TX portion all start at the 78th position from the left.
Everything to the left of that would never go past the 75th position.

I know that I can perform a StringBuilder.Insert, just not sure how or
where to add it into this code.

Here is the code for what we made work.

Basically you have two options.
1) Find the location and insert as many spaces as needed.
2) Find the location, split the string. Now use stringBuilder.AppendFormat
function
if you use the following format: "{0, -78}{1}" and the two parts of the string
you have collected using substring it will padd the string to 78 positions
if needed:

/* might need more specific searching for RX/TX */
if (line.InfexOf("TX") 0 || line.InfexOf("RX") 0)
{
int charactersTillPoint = /* Find out the position */
string part0 = line.SubString(0, charactersTillPoint);
string part1 = line.SubString(charactersTillPoint);
sb.AppendFormat("{0, -78}{1}", part0, part1);
}
I've inserted where to mark it with #####
---begin code---
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace DatReader
{
class Streamer
{
public static string LayoutInput(string input)
{
StreamReader sr = File.OpenText(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine()) != null)
{
if (line.Length < 29) { throw new
InvalidOperationException("invalid input"); }
if (line[29] != ' ')
{
sb.Append("\r\n");


#### This is where to insert
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
return sb.ToString();
}
}
}
---end code---

Thanks,

"Jesse Houwing" wrote:
Hello Brian,

I have no clue how to give text a different colour. I am sure though
that you would need to use a RichTextBox. I'd guess you'd have to
insert some RTF control characters. Where to insert them would be
easy to find out if it's always the 34th Hex pair.

private string LayoutInput(string input)
{
StringReader sr = new StringReader(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine())!= null)
{
if (line.Length < 29) { throw new InvalidOperationException("invalid
input"); }
if (line[29] != ' ')
{
// This is the line that holds the type
if (line.SubString(29).StartsWith("ARES_"))
{
// find the position of the 34th pair. That would
be right behind the 34th space following ARES_
// Alternatively, you could hardcode this position,
this is more flexible
int pos = 29;
for (int i = 0; i < 34 && pos < line.Length; i++)
{
pos = line.Substring(pos).IndexOf(' ', pos);
}
// If a pair was found 34 pairs out
if (pos 29)
{
sb.Append(line.Substring(0, pos)); // Add everything
up to the place we need to insert the control characters
sb.Append(/*control characters to change the color*/);
sb.Append(line.Substring(pos, 2)); // Add the
HEX pair
sb.Append(/*control characters to reset the color*/);
sb.Append(line.Substring(pos + 2)); // Add the
remainder of the string
continue;
}
// Otherwise just fall throught o the default behaviour...
}
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
}
It's all in one function now, but I'd place the extra checks in a
subfunction should they grow any further.

I tried to find a string function that automatically gives the xth
position of a substring (IndexOf(what, from, count, number) but I
couldn't find it... too bad ;)).

Again you could use a regex for this...

Regex.Replace("(?<base>ARES_(\S+\s){34})(?<hexpair >[A-F0-9]{2})",
"$1" + "control character for colour" + "$2" + "control character for
normal colour");

It's actually easier for me to read than the function above, but that
is partly due to the fact that I'm presenting courses in .NET Regular
Expressions as part of my job.

Jesse

I wnt with the Stringbuilder solution. It seemed easier to follow to
me than the Regex one.

"Jesse Houwing" wrote:

Hello Brian,

Did you go for the regex or the stringbuilder solution?

Jesse

Ok, Jessee, I have a new Wrinkle for you.

Lets say I want a specific hex pair highlighted in Blue on every
line that starts out with ARES_INDICATION or ARES_EINDICATION.

It would be the 34 item from the left.

If you have the Example.txt I emailed you, the last line in the
how I want it to look the field would the C7 that follows the 02
02 hex.

If not I can send it to you again.

"Jesse Houwing" wrote:

Hello Brian,
>
>Thank you Jesse, that will help a bunch. I have C# classes
>scheduled Aug/Sep/Oct so that I can try to avoid more questions
>in the future.
>>
You're very welcome and don't hesitate to ask questions that is
what these newsgroups are for after all. Just make sure you've
tried ;)
>
Jesse
>
>V/R
>>
>Brian
>>
>"Jesse Houwing" wrote:
>>
>>Hello Brian,
>>>
>>You can do this quite easily with either a regex or a simple
>>function I'll try to demonstrate both:
>>>
>>basically you need a regex that matches the
>>\r\ndate+time+[number] that is followed by two spaces and
>>replace it with a space
>>>
>>so the regex looks like this (I simplified it a bit, but given
>>the fact that all the lines are very well layed out I don't
>>thing you have to make it more differcult :).
>>>
>>\r\n[^\]]+\][ ]{2}
>>>
>>now replace this by " " and you're all set.
>>>
>>So:
>>private static Regex _rx = new Regex(@"\r\n[^\]]+\][ ]{2}",
>>RegexOptions.Compiled);
>>private string LayoutInput(string input)
>>{
>>return _rx.Replace(input, " ");
>>}
>>Or you could use a StringReader/StringBuilder combination:
>>private string LayoutInput(string input)
>>{
>>StringReader sr = new StringReader(input);
>>StringBuilder sb = new StringBuilder(input.Length);
>>string line;
>>while ((line = sr.ReadLine())!= null)
>>{
>>if (line.Length < 29) { throw new
>>InvalidOperationException("invalid
>>input"); /* or simply continue; */ }
>>if (line[29] != ' ')
>>{
>>if (sb.Length 0)
>>{
>>sb.Append("\r\n");
>>}
>>sb.Append(line);
>>}
>>else
>>{
>>sb.Append(line.Substring(30));
>>}
>>}
>>return sb.ToString();
>>}
>>I haven't used much error checking to make sure the format is
>>correct. But I think you can go on from here.
>>Jesse
>>>Sent you an email with a sampling.
>>>>
>>>"Jesse Houwing" wrote:
>>>>
>>>>Hello Brian,
>>>>>
>>>>Could you send a sample file with two of these data blocks f
>>>>what they should look like and how you receive them directly
>>>>to my email? I'll reply back to this thread with a solution
>>>>when I have time to go over it. My newsreader keeps messing
>>>>up your samples, so it would be easier if I had two text
>>>>files.
>>>>>
>>>>Jesse
>>>>>
>>>>>Jesse the data inside of the [] is static six digits for
>>>>>each line.
>>>>>>
>>>>>The total number of lines may vary anywhere from one to as
>>>>>much as 8 lines of data.
>>>>>>
>>>>>The line should look like this when pieced together;
>>>>>>
>>>>>2007/07/27 11:00:03 [153006]ARES_INDICATION 010.050.016.002
>>>>>404.2.01
>>>>>(6511)
>>>>>RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13 48
>>>>>52
>>>>>00
>>>>>52
>>>>>02 02
>>>>>C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06 06
>>>>>06
>>>>>06
>>>>>06
>>>>>06 0A 06
>>>>>06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06
>>>>>06
>>>>>06
>>>>>06
>>>>>06
>>>>>06 06 06 40
>>>>>All in one big line without word wrap.
>>>>>The next entry would be a different header (ARES_INDICATION
>>>>>for
>>>>>example).
>>>>>"Jesse Houwing" wrote:
>>>>>>Hello Brian,
>>>>>>>
>>>>>>>2007/07/27 11:00:03 [153006]
>>>>>>>>
>>>>>>My guess is that these aren't the same length for every
>>>>>>line. If they were it would be easy:
Aug 8 '07 #16
Hello Brian,
Jesse I thought I would let you know how I did the highlight/change
color of specific text;
Great, seems like you're getting the hang of it :)

As an exercise you could try convirting it all to reular expressions for
fun ;)

Jesse

>
private void findSequenceNumbers()
{
toolStripStatusLabel.Visible =
toolStripProgressBar.Visible =
true;
toolStripProgressBar.Value = 0;
int lineNum = 0;
bool startingNewLine = true;
FontStyle style = FontStyle.Bold;
string[] lines = rtbTextBox.Lines;
string text = rtbTextBox.Text;
toolStripProgressBar.Maximum = text.Length;
for (int i = 0; i < text.Length; i++)
{
if (startingNewLine)
{
if ((lines[lineNum].Contains("ARES_EINDICATION"))
||
(lines[lineNum].Contains("ARES_INDICATION")))
{
i += 169;
rtbTextBox.Select(i, 2);
rtbTextBox.SelectionFont = new
Font(rtbTextBox.SelectionFont, rtbTextBox.SelectionFont.Style ^
style);
rtbTextBox.SelectionColor = Color.DarkBlue;
}
else if
(lines[lineNum].Contains("]CODELINE_INDICATION_MSG"))
{
i += 160;
rtbTextBox.Select(i, 2);
rtbTextBox.SelectionFont = new
Font(rtbTextBox.SelectionFont, rtbTextBox.SelectionFont.Style ^
style);
rtbTextBox.SelectionColor = Color.DarkBlue;
}
else
{
i += lines[lineNum].Length - 1;
}
startingNewLine = false;
Application.DoEvents();
}
if (text[i] == '\n')
{
startingNewLine = true;
lineNum++;
}
toolStripProgressBar.Value = i;
}
toolStripStatusLabel.Visible =
toolStripProgressBar.Visible =
false;
}
Many Thanks,

Brian

"Jesse Houwing" wrote:
>Hello Brian,
>>Jesse, I appreciate all your help so far, and have now come up with
something I am once again unsure how to fix.;

In the Example.txt file I sent you, when the lines are combined into
one they are a little jumbled. I would like to format the line so
that the RX and TX portion all start at the 78th position from the
left. Everything to the left of that would never go past the 75th
position.

I know that I can perform a StringBuilder.Insert, just not sure how
or where to add it into this code.

Here is the code for what we made work.
Basically you have two options.
1) Find the location and insert as many spaces as needed.
2) Find the location, split the string. Now use
stringBuilder.AppendFormat
function
if you use the following format: "{0, -78}{1}" and the two parts of
the string
you have collected using substring it will padd the string to 78
positions
if needed:
/* might need more specific searching for RX/TX */
if (line.InfexOf("TX") 0 || line.InfexOf("RX") 0)
{
int charactersTillPoint = /* Find out the position */
string part0 = line.SubString(0, charactersTillPoint);
string part1 = line.SubString(charactersTillPoint);
sb.AppendFormat("{0, -78}{1}", part0, part1);
}
I've inserted where to mark it with #####
>>---begin code---
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace DatReader
{
class Streamer
{
public static string LayoutInput(string input)
{
StreamReader sr = File.OpenText(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine()) != null)
{
if (line.Length < 29) { throw new
InvalidOperationException("invalid input"); }
if (line[29] != ' ')
{
sb.Append("\r\n");
#### This is where to insert
>>sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
return sb.ToString();
}
}
}
---end code---
Thanks,

"Jesse Houwing" wrote:

Hello Brian,

I have no clue how to give text a different colour. I am sure
though that you would need to use a RichTextBox. I'd guess you'd
have to insert some RTF control characters. Where to insert them
would be easy to find out if it's always the 34th Hex pair.

private string LayoutInput(string input)
{
StringReader sr = new StringReader(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine())!= null)
{
if (line.Length < 29) { throw new
InvalidOperationException("invalid
input"); }
if (line[29] != ' ')
{
// This is the line that holds the type
if (line.SubString(29).StartsWith("ARES_"))
{
// find the position of the 34th pair. That would
be right behind the 34th space following ARES_
// Alternatively, you could hardcode this position,
this is more flexible
int pos = 29;
for (int i = 0; i < 34 && pos < line.Length; i++)
{
pos = line.Substring(pos).IndexOf(' ', pos);
}
// If a pair was found 34 pairs out
if (pos 29)
{
sb.Append(line.Substring(0, pos)); // Add everything
up to the place we need to insert the control characters
sb.Append(/*control characters to change the color*/);
sb.Append(line.Substring(pos, 2)); // Add the
HEX pair
sb.Append(/*control characters to reset the color*/);
sb.Append(line.Substring(pos + 2)); // Add the
remainder of the string
continue;
}
// Otherwise just fall throught o the default behaviour...
}
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
}
It's all in one function now, but I'd place the extra checks in a
subfunction should they grow any further.
I tried to find a string function that automatically gives the xth
position of a substring (IndexOf(what, from, count, number) but I
couldn't find it... too bad ;)).

Again you could use a regex for this...

Regex.Replace("(?<base>ARES_(\S+\s){34})(?<hexp air>[A-F0-9]{2})",
"$1" + "control character for colour" + "$2" + "control character
for normal colour");

It's actually easier for me to read than the function above, but
that is partly due to the fact that I'm presenting courses in .NET
Regular Expressions as part of my job.

Jesse

I wnt with the Stringbuilder solution. It seemed easier to follow
to me than the Regex one.
>
"Jesse Houwing" wrote:
>
>Hello Brian,
>>
>Did you go for the regex or the stringbuilder solution?
>>
>Jesse
>>
>>Ok, Jessee, I have a new Wrinkle for you.
>>>
>>Lets say I want a specific hex pair highlighted in Blue on every
>>line that starts out with ARES_INDICATION or ARES_EINDICATION.
>>>
>>It would be the 34 item from the left.
>>>
>>If you have the Example.txt I emailed you, the last line in the
>>how I want it to look the field would the C7 that follows the 02
>>02 hex.
>>>
>>If not I can send it to you again.
>>>
>>"Jesse Houwing" wrote:
>>>
>>>Hello Brian,
>>>>
>>>>Thank you Jesse, that will help a bunch. I have C# classes
>>>>scheduled Aug/Sep/Oct so that I can try to avoid more
>>>>questions in the future.
>>>>>
>>>You're very welcome and don't hesitate to ask questions that is
>>>what these newsgroups are for after all. Just make sure you've
>>>tried ;)
>>>>
>>>Jesse
>>>>
>>>>V/R
>>>>>
>>>>Brian
>>>>>
>>>>"Jesse Houwing" wrote:
>>>>>
>>>>>Hello Brian,
>>>>>>
>>>>>You can do this quite easily with either a regex or a simple
>>>>>function I'll try to demonstrate both:
>>>>>>
>>>>>basically you need a regex that matches the
>>>>>\r\ndate+time+[number] that is followed by two spaces and
>>>>>replace it with a space
>>>>>>
>>>>>so the regex looks like this (I simplified it a bit, but
>>>>>given the fact that all the lines are very well layed out I
>>>>>don't thing you have to make it more differcult :).
>>>>>>
>>>>>\r\n[^\]]+\][ ]{2}
>>>>>>
>>>>>now replace this by " " and you're all set.
>>>>>>
>>>>>So:
>>>>>private static Regex _rx = new Regex(@"\r\n[^\]]+\][ ]{2}",
>>>>>RegexOptions.Compiled);
>>>>>private string LayoutInput(string input)
>>>>>{
>>>>>return _rx.Replace(input, " ");
>>>>>}
>>>>>Or you could use a StringReader/StringBuilder combination:
>>>>>private string LayoutInput(string input)
>>>>>{
>>>>>StringReader sr = new StringReader(input);
>>>>>StringBuilder sb = new StringBuilder(input.Length);
>>>>>string line;
>>>>>while ((line = sr.ReadLine())!= null)
>>>>>{
>>>>>if (line.Length < 29) { throw new
>>>>>InvalidOperationException("invalid
>>>>>input"); /* or simply continue; */ }
>>>>>if (line[29] != ' ')
>>>>>{
>>>>>if (sb.Length 0)
>>>>>{
>>>>>sb.Append("\r\n");
>>>>>}
>>>>>sb.Append(line);
>>>>>}
>>>>>else
>>>>>{
>>>>>sb.Append(line.Substring(30));
>>>>>}
>>>>>}
>>>>>return sb.ToString();
>>>>>}
>>>>>I haven't used much error checking to make sure the format is
>>>>>correct. But I think you can go on from here.
>>>>>Jesse
>>>>>>Sent you an email with a sampling.
>>>>>>>
>>>>>>"Jesse Houwing" wrote:
>>>>>>>
>>>>>>>Hello Brian,
>>>>>>>>
>>>>>>>Could you send a sample file with two of these data blocks
>>>>>>>f what they should look like and how you receive them
>>>>>>>directly to my email? I'll reply back to this thread with a
>>>>>>>solution when I have time to go over it. My newsreader
>>>>>>>keeps messing up your samples, so it would be easier if I
>>>>>>>had two text files.
>>>>>>>>
>>>>>>>Jesse
>>>>>>>>
>>>>>>>>Jesse the data inside of the [] is static six digits for
>>>>>>>>each line.
>>>>>>>>>
>>>>>>>>The total number of lines may vary anywhere from one to as
>>>>>>>>much as 8 lines of data.
>>>>>>>>>
>>>>>>>>The line should look like this when pieced together;
>>>>>>>>>
>>>>>>>>2007/07/27 11:00:03 [153006]ARES_INDICATION
>>>>>>>>010.050.016.002
>>>>>>>>404.2.01
>>>>>>>>(6511)
>>>>>>>>RX 74 bytes 65 11 26 02 BC 6C AA 20 76 93 51 53 50 76 13
>>>>>>>>48
>>>>>>>>52
>>>>>>>>00
>>>>>>>>52
>>>>>>>>02 02
>>>>>>>>C7 83 D7 07 07 1B 0B 00 00 00 00 28 0A 06 06 06 06 06 06
>>>>>>>>06
>>>>>>>>06
>>>>>>>>06
>>>>>>>>06
>>>>>>>>06 0A 06
>>>>>>>>06 06 0A 06 06 06 0A 06 06 06 06 06 06 06 06 06 06 06 06
>>>>>>>>06
>>>>>>>>06
>>>>>>>>06
>>>>>>>>06
>>>>>>>>06 06 06 40
>>>>>>>>All in one big line without word wrap.
>>>>>>>>The next entry would be a different header
>>>>>>>>(ARES_INDICATION
>>>>>>>>for
>>>>>>>>example).
>>>>>>>>"Jesse Houwing" wrote:
>>>>>>>>>Hello Brian,
>>>>>>>>>>
>>>>>>>>>>2007/07/27 11:00:03 [153006]
>>>>>>>>>>>
>>>>>>>>>My guess is that these aren't the same length for every
>>>>>>>>>line. If they were it would be easy:
>>>>>>>>>>

Aug 8 '07 #17
Maybe after I go thru a class the end of the month.

Thanks for all your help.

"Jesse Houwing" wrote:
Hello Brian,
Jesse I thought I would let you know how I did the highlight/change
color of specific text;

Great, seems like you're getting the hang of it :)

As an exercise you could try convirting it all to reular expressions for
fun ;)

Jesse


private void findSequenceNumbers()
{
toolStripStatusLabel.Visible =
toolStripProgressBar.Visible =
true;
toolStripProgressBar.Value = 0;
int lineNum = 0;
bool startingNewLine = true;
FontStyle style = FontStyle.Bold;
string[] lines = rtbTextBox.Lines;
string text = rtbTextBox.Text;
toolStripProgressBar.Maximum = text.Length;
for (int i = 0; i < text.Length; i++)
{
if (startingNewLine)
{
if ((lines[lineNum].Contains("ARES_EINDICATION"))
||
(lines[lineNum].Contains("ARES_INDICATION")))
{
i += 169;
rtbTextBox.Select(i, 2);
rtbTextBox.SelectionFont = new
Font(rtbTextBox.SelectionFont, rtbTextBox.SelectionFont.Style ^
style);
rtbTextBox.SelectionColor = Color.DarkBlue;
}
else if
(lines[lineNum].Contains("]CODELINE_INDICATION_MSG"))
{
i += 160;
rtbTextBox.Select(i, 2);
rtbTextBox.SelectionFont = new
Font(rtbTextBox.SelectionFont, rtbTextBox.SelectionFont.Style ^
style);
rtbTextBox.SelectionColor = Color.DarkBlue;
}
else
{
i += lines[lineNum].Length - 1;
}
startingNewLine = false;
Application.DoEvents();
}
if (text[i] == '\n')
{
startingNewLine = true;
lineNum++;
}
toolStripProgressBar.Value = i;
}
toolStripStatusLabel.Visible =
toolStripProgressBar.Visible =
false;
}
Many Thanks,

Brian

"Jesse Houwing" wrote:
Hello Brian,

Jesse, I appreciate all your help so far, and have now come up with
something I am once again unsure how to fix.;

In the Example.txt file I sent you, when the lines are combined into
one they are a little jumbled. I would like to format the line so
that the RX and TX portion all start at the 78th position from the
left. Everything to the left of that would never go past the 75th
position.

I know that I can perform a StringBuilder.Insert, just not sure how
or where to add it into this code.

Here is the code for what we made work.

Basically you have two options.
1) Find the location and insert as many spaces as needed.
2) Find the location, split the string. Now use
stringBuilder.AppendFormat
function
if you use the following format: "{0, -78}{1}" and the two parts of
the string
you have collected using substring it will padd the string to 78
positions
if needed:
/* might need more specific searching for RX/TX */
if (line.InfexOf("TX") 0 || line.InfexOf("RX") 0)
{
int charactersTillPoint = /* Find out the position */
string part0 = line.SubString(0, charactersTillPoint);
string part1 = line.SubString(charactersTillPoint);
sb.AppendFormat("{0, -78}{1}", part0, part1);
}
I've inserted where to mark it with #####

---begin code---
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace DatReader
{
class Streamer
{
public static string LayoutInput(string input)
{
StreamReader sr = File.OpenText(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine()) != null)
{
if (line.Length < 29) { throw new
InvalidOperationException("invalid input"); }
if (line[29] != ' ')
{
sb.Append("\r\n");
#### This is where to insert

sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
return sb.ToString();
}
}
}
---end code---
Thanks,

"Jesse Houwing" wrote:

Hello Brian,

I have no clue how to give text a different colour. I am sure
though that you would need to use a RichTextBox. I'd guess you'd
have to insert some RTF control characters. Where to insert them
would be easy to find out if it's always the 34th Hex pair.

private string LayoutInput(string input)
{
StringReader sr = new StringReader(input);
StringBuilder sb = new StringBuilder(input.Length);
string line;
while ((line = sr.ReadLine())!= null)
{
if (line.Length < 29) { throw new
InvalidOperationException("invalid
input"); }
if (line[29] != ' ')
{
// This is the line that holds the type
if (line.SubString(29).StartsWith("ARES_"))
{
// find the position of the 34th pair. That would
be right behind the 34th space following ARES_
// Alternatively, you could hardcode this position,
this is more flexible
int pos = 29;
for (int i = 0; i < 34 && pos < line.Length; i++)
{
pos = line.Substring(pos).IndexOf(' ', pos);
}
// If a pair was found 34 pairs out
if (pos 29)
{
sb.Append(line.Substring(0, pos)); // Add everything
up to the place we need to insert the control characters
sb.Append(/*control characters to change the color*/);
sb.Append(line.Substring(pos, 2)); // Add the
HEX pair
sb.Append(/*control characters to reset the color*/);
sb.Append(line.Substring(pos + 2)); // Add the
remainder of the string
continue;
}
// Otherwise just fall throught o the default behaviour...
}
sb.Append(line);
}
else
{
sb.Append(line.Substring(30));
}
}
}
It's all in one function now, but I'd place the extra checks in a
subfunction should they grow any further.
I tried to find a string function that automatically gives the xth
position of a substring (IndexOf(what, from, count, number) but I
couldn't find it... too bad ;)).

Again you could use a regex for this...

Regex.Replace("(?<base>ARES_(\S+\s){34})(?<hexpa ir>[A-F0-9]{2})",
"$1" + "control character for colour" + "$2" + "control character
for normal colour");

It's actually easier for me to read than the function above, but
that is partly due to the fact that I'm presenting courses in .NET
Regular Expressions as part of my job.

Jesse

I wnt with the Stringbuilder solution. It seemed easier to follow
to me than the Regex one.

"Jesse Houwing" wrote:

Hello Brian,
>
Did you go for the regex or the stringbuilder solution?
>
Jesse
>
>Ok, Jessee, I have a new Wrinkle for you.
>>
>Lets say I want a specific hex pair highlighted in Blue on every
>line that starts out with ARES_INDICATION or ARES_EINDICATION.
>>
>It would be the 34 item from the left.
>>
>If you have the Example.txt I emailed you, the last line in the
>how I want it to look the field would the C7 that follows the 02
>02 hex.
>>
>If not I can send it to you again.
>>
>"Jesse Houwing" wrote:
>>
>>Hello Brian,
>>>
>>>Thank you Jesse, that will help a bunch. I have C# classes
>>>scheduled Aug/Sep/Oct so that I can try to avoid more
>>>questions in the future.
>>>>
>>You're very welcome and don't hesitate to ask questions that is
>>what these newsgroups are for after all. Just make sure you've
>>tried ;)
>>>
>>Jesse
>>>
>>>V/R
>>>>
>>>Brian
>>>>
>>>"Jesse Houwing" wrote:
>>>>
>>>>Hello Brian,
>>>>>
>>>>You can do this quite easily with either a regex or a simple
>>>>function I'll try to demonstrate both:
>>>>>
>>>>basically you need a regex that matches the
>>>>\r\ndate+time+[number] that is followed by two spaces and
>>>>replace it with a space
>>>>>
>>>>so the regex looks like this (I simplified it a bit, but
>>>>given the fact that all the lines are very well layed out I
>>>>don't thing you have to make it more differcult :).
>>>>>
>>>>\r\n[^\]]+\][ ]{2}
>>>>>
>>>>now replace this by " " and you're all set.
>>>>>
>>>>So:
>>>>private static Regex _rx = new Regex(@"\r\n[^\]]+\][ ]{2}",
>>>>RegexOptions.Compiled);
>>>>private string LayoutInput(string input)
>>>>{
>>>>return _rx.Replace(input, " ");
>>>>}
>>>>Or you could use a StringReader/StringBuilder combination:
>>>>private string LayoutInput(string input)
>>>>{
>>>>StringReader sr = new StringReader(input);
>>>>StringBuilder sb = new StringBuilder(input.Length);
>>>>string line;
>>>>while ((line = sr.ReadLine())!= null)
>>>>{
>>>>if (line.Length < 29) { throw new
Aug 8 '07 #18
Brian Cook wrote:
if (line.Length < 29) { throw new
InvalidOperationException("invalid input"); }
if (line[29] != ' ')
Spot the bug.

BTW: I wouldn't throw that exception. Here is its definition: " The
exception that is thrown when a method call is invalid for the object's
current state.".

Hilton
Oct 4 '07 #19
Thanks,

"Hilton" wrote:
Brian Cook wrote:
if (line.Length < 29) { throw new
InvalidOperationException("invalid input"); }
if (line[29] != ' ')

Spot the bug.

BTW: I wouldn't throw that exception. Here is its definition: " The
exception that is thrown when a method call is invalid for the object's
current state.".

Hilton
Oct 4 '07 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Alex Vassiliev | last post by:
Hi all. Just wanted to share two handy RegEx expressions to strips leading and trailing white-space from a string, and to replace all repeated spaces, newlines and tabs with a single space. *...
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
4
by: Neo Geshel | last post by:
Greetings I am using VB in my ASP.NET project that uses an admin web site to populate a database that provides content for a front end web site. I am looking for a way to use replace() to...
47
by: Mark | last post by:
why doesn't .NET support multiple inheritance? I think it's so silly! Cheers, Mark
22
by: Terry Olsen | last post by:
I have an app that makes decisions based on string content. I need to make sure that a string does not contain only spaces or newlines. I am using the syntax 'Trim(String)" and it works fine. I...
27
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I trim whitespace - LTRIM/RTRIM/TRIM?...
4
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I trim whitespace - trim/trimRight/trimLeft...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.