Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Use Perl to edit HTML files -


the output below generated third party tool validates xml files against xml schema. output validation errors. ok, little context.

from errors above displayed in html, want able perform "syntax highlighting" using perl. instance, want able highlight parts of text above.

specifically, want colour text conforms "line [0-9]*" bold , in red. i've tried experiment regex search , replace i've not been successful.

any pointers/hints fantastic.

thank you!

line 8: element 'alphabet', attribute 'letters': value 'xyz' not match fixed value constraint 'abc'. line 185: element 'drink': attribute 'coffee' required missing. line 254: element 'timeout': element not expected. line 269: element 'commands': element not expected. expected 1 of ( eat, drink, sleep ). line 812: element 'software': attribute 'version' required missing. line 876: element 'windows-software': attribute 'version' required missing. line 890: element 'contact': attribute 'telephone' required missing. line 890: element 'operating': attribute 'mode' required missing. 

have try this:

#!/usr/bin/perl  use strict; use warnings;  while(<data>) {     s#(line \d+)#<span style="font-weight:bold;color:red;">$1</span>#;     s#(element\s|attribute\s)('[^']*')#$1<span style="font-weight:bold;color:blue;">$2</span>#g;     print }  __data__ line 8: element 'alphabet', attribute 'letters': value 'xyz' not match fixed value constraint 'abc'. line 185: element 'drink': attribute 'coffee' required missing. line 254: element 'timeout': element not expected. 

output

<span style="font-weight:bold;color:red;">line 8</span>: element <span style="font-weight:bold;color:blue;">'alphabet'</span>, attribute <span style="font-weight:bold;color:blue;">'letters'</span>: value 'xyz' not match fixed value constraint 'abc'. <span style="font-weight:bold;color:red;">line 185</span>: element <span style="font-weight:bold;color:blue;">'drink'</span>: attribute <span style="font-weight:bold;color:blue;">'coffee'</span> required missing. <span style="font-weight:bold;color:red;">line 254</span>: element <span style="font-weight:bold;color:blue;">'timeout'</span>: element not expected. 

instead of style attribut, can use css class.

s#(line \d+)#<span class="bold_red">$1</span>#; 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -