Posts

javascript - ...scrollTop($(this)...) -

i have few div s .class class scroll position defined child of parent, need assign scrolltop() $(this) , $(".class").scrolltop($(this).parent().find('.child').scrolltop()); but code doesn't work... $(".class").scrolltop( function(){ $(this).parent().find('.child').scrolltop() } ); doesn't work either. clue? this assuming reading question right. have mulitple "class" elements have own "child" elements. need use each set every element separately. $(".class").each( function(){ var elem = $(this); var childsscrollposition = elem.parent().find('.child').scrolltop(); elem.scrolltop(childsscrollposition); } );

python - setting attribute in current_thread as state holder -

i have wsgi application can potentially run in different python web server environments(cherrypy, uwsgi or gunicorn), not greenlet-based. application handles different paths rest apis , user interfaces. during http call of app there need know, context of call, since implementation logic methods share code of api calls , ui calls , bunch of logic separated in many modules should react differently depending on context. simple , straightforward way pass parameter implementation code, e.g. apicall(caller=client_service_id) or usercall(caller=user_id), it's pain propagate parameter possible modules. solution set context in thread object this? def set_context(ctx): threading.current_thread().ctx = ctx def get_context(): return threading.current_thread().ctx so call set_context somewhere in beginning of http call handler can construct context ovject depending on environment data, , use get_context() in part of code must react depending on context. best practices achive th...

How do you send POST parameters to a function in PHP using Fat-Free-Framework? -

the documentation on website bit lacking ( http://fatfreeframework.com/routing-engine ). want use shorthand expression of post: $f3->route('post /login','auth::login'); how send params auth->login() function above? this alternative way of writing it, bit longer: $f3->route('post /login', function($f3) { $params = $f3->get('post'); $auth = new auth; $auth->login($params['username'], $params['password']); } ); if mean auth::login should automatically receive post data argument, can't. all f3 route handlers receive following arguments: the framework instance the route tokens (if any) see here example. anyway, if auth->login function you're referring one included in framework , couldn't work in manner since login() function is not route handler . returns true or false . route handler has little bit more that: example, reroute user on success or ...

html - Resizing a background image, as it's too big for the browser -

so i'm designing web page incomplete atm, it's missing 2 buttons simple. instead of messing around divs , css styling decided make background in photoshop. created image in resolution of 1920x1080, when apply image background doesn't fit browser window bottom right corner missing. there code can add fix issue or best option recreating image @ smaller resolution , if so, resolution should build for? here link page in case didn't explain enough: http://www.itss.brockport.edu/~rsiss1/cis442/bulletinboard/bulletinboard here code: <?xml version = "1.0" encoding = "utf-8" ?> <!doctype html public "-//w3c//dtd xhtml 1.1//en" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>bulletinboard</title> <style> body {background: url(bulletinboardbg.jpg); background-position: center no-repeat;} </style> </head...

asp.net - variable is not declared it may be inaccessible due to its protection level -

Image
my vb skills not best, , problem has had me stumped few days. in list of controls shown in visual studio not defined in code behind, can "mouseover" them , tooltip text pops right up. similar questions: this 1 had no solution - 'var_name'is not declared. may inaccessible due protection level.' in debug mode this 1 said solution in web.config, don't understand where/how - bc30451: 'mailvalidation' not declared. may inaccessible due protection level this 1 misspelled word - vb.net error: inaccessible due protection level update - here problem might clue problems are: in tools.vb module, have class access ldap. the namespace tools class given in login.aspx.vb code, yet login code not recognize tools class. pay close attention first part of error: "variable not declared" ignore second part: "it may inaccessible due protection level". it's red herring. some questions... (the answers might ...

graphics - graph a function restricted in R -

Image
i'd want plot function: f(x,y)=x^2-2*y, constraint: x+y=1 in graph functions overlap , not seen restricted function f(x,y). appreciate better if x+y-1=0 transparent. mi code in r: x <- seq(-5, 5, length= 10) y <- x fun1<-function(x,y){x^2-2*y} m <- outer(x, y, fun1) m[is.na(m)] <- 1 persp(x, y, m, theta = 30, phi = 30, expand = 0.5, col = "royalblue", ltheta = 120, shade = 0.75, ticktype = "detailed") par(new=true) fun1<-function(x,y){x+y-1} m <- outer(x, y, fun2) m[is.na(m)] <- 1 persp(x, y, m, theta = 30, phi = 30, expand = 0.5, col = "red", ltheta = 120, shade = 0.75, ticktype = "detailed") some overplotting might help. first plot suggested in comments above. de-select segments constraint violated assigning na, i.e. no plotting , overplot heavier color. ( found unless froze z-limits "shifted" @ last step. may need suppress z-axis labels, since still overlaying each ...

Chrome webNavigation.onComplete not working? -

i'm trying write chrome extension executes code when user on youtube page video. far can tell, code correct, isn't working. eventpage.js: chrome.webnavigation.oncompleted.addlistener(function(){ console.log("test") },{url: [{pathcontains: "watch", hostsuffix: "youtube.com"}]}); and manifest file { "manifest_version": 2, "name": "youtubeextension", "description": "a chrome extension youtube", "version": "0.1", "permissions": ["https://www.youtube.com/", "webnavigation"], "background": { "scripts": ["eventpage.js"], "persistant": false } } it seems oncompleted doesn't work on youtube. chrome.webnavigation.oncompleted triggered when document has finished loading. when navigate different page on youtube, new page not "loaded" in traditional way, page d...