Posts

c# - Change specific cell color depending on it's data -

i have datagrid view connected access database there column called status . want when cell in column changed ready background color of cell changes green , if not ready changes red. suggestions? on databound function of grid can check cell condition , color cell. example: protected void grd_databound(object sender, eventargs e) { foreach (gridviewrow gr in grd.rows) { //here run loop on rows , check value of cell of column name status gr.cells[index of cell].backcolor = system.drawing.color.cyan; } } hope might you.

ios - How to display hh:mm:ss in NSTimer? -

hello i'm trying make simple countdown app. however countdown in seconds , not in minutes , hours. how make such? create timer: timer = [nstimer scheduledtimerwithtimeinterval: 1.0 target:self selector:@selector(countdown) userinfo:nil repeats: yes]; countdown method: -(void) countdown { int hours, minutes, seconds; secondsleft--; hours = secondsleft / 3600; minutes = (secondsleft % 3600) / 60; seconds = (secondsleft %3600) % 60; label.text = [nsstring stringwithformat:@"%02d:%02d:%02d", hours, minutes, seconds]; } reference : https://developer.apple.com/library/ios/documentation/cocoa/conceptual/timers/articles/usingtimers.html

grails - Name for this M:M pattern -

in grails there 2 ways m:m associations. firstly, have collection on both sides. gorm figure out intermediately table , encapsulated away. the second way have 3 objects, third object representing connecting table. approach means more code means can add columns actual relationship table easily. is there name second approach? i'm not aware of names these different approaches. database point-of-view aren't different approaches, because in both cases have n:n relationship join table (this refer "the intermediately [sic] table"), in 1 case have additional columns (to foreign keys) in join table at gorm level, approaches more different because in 1 case have domain class (mapped join table), again, i'm not aware of specifics names these different approaches.

android - How call onDraw method from another method to draw dynamically? -

i want redraw view method (say setprogress) in class extending view. how can this. my view class is public class spinview extends view { private paint paint; private context context; private canvas canvas; private rectf arcoval; public spinview(context context) { super(context); this.context = context; } public spinview(context context, attributeset attrs) { super(context, attrs, 0); this.context = context; } public spinview(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); this.context = context; } @override protected void ondraw(canvas canvas) { super.ondraw(canvas); this.canvas = canvas; display d = ((windowmanager)context.getsystemservice(context.window_service)).getdefaultdisplay(); int width = d.getwidth(); int height = d.getheight(); arcoval = new rectf((width/2-50), (height/2-50), (width/...

Convert a raw TwoTuple to TwoTuple<A,B> in a wrong way but didn't get any warning(Java Generics) -

enviroment: java se 7,eclipse 4.2 there r codes : code 1: import java.io.bytearrayoutputstream; public class tuple { static twotuple<string, integer> f() { return tuple("hi", 47); } static twotuple f2(){ return tuple(new bytearrayoutputstream(), 47); } public static <a,b> twotuple<a,b> tuple(a ,b b) { return new twotuple<a, b>(a, b); } public static void main(string[] args) { twotuple<string, integer> tt = f(); twotuple<boolean, integer> tt2 = f2(); // there wrong system.out.println(tt); system.out.println(tt2); } } code 2: public class twotuple<a,b> { private final a ; private final b b ; public twotuple(a f , b s) { // todo auto-generated constructor stub a= f; b=s; } @override public string tostring() { // todo auto-generated method stub return "a : " +a+ ...

r - Converting data.frame to xts order.by requires an appropriate time-based object -

i have following data frame: > head(table,10) date open high low close volume adj.close 1 2014-04-11 32.64 33.48 32.15 32.87 28040700 32.87 2 2014-04-10 34.88 34.98 33.09 33.40 33970700 33.40 3 2014-04-09 34.19 35.00 33.95 34.87 21597500 34.87 4 2014-04-08 33.10 34.43 33.02 33.83 35440300 33.83 5 2014-04-07 34.11 34.37 32.53 33.07 47770200 33.07 6 2014-04-04 36.01 36.05 33.83 34.26 41049900 34.26 7 2014-04-03 36.66 36.79 35.51 35.76 16792000 35.76 8 2014-04-02 36.68 36.86 36.56 36.64 14522800 36.64 9 2014-04-01 36.16 36.86 36.15 36.49 15734000 36.49 10 2014-03-31 36.46 36.58 35.73 35.90 15153200 35.90 i trying make xts file using > table3<-xts(table[,-1],order.by=table$date) but error: error in xts(table[, -1], order.by = table$date) : order.by requires appropriate time-based object where did go wrong? thought table$date organized time-based. ?xts says following order.by : cur...

android - Capture entire content of EditText into a picture -

i have print entire text of text field picture. reason is: have exchange messages unsupported utf-8 characters between android , other web clients. unsupported utf-8 characters mean missing fonts in android (see this topic here ). tried use direct way bitmap b; edittext edittext = (edittext) findviewbyid(r.id.edittext); edittext.builddrawingcache(); b = edittext.getdrawingcache(); edittext.destroydrawingcache(); which works charm until have multiple lines: solution captures text visible user instead of complete text inside of long text field (scrollbars!). i tried workaround generating picture stackoverflow answer . prints entire text not respect text formatting newlines. don't want handle stuff myself. i forced use android 4.3 , earlier versions. is there smart way capture text pictures? if not: is possible modify code above work expected? after searching 24 hours solution ran into solution webview . trick is generate view hold content avoid marker ed...