Posts

Featured post

visual studio 2010 - Error on RDLC Expression -

i using exp calculate total fees paid on rdlc report: =sum(iif(fields!responsedescription.value ="approved successful",int(fields!amount.value), 0)) and #error in resulting column , can issue ? . and similar exp above work fine : =sum(iif(fields!responsedescription.value <> "",int(fields!amount.value), 0)) few notes: 1- amount integer , present. 2- responsedescription string , present. thank you you can use expression: =sum(cint(iif(fields!responsedescription.value ="approved successful", fields!amount.value, 0))) you have convert every possible values same type before aggregation. i think second expression works fine because in true case ( fields!responsedescription.value <> "" ) used expression converted integer .

javascript - Why is this 2d array pushing values when it shouldn't? -

edited: pointing out oblivious mistake temprndnumber being reset in inner loop. i'm still seeing "," characters show in array though. i want create 2d array gets populated when random number meets particular criteria (rnd >= 7). following code populates 2d array combination of "," , numbers meets criteria. var tempallrndnumbers = []; (var = 0; < 10; i++) { (var j = 0; j < 10; j++) { var temprndnumber = []; var rndnumber = math.floor(math.random() * 10); if (rndnumber >= 7) { temprndnumber.push(rndnumber); } } tempallrndnumbers.push(temprndnumber); } tempallrndnumbers should populated numbers 7 , above, right? instead, i'm getting 2d array full of "," , numbers 7 , above. since reset temprndnumber empty array on each iteration of j loop, contain number if last iteration >= 7. move initialization outside of innermost l

math - Calculating exp(x) with the use of recursion in Python -

this question has answer here: python division 11 answers i'm attempting calculate e^x using recursion, e^x = e^(x/2)*e^(x/2), , third order maclaurin expansion e^x , script keeps returning 1. i'm not looking higher accuracy solution, understand script goes wrong : ) my thought enough iterations should end (1+x/n+(x/n)^2/2)^n when function value goes below limit. def exp(x): if abs(x)<0.0001: return 1+x+x**2/2 else: y=exp(x/2) return y*y try instead (note 2.0 in recursive call): def exp(x): if abs(x) < 0.0001: return 1 + x + x**2 / 2.0 else: y = exp(x / 2.0) return y * y it failing because if pass integer in x , 1 , x / 2 integer division (in python 2.x), result in 0 instead of 0.5 . using x / 2.0 , forces python use float division.

c# - how to read all files in particular folder and filter more than one type? -

this question has answer here: how filter directory.enumeratefiles multiple criteria? 6 answers to loop through files of 1 type, : foreach (string file in directory.enumeratefiles(folderpath, "*.txt")) { (code here) } taken how read files inside particular folder is there way have 2 tags other making 2 loops? having *.bmp, *.png... note : answer accepted down here way more simple 1 in proposed answer, both works. you can concatenate 2 results this foreach (string file in directory.enumeratefiles(folderpath, "*.txt").concat(directory.enumeratefiles(folderpath, "*.bmp"))) { // (code here) } or make function so ienumerable<string> enumeratefiles(string folderpath, params string[] patterns) { return patterns.selectmany(pattern => directory.enumeratefiles(folderpath, pattern)); }

What's a clean way to sharing common markup among partials in Rails? -

assume have image viewer partial, image viewer shown both visitors , admins. admins should have additional buttons remove/edit images, while else remains same both visitors , admins. what's clean approach keep views dry without clogging them if statements everywhere? here's how i'm doing it: image_partial.html.haml : .image %img if is_admin? .admin-stuff-here what's clean way achieve same results separated views(for admins/visitors) without duplicating same markup? if admin functionality nested within single dom element (not spread out throughout html _image_partial.haml.erb file) , conditionally include _admin_controls.haml.erb partial. maybe makes sense have these nested within directory. - app/views/_image_viewer |- viewer.haml.erb |- admin_control.haml.erb and within _viewer.haml.erb .image %img = render partial "_image_viewer/admin_control" if is_admin?

macro use in array initialization -

i'm pretty confused bit of code in microchip demo application pic24f microcontroller. looks macro being assigned @ runtime address of array. didn't think possible, limited knowledge of c failing me right now. able provide insight? #define mbr_addr_tag #define mbr_attributes __attribute__((space(psv), address(drv_fileio_internal_flash_config_files_address))) ... const uint8_t mbr_attributes masterbootrecord[fileio_config_media_sector_size] mbr_addr_tag = {....}

swift - UIButton action generates a SIGABRT but no breakpoint triggers -

i have code create button on storyboard override func viewdidload() { super.viewdidload() ... signupbutton.addtarget(self, action: "pressed:", forcontrolevents: .touchupinside) ... } func pressed(sender:uibutton!) { println("pressed") } however, throws sigabrt error when press button. so, added breakpoint on exceptions. however, no breakpoint ever - threw exception. how find out what's causing error? you have 2 issues here... first: placed pressed function in scope of viewdidload, when needs outside of function , in scope of class. move function pressed out of viewdidload() . second: not causein signal abort crash, needed nonetheless. add semicolon action selector name. signupbutton.addtarget(self, action: "pressed:", forcontrolevents: .touchupinside) or, if don't need pass object function pressed , change function header func pressed() . basic example: (tested , working in new project