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.

unix - Drawing tables in terminal using ANSI box characters -


i'm trying print table that's more pleasant eye pure text representation of it. want convert this:

+-----+--------+ | age | weight | +-----+--------+ | 10  | 100    | | 80  | 500    | +-----+--------+ 

to this:

┌─────┬────────┐ | age | weight | ├─────┼────────┤ │ 10  │   100  │ │ 80  │  500   │ └─────┴────────┘ 

here screenshot of see in terminal:

in terminal looks this

notice gaps between rows. problem not connecting while other unix tools use ansi printing fine in terminal. example, tree, if run tree -a in terminal `i this:

tree in terminal

notice how vertical lines connected together. it's funny because when copy , paste output of tree text editor , run script this:

tree in code

obviously i'm missing printing ansi chars in terminal , couldn't find googling it. can shed light on topic?

i guess should answer own question. after little research , of friend , boss ,linus, found need force terminal go graphical mode first, print special characters , return text mode. ascii code switching graphical mode 14 , 15 return text mode. here code in ruby:

printf("%c\n", 14) printf("%c ", 0x6a) # ┘ printf("%c ", 0x6b) # ┐ printf("%c ", 0x6c) # ┌ printf("%c ", 0x6d) # └ printf("%c ", 0x6e) # ┼  printf("%c ", 0x71) # ─ printf("%c ", 0x74) # ├ printf("%c ", 0x75) # ┤ printf("%c ", 0x76) # ┴ printf("%c ", 0x77) # ┬ printf("%c\n", 0x78) # │   = sprintf("%c", 0x6c) + # ┌ sprintf("%c", 0x71) + # ─ sprintf("%c", 0x71) + # ─ sprintf("%c", 0x71) + # ─ sprintf("%c", 0x71) + # ─ sprintf("%c", 0x71) + # ─ sprintf("%c", 0x71) + # ─ sprintf("%c\n", 0x6b) +  # ┐ sprintf("%c", 0x78) + # │ #print("      ") "      " +  sprintf("%c\n", 0x78) + # │ sprintf("%c", 0x6d) + # └ sprintf("%c", 0x71) + # ─ sprintf("%c", 0x71) + # ─ sprintf("%c", 0x71) + # ─ sprintf("%c", 0x71) + # ─ sprintf("%c", 0x71) + # ─ sprintf("%c", 0x71) + # ─ sprintf("%c", 0x6a)  # ┘  puts  printf("%c\n", 15) 

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 -