Author Topic: colour coding multiple words  (Read 9130 times)

apnakon

  • Community Member
  • Posts: 27
  • Hero Points: 2
colour coding multiple words
« on: August 21, 2006, 09:24:26 am »
Hi Everyone!

I'm new to SlickEdit (was an old Codewrite user) and have a question.  I am trying to set up colour coding for reading through Oracle statspack files - so want to be able to colour code different strings :
ie. "log file sync"
"db file sequential read"

I'm having a problem where lexer doesn't seem to like space delimited strings.  I have tried using " around the strings, but this does not help.  Unfortunately I have many of these identifiers, so trying to load them in via the 'get' option is also proving quite fruitless.
I end up getting errors out of SlickEdit  - Error in Lexer definition found - Invalid IDCHARS definition.
This facility is quite important for me, since I deal with large numbers of statspack reports and trace files.

Could someone please point me in the right direction.  I'm sure that there must be a way to do this, but I just haven't found it yet.
If it turns out to be an enhancement / bug fix, how do I progress it?

Many thanks for your help,

Adrian.

Graeme

  • Senior Community Member
  • Posts: 2366
  • Hero Points: 313
Re: colour coding multiple words
« Reply #1 on: August 22, 2006, 10:03:38 am »
Hi Everyone!

I'm new to SlickEdit (was an old Codewrite user) and have a question.  I am trying to set up colour coding for reading through Oracle statspack files - so want to be able to colour code different strings :
ie. "log file sync"
"db file sequential read"

I'm having a problem where lexer doesn't seem to like space delimited strings.  I have tried using " around the strings, but this does not help.  Unfortunately I have many of these identifiers, so trying to load them in via the 'get' option is also proving quite fruitless.
I end up getting errors out of SlickEdit  - Error in Lexer definition found - Invalid IDCHARS definition.
This facility is quite important for me, since I deal with large numbers of statspack reports and trace files.

Could someone please point me in the right direction.  I'm sure that there must be a way to do this, but I just haven't found it yet.
If it turns out to be an enhancement / bug fix, how do I progress it?

Many thanks for your help,

Adrian.

I don't know the answer but there's several things I don't understand about your question.
I guess you've seen on the strings tab of the colour coding dialog there's a large number of options for handling strings.  Are they relevant to your problem and if so, which options do you have enabled?

Which version of slickedit do you use?

What do you mean by "colour code different strings"?  Do you mean you want all strings that are "log file sync" to be the same colour and all strings that are e.g. "abc" to be another colour?

By "space delimited strings" do you mean a string with embedded spaces?

What do you mean "load them in via get" ?

Have you thought of doing the colouring yourself - you could probably write a macro to search for and colour strings.

Graeme


apnakon

  • Community Member
  • Posts: 27
  • Hero Points: 2
Re: colour coding multiple words
« Reply #2 on: August 22, 2006, 12:07:38 pm »
HI Graeme,

Many thanks for your reply - much appreciated.  :)

What I'm trying to do is colour code different Oracle Event types and Statistics types.
Oracle has multitudes of wait events, as well as statistics (I do a great deal of Oracle database tuning).
I'd like to colour the wait events differently from that statistics.

In Codewright, I was able to 'get' these event names from a read-in text file.  I have noticed that this is also possible in SlickEdit,
via the 'tools --> options --> file extension setup'.  I have tried it, with " around the strings I want to colour code, and without " as well.  Unfortunately, it does not work - seems to get very mixed up.

When I try to add the wait event names in manually [as keywords] (via the GUI), I use the " around the event name and can get a few of them in before I hit the error I mentioned in my first email.

I would really appreciate some help with this, since I spend alot of time in these tuning (statspack) reports.  I also have other areas where I would apply the same ideas.

Writing complex macros is not really where I want to be - esp. since I'm new to Slickedit and it seems as if it has the functionality I am after - albeit perhaps not working correctly (or me using it wrongly).

Many Thanks,

Adrian.


hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: colour coding multiple words
« Reply #3 on: August 22, 2006, 01:28:35 pm »
As far as I know Codewrigth (R.I.P.) supported a reg.exp. based colorizer.
Slick only supports 'words' as colorizer tokens...
I afraid you've top add all the stuff you need word by word.

HS2

SlickEdit Support

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 293
  • Hero Points: 26
Re: colour coding multiple words
« Reply #4 on: August 22, 2006, 02:47:40 pm »
@hs2

You are correct.  SlickEdit does not currently implement a regex lexer for color coding strings/keywords/etc.

@apnakon

You will need to add each word individually to the lexer.  Sorry for the inconvenience.
« Last Edit: August 22, 2006, 02:52:09 pm by Ashley »

apnakon

  • Community Member
  • Posts: 27
  • Hero Points: 2
Re: colour coding multiple words
« Reply #5 on: August 22, 2006, 05:05:53 pm »
Hi Guys,

Thanks fornthe replies - much appreciated.

Ashley - can I make a request (please) that regex colourization be added to SlickEdit.  This was a very powerful part of Codewright and I found it very useful many times over.

