Posts

javascript generator value of this -

what value of this in javascript generators in javascript? in below code, both comparisons return false, , when .tosource() , this appears empty object . references ecma or mdn docs helpful, wasn't able find in either. function thisgenerator(){ while(1) yield this; } var gen=new thisgenerator(); alert(gen.next()==thisgenerator); alert(gen.next()==gen); this still obeys normal rules. considering, global scope window : var gen = (function() { yield this; })(); gen.next() === window // true var gen = (function() { "use strict"; yield this; })(); gen.next() === undefined // true in quirks mode, this in unbound functions global scope (which happens window ), while in strict mode undefined . ps: when calling function bound, still usual: var o = { foo: function() { yield this; } }; o.foo().next() === o // true var o = {}; function foo() { yield this; }; foo.call(o).next() === o // true

css - :nth-child related only to specific class or element -

it's possible assign :nth-child specific element, without count other element in middle (ex http://jsfiddle.net/mgc4v/ <*br>). <p>1</p> <br> <p>2</p> <p>3</p> p:nth-child(3) { background-color:red; } the red line second one, not third..thanks p:nth-of-type(3) { background-color:red; } will select third <p> element :) , question ? see http://www.w3.org/wiki/css/selectors/pseudo-classes/:nth-of-type example : http://codepen.io/anon/pen/dxgos

getting a json string in php from jquery ajax post -

i tring write page, takes rss feed news site via ajax , sends php can work it. news feed returned object array. have tried posting is, , json string. post method seems success, php gives undefined index notice. first time using ajax , php , seem have problem getting data php side. the error: notice: undefined index: data in ...\index.php on line 33 current code following: ajax side url = 'http://feeds.bbci.co.uk/news/rss.xml?edition=int'; $.ajax({ type: "get", url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&callback=?&q=' + encodeuricomponent(url), datatype: 'json', error: function(){ alert('load error, invalid url'); }, success: function(xml){ values = xml.responsedata.feed.entries; var senddata = json.stringify(values); console.log(senddata); $.ajax({ type: "post...

java - Why I can't use + operator with Integer and Double in generic method? -

i encountered strange issue. don't understand why code doesn't work: public static <type1 extends integer, type2 extends double > object addition(type1 first, type2 second) { return second * first; } the compiler claims operator * cannot applied type2,type1 . types extends integer , double has + operator defined them. don't understand this you wrong. neither integer nor double or other objects extending number class have "+" or other operator definied. reason why able perform (integer + double) autoboxing. , autoboxing kind of "hardcoded" feature applies small predefined set of classes, such integer, double, etc. furthermore, integer , other number subclasses declared "final", therefore "type extends integer" has no meaning, since cannot extend integer.

spring Transaction exception handling -

basically spring transaction management .we can annotate service layer class @transactional. also have annotated dao layer class @repository make checked exception unchecked exception. now when runtimeexception encoutered service layer class rollback. my question how go exception handling. have put error message ui .so need capture exception . how go it.

Is Three.js Normal Map Shader Computing Lighting In Tangent Space? -

i trying familiarized three.js , came across strange can't quite wrap head around. in other systems, (non web based), i've used, lighting normal maps calculated in tangent space. in three.js things bit different. example, if consider code in webglshaders.js @ line 2643: "mat3 tsb = mat3( normalize( vtangent ), normalize( vbinormal ), normalize( vnormal ) );", "vec3 finalnormal = tsb * normaltex;", they set orthonormal basis matrix tangent space, , transform normal space. far good. the issue is... seems place transform vectors tangent space??? so light direction vector calculate not converted tangent space, , neither eye direction vector??? both of subsequently used calculate lighting on lines 2692-2694: "vec3 pointhalfvector = normalize( pointvector + viewposition );", "float pointdotnormalhalf = max( dot( normal, pointhalfvector ), 0.0 );", "float pointspecularweight = speculartex.r * max( pow( pointdotnormalhalf, ...

c++ - Winbio.h No such file or directory error -

i'm experiencing dificulty in compiling tutorial msdn : http://msdn.microsoft.com/en-us/library/windows/desktop/ee207405(v=vs.85).aspx . mentioned in title, i'm getting no such file or directory @ compile time after linking winbio.lib generated using dumpbin , lib commands in vs 2008, , code : #include <iostream> #include <windows.h> #include <stdio.h> #include <conio.h> #include <winbio.h> hresult capturesample(); int main(int argc, char** argv) { hresult capturesample(); return 0; } hresult capturesample() { hresult hr = s_ok; winbio_session_handle sessionhandle = null; winbio_unit_id unitid = 0; winbio_reject_detail rejectdetail = 0; pwinbio_bir sample = null; size_t samplesize = 0; // connect system pool. hr = winbioopensession( winbio_type_fingerprint, // service provider winbio_pool_system, // pool type winbio_flag_raw, // access: capture raw data null, ...