I need to wrap text nicely. E.g. "WWWW WWWW" takes more space than "1111 1111".
I have a design to make a for loop and add words one by one and see if text is too long to fit the row.
How to count properly the text.textWidth() without drawing text to the screen 1st?
System.Wait() seems to be required to make textwidth value refresh, is there any workaround for this? I don't want to add sleep into for loop, it would take ages.
len(text.text) to count the text, use len(str(text.text)) if combinated number and text
checkout full documentation here
I want to search for multiple strings in Vim/gVim and have them highlighted in different colours. Is there a way of doing this with out-the-box Vim or with a plug-in?
There are two simple ways to highlight multiple words in vim editor.
Go to search mode i.e. type '/' and then type \v followed by the words you want to search separated by '|' (pipe).
E.g.: /\vword1|word2|word3
Go to search mode and type the words you want to search separated by '\|'.
E.g.: /word1\|word2\|word3
Basically the first way puts you in the regular expression mode so that you do not need to put any extra back slashes before every pipe or other delimiters used for searching.
This can be done manually, without any script, for two search patterns.
:match Search /pattern/
:match Search /<CTRL-R>/ # highlight the current search pattern
Search is the name of the highlight group, use the completion to select another group to highlight with a different color.
:match <TAB>
:match <TAB> # completion will list all highlight group
This an be handy when you cannot use your own vim configuration.
:match none # clear the match pattern to stop highlighting
For searching multiple strings in vim you can do like:
/search1\|search2
This works, and will highlight both search1 and search2, but with same color.
You have to do this in vim editor.
Try "Highlight multiple words", which uses matchadd().
Yes, out-of-the-box you can use matchadd().
To add a highlight, eg. for trailing whitespace:
:highlight ExtraWhitespace ctermbg=grey guibg=grey
:call matchadd('ExtraWhitespace', '\s\+$', 11)
To view all matches:
:echo getmatches()
To remove matches use matchdelete(). Eg.:
:call matchdelete(7)
:%s /red\|green\|blue/
I am not sure about how to keep different colors for different keyword though. Thanks.
MultipleSearch : Highlight multiple searches at the same time, each with a different color.
http://www.vim.org/scripts/script.php?script_id=479
:Search <pattern1> //will highlight all occurences of <pattern1> in the current buffer.
A subsequent :Search <pattern2> will highlight all occurences of <pattern2> in the current buffer.
My Mark plugin can highlight several words in different colors simultaneously, like the built-in search. It comes with many mappings and commands, allows to persist the patterns, and supports multiple color palettes.
MultipleSearch2 is another script which is integrated with vim's search:
http://www.vim.org/scripts/script.php?script_id=1183
I prefer highlight plugin, simple and enough, can highlight different words with differently colors automatically.
http://www.vim.org/scripts/script.php?script_id=1599
I'm creating a TimeSeries chart with 2 TimeSerieses in it (i.e. A Dataset holding 2 TimeSeries objects.
It happens that both TimeSeries objects holds the same exact values and they are simply overlapping but that's not clear to the client as he only sees the result color or mixing the colors of both TimeSeries objects !
So he's seeing that the chart is displaying 2 sets of data, while only one line is drawn !
Is their a build-in way to deal with that ? How would you fix that ?
Personally I'm thinking of splitting this chart into 2 for it to be clear to the customer but I'm wondering if there is a way with less effort\more efficient to solve this situation.
EDIT: Final output should be images so this isn't a desktop application (i.e. Swing)
Thank you.
One approach is to let the user control series visibility using a suitable Action, a shown in this example.
I'm using celerity to do some screen scraping and have come across the need to identify text elements that are in bold. Celerity offers a strong method but does not offer a bold method. Has anyone figured out a clever way around this with Celerity or other tool. I tried using:
browser.html.gsub!(<b>,<strong>)
browser.html.gsub!(</b>,</strong>)
I though I could replace the bold elements with strong elements and then simply use celerity's strong method, but this didn't seem to work.
Thanks in advance for your help.
It seems strange that b is missing but you can try:
browser.elements_by_xpath('//b').each do |b|
puts "#{b} is a bold tag"
end
To outline: I have a parser that grabs Cell references using the following regex
"$"?{letter}{1,2}"$"?{digit}{1,3}
I cant seem to find an elegant way to split the resulting char* into its row, and column components.
ex. split a1 into a and 1
or
split $aa$4 into fixed_col a fixed row 4
Any help is appreciated.
Are you using a regex library? If so does it support accessing grouped parts of the regex, something like:
("$"?)({letter})({1,2})("$"?)({digit}{1,3})
(This article shows the technique using the .NET regex library)
If that isn't an option, then building a simple state machine would work well, and be easy to maintain and test.