As an aside, for this particular type of work, I did not use the regex functionality of Codewright.  I could create .txt file of the strings I wanted the lexer to recognize - enclosing the space delimited words with " ".  I have tried this with SlickEdit but the 'get' functionality doesn't seem to recognize the " " pairings correctly - so I am wondering if this is some sort of problem - or the 'get' functionality isn't written that way.

For example, I want to set up a file, one line for each entry like :

"log file sync"
"db file sequential read"
"buffer busy waits"
...
etc.

Slickedit seems to get itself confused with the " " pairings, and adds the new information in the lexer like :

"log
file
sync
"
db
file
...
etc.

Many Thanks for your help,

Adrian.

ps.  *LOVE* to see that regex stuff in Slickedit.  :)

Graeme

  • Senior Community Member
  • Posts: 2366
  • Hero Points: 313
Re: colour coding multiple words
« Reply #6 on: August 22, 2006, 11:11:15 pm »

I still don't really understand what you're trying to do.  I don't know anything about Oracle.
Can you show some actual code with 2 or 3 of these event types and statistic types and how the colouring should look?

Graeme

Wanderer

  • Senior Community Member
  • Posts: 557
  • Hero Points: 23
Re: colour coding multiple words
« Reply #7 on: August 23, 2006, 12:25:03 am »

I still don't really understand what you're trying to do.  I don't know anything about Oracle.
Can you show some actual code with 2 or 3 of these event types and statistic types and how the colouring should look?

Graeme

Sounds to me like he wants to look at some Oracle file and see this:

blah blah blah log file sync blah blah blah yawn yawn yawn db file sequential read yawn yawn yawn buffer busy waits blah blah blah

apnakon

  • Community Member
  • Posts: 27
  • Hero Points: 2
Re: colour coding multiple words
« Reply #8 on: August 23, 2006, 07:20:44 am »
Hi Guys,

Thanks for the replies!   :)

Wanderer - you're right - and made me laugh!  These files do tend to be full of blah blah blah!  :)

Its pretty much like you said - only that I would colour code (for example) all of the wait events red (ie. log file sync, db file sequential read), the statistics blue (ie. redo size, recursive calls, etc.).

This would make the reporting file much easier to read - and easier to spot trends, issues etc.

Perhaps an easier explanation : just see the above event and stat names as lexer keywords - that's pretty much what I'm trying to achieve.

Thanks,

Adrian.

Graeme

  • Senior Community Member
  • Posts: 2366
  • Hero Points: 313
Re: colour coding multiple words
« Reply #9 on: August 24, 2006, 12:21:42 am »

I know you don't want to write a macro, but just in case you get the desire ...

You could write your own macro to colour code on demand.  You could also run a macro from a one second timer that colour coded say 40 lines before and after the current line  -  colour coding the whole file every one second might take too long.

Very roughly, to colour code the whole file would be something like

_save_pos2;  // save cursor pos
top();
while (true)
{
    find_next_word();
    if (!match_event_name()) { match_stat_name(); }
}
_restore_pos2();

Of course you need to check for end of file too.  find_next_word() would get the next alpha-numeric word.  The match name functions would search an (sorted) array of names (or something), if a match was found then they call find-next-word again to check the second word etc until a complete match is found  - whereupon they would call the _SetTextColor function to colour those words.

I'm not exactly sure what happens when you copy some coloured text or if you insert or delete characters in the middle of coloured text so you might also need some code that scanned through the file and removed all your own colouring before re-doing it.

I could experiment sometime to see if this would work if you're really really keen...  (dunno when though).

Graeme








Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4937
  • Hero Points: 404
Re: colour coding multiple words
« Reply #10 on: September 14, 2006, 07:19:37 pm »
Dennis appears to have fixed "Get..." so its supports double quoted strings (a trivial fix).  This fix will be in 12.0.

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: colour coding multiple words
« Reply #11 on: September 14, 2006, 08:03:23 pm »
What does this mean exactly ?
I assume that 'Get...' will be able to parse lines like this:
"foo bar"
and add the (space) separated items as single tokens (foo, bar) b/c this is a trivial fix.
Or is it a colorizer enhancement supporting multi-word tokens ?

HS2

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4937
  • Hero Points: 404
Re: colour coding multiple words
« Reply #12 on: September 14, 2006, 08:31:14 pm »
The color coding engine already supports keywords with spaces.  Click the "New..." button and type:

 "a b c"   "d e f"

You'll notice that this already works and these strings will get color coded.  The color coding engine matches the exact string (exactly the number of spaces you type).

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2815
  • Hero Points: 426
Re: colour coding multiple words
« Reply #13 on: September 14, 2006, 09:15:42 pm »
Actually, the fix is in the 11.0.2 patch.  "Get..." should now work as Adrian originally requested.

hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: colour coding multiple words
« Reply #14 on: September 15, 2006, 08:29:46 am »
Thanks for the information Clark & Dennis !
Didn't know that multi-word tokens are already handled ...

HS2