Posts

oop - Javascript OO / jQuery.class() plug in causing problems -

i'm working code uses jquery plugin give class style inheritance( http://v3.javascriptmvc.com/docs/jquery.class.html#&who=jquery.class ). it's causing me lot of problems. in particular, class evaluated before called. when try do: $.class.extend('mountain',{ //@static init: function() { this.elev = new google.maps.elevationservice(); } }); i can't because code run before google maps loads, leading undefined error. hoping attach listener google maps load event , call mountain.inti(), while can original class runs before i've load event, still causing error. any advice? perhaps diagnosis wrong? running in meteor, though i'm not sure if that's relevant...

marionette - Better to call child view method directly from parent, or by initiating a trigger? -

i've got complex backbone/marionette app , i'm venting things out parent elements . when need trigger things in children parent elements though, it's little unclear me how should doing this. easiest thing call method on child parent, but, wonder if "cheating" in case (and perhaps causing memory leak issues or something?) , i'm curious "right" way. here's jsfiddle of extremely simplified contrived version of code. a gist of same contrived example in require based app . <header> <h4>a subview/view trigger event loop playground</h4> <p>open console , click button</p> </header> <article id="main"> </article> <script type="text/html" id="mysubview"> <button type="button" id="button">click me</button> </script> <script type="text/html" id="myview"> <div id="myregion"...

python - Reverse Z Axis on matplotlib 3D Plot -

Image
how 1 reverse order on z axis of 3d plot (i.e. negative up, , positive down)? following code produces cone base pointing downward; there command (like ax.reverse_zlim3d(true) or something?) can used change tick order? the following code plots cone base pointing downward. reverse z-axis order plots base pointing up, ice cream cone, -1 @ top of graph instead of bottom. from matplotlib import pyplot p mpl_toolkits.mplot3d import axes3d # @unusedimport import numpy np math import pi, cos, sin z = np.arange(0, 1, 0.02) theta = np.arange(0, 2 * pi + pi / 50, pi / 50) fig = p.figure() axes1 = fig.add_subplot(111, projection='3d') zval in z: x = zval * np.array([cos(q) q in theta]) y = zval * np.array([sin(q) q in theta]) axes1.plot(x, y, -zval, 'b-') axes1.set_xlabel("x label") axes1.set_ylabel("y label") axes1.set_zlabel("z label") p.show() use invert_zaxis method of axes3d : from matplotlib import pyplo...

ios - Can an OpenGLES 2.0 framebuffer be bound to a texture and a renderbuffer at the same time? -

brad larson provides great code here , here 'rendering scene texture-backed framebuffer', it's not clear whether same framebuffer use rest of drawing. if attach renderbuffer framebuffer, can framebuffer render texture same call? sounds might bit confused fbo usage. if need it, should started: apple developer - drawing offscreen . this too. renderbuffer can bind fbo (framebuffer object). fbo create when don't want rendering displayed immediately, want read rendering result or perform additional rendering it. way fbos work in opengl es 2.0, have 1 color attachment point available (gl_color_attachment0 - fragment shader output variable gl_fragcolor connected attachment point), , can have 1 texture or renderbuffer attached it. answer last question, cannot have fbo simultaneously write color renderbuffer , texture. as first part of question, depends whether using fbo or default framebuffer. chances behavior you're looking this: bind fbo render t...

python - pygame.error Unsupported image format -

running python 3.3.0 pygame '1.9.2pre', following tutorial, new python, cant see i've gone wrong, looks same on tutorial, 4 years old. help! i error - unsupported image format both. i've tried jpg , png, version spec says supports them both. bif ="bg.jpg" mif ="man.jpg" import pygame, sys pygame.locals import * pygame.init() screen = pygame.display.set_mode((1100,750),0,32) background = pygame.image.load(bif).convert() mouse_c = pygame.image.load(mif).convert_alpha() running = true while running: event in pygame.event.get(): if event.type == quit: pygame.quit() running = false sys.exit() break screen.blit(background,(0,0)) x,y = pygame.mouse.get_pos() x -= mouse_r.get_width()/2 y -= mouse_r.get_height()/2 screen.blit(mouse_r,(x,y)) pygame.display.update() i assume pygame window not shutting due error in code. can exit python shell exit pygame...

node.js - Inaccessible module error in TypeScript declaration file -

c:/node/typescript experiment/node_modules/.bin/tsc.cmd" --sourcemap mongoose.d.ts --module commonjs c:/node/typescript experiment/d.ts/mongoose.d.ts(96,35): error ts2049: parameter 'res' of exported function using inaccessible module c:/node/typescript experiment/d.ts/mongoose.d.ts(97,54): error ts2049: parameter 'res' of exported function using inaccessible module this error, i've included source code well, ///<reference path='definitelytyped/node/node.d.ts' /> export = m; declare module m { export interface mongoose { constructor(); set (key: string, value: string): mongoose; (key: string): string; createconnection(uri?: string, options?: any): connection; connect(any): mongoose; disconnect(fn: (err?: any) => void ): mongoose; model(name: string, schema?: schema, collection?: string, skipinit?: boolean): model; modelnames(): string[]; plugin(fn: (any) =...

sql - logic behind deletion of duplicate rows? -

what logic behind deletion of duplicate rows? got know query used delete duplicate rows. delete tvsemp e rowid>(select min(rowid) tvsemp m e.ename=m.ename); here when divided subquery i.e first select min(m.rowid) tvsemp e, tvsemp m e.ename=m.ename; result rowid min(m.rowid) ___________________ aaaeduaabaaakiqaap then outer query select ename tvsemp emp rowid>'aaaeduaabaaakiqaap' getting n-1 results(except 1 eliminated using '>' sin) my doubt if 2 combined getting exact table without duplicate why this? are asking if first query work? delete tvsemp e rowid>(select min(rowid) tvsemp m e.ename=m.ename); the answer "yes". as how works, subquery correlated subquery , means references outer query. oracle executes subquery each row of tvsemp e , , e.ename = m.ename in subquery limits subquery's results rows ename equals ename in outer query's current row. getting n - 1 results want: if there 4 rows name chay ,...