Posts

c++ - Overload resolution produces ambiguous call when template parameters added -

in following code compiler can resolve call f() call f(int&, const char*) . the call g() , however, ambiguous. lists 4 overloads possible overload set. if remove , typename t2, std::size_t i template argument list array argument, , hard code them instead, there no ambiguity , compiler picks g(t&, const char*) . how adding 2 template arguments makes ambiguous? can see how, though decay , casting, resolve 1 of overloads, cannot figure out how adding template parameters introduces ambiguity. i have testing on clang 3.8 (unreleased) , vc++ 2015. #include <string> void f(int&, const char*){} void f(int&, char(&)[8]){} void f(int&, bool){} void f(int&, const std::string&){} template <typename t> void g(t&, bool){} template <typename t> void g(t&, const char*){} template <typename t> void g(t&, const std::string&){} template <typename t, typename t2, std::size_t i> void g(t&, t2(&)[i]){} ...

python - Multiplication on slice of pandas dataframe -

i have dataframe this: year a_annex arnston bachelor berg 1955 1.625 0.940 nan nan 1956 1.219 1.018 nan nan 1957 2.090 1.20 nan 1.190 1958 0.950 1.345 nan 1.090 and want multiply in [1:,1:] .404 the code trying is: df=pd.read_csv(r'h:\sheyenne\grazing records\master_amu_complete.csv') hectare=0.404 df=df.iloc[1:,1:] df=df*hectare but returns: typeerror: not operate 0.404686 block values can't multiply sequence non-int of type 'float' printing df.info() says after slice non-null object if helps. yes, problematic value. can find these problematic values function (thanks ajcr): df = df.convert_objects(convert_numeric=true) first nan converted 0 , apply function above , return nan instead of problematic values. have find rows nan values , return subset of original df . pri...

android - Will Cloud Computing ever cost me more than what I am getting from ad revenue? -

i made app , bit cpu intesive. want delegate of work cloud computing. hypothetically, if source of revenue admob ads, there ever situation paying, $200 month more getting ad revenue, on pay-as-you-go plan? or need funding @ first or something? i'm using -> "google compute engine"; pricing: https://cloud.google.com/compute/pricing thank you. only emprical results can answer question. there no theory specific setup. for clue, have gae webapp source of income adsense ads , cost appengine hosting. application runs @ profit now, didn't when volume lower. according experience there seems "breaking point" going low volume medium when app starts become profitable. if ask whether chances of monetizing app has increased cloud computing, i'd answer yes.

how to schedule a quartz job with scala -

i trying simple example of quartz job running in scala. configure() gets executed once when module loaded. lazy val quartz = stdschedulerfactory.getdefaultscheduler override def configure() = { val job = new job { override def execute(jobexecutioncontext: jobexecutioncontext) = { println("event") } } val job = jobbuilder.newjob(job.getclass) .withidentity("job", "group") .build val trigger: trigger = triggerbuilder .newtrigger .withidentity("trigger", "group") .withschedule( cronschedulebuilder.cronschedule("0/5 * * * * ?")) .build quartz.start quartz.schedulejob(job, trigger) } however, error message when code runs. 2015-09-29 15:27:05,015 [defaultquartzscheduler_quartzschedulerthread] error org.quartz.core.errorlogger - error occured instantiating job executed. job= 'group.job' org.quartz.schedulerexception: problem instantiating class 'com.s...

ios - NSDateFormatter Returning Unexpected Time Values -

can explain me why following code returns inconsistent time values? i've been getting incorrect results when trying create nsdate object user specified date/time string , i've put following code below illustrate problem. // create 2 strings containing current date , time nsdateformatter * dateformat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"yyyy-mm-dd"]; nsdateformatter * timeformat = [[nsdateformatter alloc] init]; [timeformat setdateformat:@"hh:mm:ss a"]; timeformat.amsymbol = @"am"; timeformat.pmsymbol = @"pm"; timeformat.timezone = [nstimezone timezonewithabbreviation:@"edt"]; nsdate * = [[nsdate alloc] init]; nsstring *thedate = [dateformat stringfromdate:now]; nsstring *thetime = [timeformat stringfromdate:now]; nslog(@"the current date/time (gtm): %@", now); nslog(@"the current date/time (edt): %@ %@", thedate, thetime); // combine date , time strings nsmutabl...

vector - How do I limit a for-loop in GLSL with a Vec3 as iterator? -

vec3 origin = vec3(0,0,0); vec3 stepvalue = vec3(0,1,0); vec3 destination = origin + (10*stepvalue); (vec3 stepper; stepper==destination; stepper += stepvalue) this not actual code, example doing same thing, except vectors aren't clean , easy these. this not work. loop not iterate @ all! using ... for(vec3 stepper; stepper==stepper; stepper += stepvalue) ... iterates through loop either until driver crashes, or until loop terminates manually. the operaters > , < , >= , <= aren't allowed vectors , lessthan / greaterthan neither. so how work this, besides running infinite loops? is there other option besides using == ? thanks! for (vec3 stepper = origin; all(lessthan(stepper, destination)); stepper += stepvalue) lessthan , lessthanequal , return bvec* can evaluated boolean value using functions all , any . however, aware still not iterate in example, since x , z of destination 0 , not >= stepper.

javascript - why is first child of the body undefined? -

it runs ok on body outputs undefined on first child. doing wrong? function doit(e) { console.log('tag: ' + e.tagname); console.log('nt: ' + e.nodetype); (var childelement in e.children) { doit(childelement); } } doit(document.body); <body> <ul id="fork"> <li id="myli" class="myclass">hello</li> </ul> </body> edit: this helped me finish css cleaner. check out [jsfiddle] for...in loops iterate enumerable properties, want iterate values. then, for (var prop in e.children) doit(e.children[prop]); however, that's bad way of iterating array-like objects. better use for (var = 0; i<e.children.length; ++i) doit(e.children[i]); or es5 array methods [].foreach.call(e.children, doit); function doit(e) { console.log('tag: ' + e.tagname); console.log('nt: ' + e.nodetype); ...