Posts

scala - tasks and dependencies in Play! framework 2.3 -

i'm trying task in play! that: in build.sbt lazy val hellotask = taskkey[unit]("hello", "description bla bla") hellotask := { mypakage.myclass.update println("well done") } (compile in compile) <<= (compile in compile) dependson hellotask but when execute $ activator tasks it doesn't show "hello" task runs $ activator hello the problem when add references classes (mypakage.myclass.update in example isn't found) thanks lot despite documentation says, can't seem list taskkey , either. works inputkey instead of taskkey . lazy val hellotask = inputkey[unit]("hello", "description bla bla") hellotask := { println("well done") } the other problem dependencies in build.sbt need resolved via sbt plugins. mypakage.myclass must split separate project in order used in build.

Save a file with app state in othe nPause() method in android -

i want write incomplete app state file if user leaves app without saving state. believe have use onpause(). recommended practice? (in onpause() going encrypt string , create file , store it, bit time consuming). if onpause() not place how save state? yes save data onresume() state @override protected void onpause() { // todo auto-generated method stub super.onpause(); // stuff here }

c# - Why is using tolist() not a good approach here? -

this not approach here...! can why? var dbc= new schoolcontext(); var a=dbc.menus.tolist().select(x=> new { x.type.name, listofchildmenus = x.childmenu.select(cm=>cm.name), listofsettings = x.settings.selectmany(set=>set.role) }); because when call .tolist() or .firstordefault() , on (when enumerate), query executed. so when dbc.menus.tolist() bring in memory database menus, , didn't want that. you want bring in memory select ( list of child menus , list of settings ). relevant furter reading : http://www.codeproject.com/articles/652556/can-you-explain-lazy-loading - using lazy loading and if want add filter iqueryable may read difference between ienumerable, iqueryable http://blog.micic.ch/net/iqueryable-vs-ienumerable-vs-ihaveheadache and dinamic filtering https://codereview.stackexchange.com/questions/3560/is-there-...

c# - Castle Windsor Interceptors and Registering by Convention -

i'm using castle windsor manage dependencies application. i'm using classes.fromassemblycontaining register components of given type ifoo<> , register interceptor of these classes. i can interceptor work when register individual components this: public void setupcontainer(iwindsorcontainer container) { container.register(component.for<ifoo>() .implementedby<foo>() .lifestylesingleton().interceptors<myintercepter>()); } however keep registering convention using classes.fromassembly. registration code looks this: public void setupcontainer(iwindsorcontainer container) { container.register(classes.fromassemblycontaining<foo>() .basedon(typeof(ifoo<>)) .withservice.base()); } how add interceptor ifoo<> 's registered? you use configure method add interceptor: public void setu...

vb.net - VB 2010 - Changing the Color of a word in a Textbox (every copy of the word) -

hello , in advance, i have textbox in text being generated. while it's being generated want color word "successfully" green , word "failed" red. i'm using : formtxtbox.find()("successfully") formtxtbox.selectioncolor = color.yellowgreen formtxtbox.selectionfont = new font(formtxtbox.font.fontfamily, formtxtbox.font.size, fontstyle.bold) formtxtbox.deselectall() formtxtbox.find("failed") formtxtbox.selectioncolor = color.red formtxtbox.selectionfont = new font(formtxtbox.font.fontfamily, formtxtbox.font.size, fontstyle.bold) formtxtbox.deselectall() it's working problem have colours first "successfully" or "failed" string, whereas textbox has many copies of word in it. how can make color every copy of these words ? yep, guil said, .find finds first occurrance. https://msdn.microsoft.com/en-us/library/hfcsf75k(v=vs.110).aspx i did find article ,...

sharepoint - Convert "float;#22.0000000000000" into just "22.0" in C# -

i'm doing tostring() on object , output getting float;#22.0000000000000 . need 22.0 . how achieve in c#? additional info: object value number column in sharepoint list. value being retried in code caml query. i'm sure it's use of caml query that's causing me issue. if retrieve item iterating through items in list don't have issue, approach not efficient caml query. update: seems not tostring() that's causing output. object i'm calling tostring() on seems set float;#22.0000000000000 , what's coming straight out of caml query. use given code 22.0 string value = "float;#22.0000000000000"; var number = value.split('#')[1]; double num = double.parse(number); console.writeline(num.tostring("0.0")); result: 22.0 mentioned code should work. item.getformattedvalue("columnname") or try post https://social.msdn.microsoft.com/forums/office/en-us/fdef03db-9678-46cf-8ff7-03551f4b8466/how-to-c...

python - How to display pre-colored string with curses? -

i'm writing curses program in python. i'm beginner of curses i've used terminal control sequences colored output. now there's code snippets print inside window, i'd them syntax highlighted, , it's better done libraries pygments, outputs highlighted code control sequences. initially feed pygments output directly window.addstr() , turned out control sequences escaped , whole highlighted string printed on screen (just this: https://too-young.me/web/repos/curses-highlight.png ). how can display directly curses, cat ? this has been asked several times, same answer: write parser this. related discussion: how use ansi escape codes inside mvwprintw in ncurses? comment on parsing ansi color escape sequences handle escape sequences ncurses? printf handle escape sequences? it not suitable extension ncurses example because: curses produces escape sequences, wide variety of devices (which may not "ansi color escapes"). ncurses (see fa...