Posts

javascript - How do I delete local row data and maintain pagination with jqGrid? -

i have multi-page table using jqgrid. use $obj.jqgrid('delrowdata',id) delete rows on first page (the function called every row selected). however, end result empty first page second in mind should become first page left untouched. there else need call consolidate pages in grid?

c - What does this program do? (Self calling main function + getchar) -

can me explain question past exam paper? when compile it, never satisfied input. also, reason self calling main function? what following program do? justify answer. #include <stdio.h> int main ( void ) { int c; if (( c = getchar() ) != eof) { main(); printf("%c", c); } return 0; } the program is satisfied, eof returned getchar() , achieved entering ctrl^z (windows console) or ctrl-d (linux). program continue recurse until happens (unless stack breaks). after getting eof drops out of recursion printing inputs in reverse order (including character representing eof ). note eof typed must first keystroke after enter key.

Python: Using the same function as both a generator and a regular function -

is possible use function both regular function (that stuff , returns) , generator function? suppose have following code: def __init__(self): self.make_generator = false def foo(self): gen = (x x in my_list) x in gen: # stuff if self.make_generator: yield # return raise stopiteration return the idea here if self.make_generator false, don't want foo yield; want not generator can call like: foo() and if wanted yield between iterations, i'd make generator so: def __init__(self): self.make_generator = true self.foo_gen = self.foo() def run(self): while true: self.foo_gen.next() but seems not possible. want keep code dry not sure how can control when foo generator , when executes regular function. thanks!

c# - Reload LongListSelector with updated data from local database - Windows Phone 8 -

i having issue longlistselector on windows phone 8 application. after selecting , editing record longlistselector , submitting changes local database, longlistselector doesn't show updated name,unless close , reopen application. data being updated, not showing. there way have list select while app still open? xaml list: <!--contentpanel - place additional content here--> <grid x:name="contentpanel" grid.row="1" margin="12,0,12,0"> <phone:longlistselector x:name="llsmodules" margin="0,0,-12,0" itemssource="{binding modules}" selectionchanged="llsmodules_selectionchanged"> <phone:longlistselector.itemtemplate> <datatemplate> <stackpanel margin="0,0,0,17"> <stackpanel orientation="...

bitmap - Android: Generated QR code using Zxing has margins (is not fit to the area) -

Image
i'm using in app zxing library generating qr code. want generated qr code should fits width of screen (maybe small padding). if set width of screen width size of qr code smaller qr code. @ screenshot (it's 320x240 resolution). want qr code fit black area. why qr code in red small? how stretch black area? my code: display display = getwindowmanager().getdefaultdisplay(); point size = new point(); display.getsize(size); int width = size.x; bitmap bm = encodeasbitmap(mgeneratedurl, barcodeformat.qr_code, width, width); qrcodeimage.setimagebitmap(bm); generating qr code: private bitmap encodeasbitmap(string contents, barcodeformat format, int img_width, int img_height) throws writerexception { string contentstoencode = contents; if (contentstoencode == null) { return null; } map<encodehinttype, object> hints = null; string encoding = guessappropriateencoding(contentstoencode); if (encoding != null) { hints = new enum...

excel - Maximum of Multiple Named Ranges -

i having lot of trouble one. want replicate value in vba: =max(max(named_range1),max(named_range2),max(named_range3)) i having impossible time trying done. if 3 ranges in same sheet then: sub maxmax() dim r range set r = union(range(named_range1), range(named_range2), range(named_range3)) msgbox application.worksheetfunction.max(r) end sub

store - Save increment in C -

i need little i'm writing c. so have this: int a; int 1 = 4; int 2 = 3; printf("if have done write '1', if have done write '2' "); scanf("%d" ,&a); if (a=1) { 1 = one+1; } else if (a=2) { 2 = two+1 } so thing want save increment next time open program, values of int 1 , 2 change based on last usage of program. how do ? use fopen/fread/fclose when start application (before write checks if file handle correctly created) use fopen/fwrite/fclose when exit application. how access file? basic functionalities, read this: http://www.thegeekstuff.com/2012/07/c-file-handling/