Posts

Python 3 Strange Metaclass Behaviour -

i playing metaclasses in python 3: class m(type): def __new__(cls, clsname, bases, attrs): name, attr in attrs.items(): if callable(attr): attrs[name] = attr return type.__new__(cls, clsname, bases, attrs) class c(metaclass=m): def f(self, x): print(x) if __name__ == '__main__': c = c() c.f(1) c.f(2) nothing special far, hook creation of class, , substitute method with... well, itself, no wonder works. with: class m(type): def __new__(cls, clsname, bases, attrs): name, func in attrs.items(): if callable(func): attrs[name] = lambda *args, **kwds: func(*args, **kwds) return type.__new__(cls, clsname, bases, attrs) it sometime works, , doesn't: user$ python test.py 1 2 user$ python test.py traceback (most recent call last): file "./meta.py", line 23, in <module> main() file "./meta.py", line 19, in main in...

asp.net mvc - Having trouble building an MVC application with MSBuild -

i've installed cruisecontrol on staging server , i'm trying compile solution using msbuild. 1 of projects mvc web application running .net 4.5. have, of course, installed .net 4.5 on machine. have deployed site staging site on same server, , runs fine. ... when try build on command line msbuild project.csproj following error: (corecompile target) -> controllers\admincontroller.cs(12,36): error cs0246: type or namespace name 'controller' not found (are missing using directive or assembly reference?) [f:\cruisecontrol\workingdirectory\project.csproj] it seems msbuild can't see of mvc objects such controller. they're on machine, , asp.net can see them or website wouldn't run. i'm running msbuild c:\windows\microsoft.net\framework64\v4.0.30319 directory. it seems need install mvc on build server. had been under impression part of framework now, guess it's still separate install.

How to wrap each object of a Collection in Java? -

i have class foo made equivalence wrapper class wrappedfoo change equals() contract in parts of program. i need convert foo objects wrappedfoo objects , vice versa in many places. need convert collection s of foo s , wrappedfoo 1 another. there way can achieve in generic way? basically want method this: public static collection<wrappedfoo> wrapcollection(collection<foo> collection) the problem don't know kind of collection implementation used , wish keep same implementation resulting collection . using reflection api, (notice 0 in method name): public static collection<wrapperfoo> wrapcollection0(collection<foo> src) { try { class<? extends collection> clazz = src.getclass(); collection dst = clazz.newinstance(); (foo foo : src) { dst.add(new wrapperfoo(foo)); } return dst; } catch(exception e) { e.printstacktrace(); return null...

java - CXF client deserializes a SOAP message to null with WS addressing -

i have cxf client uses mapaggregator , mapcodec in , out interceptors call soap web service uses ws addressing. i'm logging soap messages. seems message returns correctly (the logger logs correct response), cxf deserializes null instead of expected response class. why happening? the problem resolved removing mapaggregator , mapcodec in interceptors.

java - Extending SupportMapFragment - how to instantiate new fragment? -

in documentation mapfragment , supportmapfragment create new fragment calling newinstance() instead of using new supportmapfragment() . my app project extends supportmapfragment , , tried call mymapfragment.newinstance() on fragment class, resulting in map showing expected none of overridden methods such oncreateview() , onactivitycreated() being called. took me while before tried instantiating fragment using new mymapfragment() instead - , voĆ­la, overridden methods started getting called! i didn't override newinstance() in class, , in hindsight it's obvious newinstance() returns instance of supportmapfragment , not instance of extended class (duh!). but question - why is there newinstance() method , why documentation use it, when seems work using new supportmapfragment() ? what's difference of using 1 or other? haven't been able find source code supportmapfragment, so... in case believe newinstance method static factory method empty const...

asp.net - Interacting with QuickBooks Online V3 API -

i'm writing web application (that not published intuit on app center thing) interact quickbooks online (qbo) syncing purposes, using vb.net , asp.net. i'm having hard time understanding how or start. understand this: user accesses web application , "connect quickbooks" button (that intuit requires in-app authorization) displayed. before button clicked send http request oauth request credentials using consumer credentials. once user clicks button redirected quickbooks online (qbo) can sign in , authorize access company, giving authorized request credentials. qbo redirects site indicating have authorized request credentials in send http request access credentials. once have access credentials free interact qbo v3 api. using access credentials can construct http requests send particular http method xml/json in body perform corresponding crud operation in qbo , qbo sends response indicate whether successful or not. when application done interacting qbo make ...

migration - Trying to find the DNN Platform community version that matches my DNN Professional install -

i trying migrate dnn 7.* community edition (for dev server only), , trying find out community edition version matches professional version. hoping find table map professional community versions, haven't been able find anything. knows can find information? the numbers professional edition match community (platform) edition exactly. if on dnn pe 7.0.6, dnn 7.0.6