Posts

Showing posts from February, 2012

framework7 - How to apply if an element is visible scrolling? -

how apply if element visible scrolling? event scroll not this code $$(document).on('scroll', '.page-content', function() { console.log('scroll'); }); but scroll event not work in framework7 if want detect scrolling on page content need add scroll event on particular div. <div class="page-content index-page-content"></div> on div page-content class important.so js should be $$('.index-page-content').on('scroll',function(e){console.log("scroll happened");}); try one.it work.hope helps

c++ - Do I need to redefine preprocessor defines in parent projects? -

maybe since not find right keywords, unable clarify doubt on google. let have 2 c++ projects; proja , projb . in exmpl.h file in proja, there condition: class myclass { ... #ifdef myvar virtual ~myclass() {} #endif } i define myvar project setting , compile proja generate proja.a static library. now, projb, need use exmpl.h of proja. include , compile projb using proja.a static library. however, imagine in projb did not define myvar . what happen in case? projb skip code within #ifdef , uses static library compiled code within #ifdef ? so, error , cause unexpected behavior? do have define preprocessor defines used in sub-projects, in projects use them? thanks. the definitions of myclass used in both projects must same, otherwise it's violation of one definition rule , causing undefined behavior, no diagnostic required (that is, compiler isn't required tell violation). so yes, must define myvar in projb, other defines affecting definition

javascript - Updating Multiple Select Boxes dynamically -

i have page has 2-300 select dropdown boxes. need dynamically update each 1 have same list of options. each time try update it first one. suspect problem not looping through it. // html <form id="myform"> <select id="selectnumber"> <option>choose number</option> </select> </form> <form id="myform"> <select id="selectnumber"> <option>choose number</option> </select> </form> <form id="myform"> <select id="selectnumber"> <option>choose number</option> </select> </form> // javascript var myarray = new array("1", "2", "3", "4", "5"); // dropdown element dom var dropdown = document.getelementbyid("selectnumber"); // loop through array (var = 0; < myarray.length; ++i) { // append element end of array list dropdown[d

Unique subdomain for sending emails - HOW? -

this not easy question because technique have never seen before. received email website subscribed , email sender this: name@company-91e363c0cfc9.mail.intercom.io i have saas software users can send email marketing. problem sender email no-reply@domain.com every 1 of them. thinking "what if" of customers sends junk , domain gets blacklisted? looking @ technique intercom using thought way solve blacklist issue. let assume customer sends spam, hole domain blacklisted (mail.intercom.io) or @company-91e363c0cfc9.mail.intercom.io ? i have following questions: what name of technique/configuration. is technique solve getting root domain blacklisted ? how can configure on server? thanks. they create sub-domain each of clients in dns, can see mx record lookup of domain provided. when email sent out, have outgoing ip address on email, didn't provide. outgoing ip going blacklisted, doesn't matter if 50 sub-domains different, outgoing ip (sendi

php - Why aren't these SHA1 implementations alike? -

my question simple -- 2 separate sha1 implementations, guaranteed sames output same input, or there space interpretation in implementation? most r digest sha1 implementation , php sha1 digest don't seem come like. have bug or sha1 implementations giving different valid hashes of same message? in r : digest_token = "stackoverflow cool" value = digest(digest_token, "sha1", raw=false) output : [1] 4c 70 99 2f 81 b5 32 0d 77 aa 17 b6 da 69 92 13 a0 44 9f in php $digest_token= "stackoverflow cool"; $value = sha1($disgest_token, false); output ef48c200b5d9b844c950f7704e6c03359f8a4e2f i might expect these 2 produce same output not. the r digest package description pretty clear what's going on (emphasis mine): the digest function applies cryptographical hash function arbitrary r objects. by default, objects internally serialized , , either 1 of implemented md5 , sha-1 hash functions algorithms can used compu

c# - regex match pattern in a string multiple times -

this question has answer here: learning regular expressions [closed] 1 answer i have following string "*&abc=123&**&defg=hh&*" , on pattern start , end && , have following when regex.matches or regex.split first match = &abc=123& 2 match = &defg=hh& appreciate help &[0-9a-za-z]+=[0-9a-za-z]+& you may need change [0-9a-za-z] depending on characters want allow. & matches characters & literally [0-9a-za-z]+ match single character present in list below quantifier: + between 1 , unlimited times, many times possible, giving needed [greedy] 0-9 single character in range between 0 , 9 a-z single character in range between , z (case sensitive) a-z single character in range between , z (case sensitive) = matches character = literally [0-9a-za-z]+ match single character present

c# - Code First Entity Framework Lazy Loading Not Working -

i'm having trouble getting lazy loading work. if this: static void main(string[] args) { using(var db = new blogcontext()) { //db.blogs.load(); //db.posts.load(); foreach (var v in db.blogs) { console.writeline("blog: "+ v.name+" post count:"+v.posts.count()); } } } "post count" 0; but if uncomment load() calls before foreach, post count correct. ideas what's wrong? here's entity classes being used: public class blog { public blog(){ posts = new list<post>(); } [key] public int blogid { get; set; } public string name { get; set; } public virtual icollection<post> posts { get; set; } } public class post { [key] public int postid { get; set; } public string title { get; set; } public string content { get; set; } public int blogid { get; set; }

c++ - How does the Compiler Know Whether to Call the const Overload? -

given string foo , when call: auto bar = foo.begin(); there 2 overloads of string::begin . 1 returns string::iterator , other returns string::const_iterator . how can know type of bar ? based on whether foo const or not? is based on whether foo const or not? yes auto meant deducing exact type * how select iterator type using auto variable? indirectly agrees answer. * taken from: how const_iterator using auto?

javascript - How to bind a dynamically created object to the document ready event? -

i have function dynamically creates slider element using following code: function newdiv(){ (var count=0; count < parsefloat(sessvars.storey_count); count++) { var string="<br><div id='my-slider"+count+"' class='dragdealer'><div class='red-bar handle'><span id='drag-button"+count+"'>drag me</span></div></div>"; $("body").append(string); var slider_id ="my-slider"+count; var drag_button_id = "drag-button"+count; //object gets created below new dragdealer(slider_id,{horizontal: true,x:math.random(),animationcallback: function(x, y){ document.getelementbyid(drag_button_id).innerhtml = x.tofixed(2); } }); } } however, animationcallback function invoked everytime slider moved has embedded within fun

ios - Swift 2.2 Selector with multiple arguments - actually passing in -

i want use selector, need pass in arguments understand syntax follows: #selector(class.method(_:paramname:)) but need pass in parameters. how do this? here's attempt: exploretap = uitapgesturerecognizer(target: self, action: #selector(mainviewcontroller.showviewwithidentifier(_:exploreview,id:"explore"))) you cannot pass parameters selectors, selector method name, nothing else. not calling method cannot pass parameters. call necessary code inside tap handler. func ontap() { mainviewcontroller.showviewwithidentifier(exploreview, id:"explore") } and then uitapgesturerecognizer(target: self, action: #selector(ontap))

asp.net - How do I configure Entity Framework to allow database-generate uuid for PostgreSQL (npgsql)? -

i'm updating our dotnet core project use postgresql on backend instead of microsoft sql server , hit situation 2 tables use guid data type. error unhandled exception: system.reflection.targetinvocationexception: exception has been thrown target of invocation. ---> system.invalidoperationexception: property commentid on type database-generated uuid, requires postgresql uuid-ossp extension. add .haspostgresextension("uuid-ossp") context's onmodelcreating. after little googling realized have enable uuid extension (not sure if can automated somehow) , generated uuid in pgadmin successfully. create extension "uuid-ossp"; select uuid_generate_v4(); unfortunately dotnet project still complaining same error tho. see in error says add .haspostgresextension("uuid-ossp") onmodelcreating , i've tried in several spots can't seem figure out should added. as per shay's instruction - after updating latest version of npgsql

javascript - Using Deferred to create custom Jquery UI Modal -

i trying recreate of functions of browser confirm box. need custom 1 our purpose. my issue if statement on button click returns immediately, instead of after jqconfirm function has received user input , promise returned. any ideas? $('#testbutton').click(function () { if (gjs_confirm('this question, sure want to?????')) { alert('ok'); } else { alert('cancel'); } }); function gjs_confirm(msg) { $.when(jqconfirm(msg)) .then(function () { $("#dialog").dialog("close"); return true; }) .fail(function () { $("#dialog").dialog("close"); return false; }); } function jqconfirm(msg) { var deferred = $.deferred(); $("#dialog").dialog({ // autoopen: false, modal: true, resizable: false, height: 140, title: &

reporting services - subscription contains parameter values that are not valid -

i have report begin date , end date parameters , meant subscription should serve 2 types of subscriptions: 1, one previous fiscal week -->begin date first day of previous fiscal week , end date last day of previous fiscal week. 2, one previous day -->begin date previous day , end date previous day. dataset datefields: dataset query results both date parameters available , default values. when create subscription previous day runs day...after midnight day, begin date , end date parameter values blank , subscription fails status message "the subscription contains parameter values not valid" values. subscription created previous fiscal week week until values previous fiscal week start , end dates change. you using dataset defaults , values date parameters, isn’t best approach. the way have handled reports want allow end users subscribe to, , have default date values vary depending on whether subscription daily, weekly, or monthly one, have parameter make

C# Quartz alert when trigger end date is passed -

i have jobs save details in database, , want inform database job trigger end date has passed , schedule "completed". have read triggerlistener , has completed event, it's firing every time job done executing, , not i'm trying do. thanks. you can implement ischedulerlistener , listen triggerfinalized event informs given trigger never fire again according schedule.

Dispose pattern usage -

i read these articles on dispose pattern , dispose implementation . question when calling virtual dispose(bool) method finalizer, why pass false method , release unmanaged resource? if pass true, break? also have implemented idisposble interface, still relies on developer either wrap code in using block or call dispose() explicitly, in order dispose() method invoked. addon of idisposble interface, if developer not careful enough? from first link: the boolean parameter disposing indicates whether method invoked idisposable.dispose implementation or finalizer. dispose(bool) implementation should check parameter before accessing other reference objects (e.g., resource field in preceding sample). such objects should accessed when method called idisposable.dispose implementation (when disposing parameter equal true). if method invoked finalizer (disposing false), other objects should not accessed. the reason objects finalized in unpredictable order ,

javascript - Implementing Promise.series as alternative to Promise.all -

i saw example implementation of promise.all - runs promises in parallel - implementing promise.all note functionality looking akin bluebird's promise.mapseries http://bluebirdjs.com/docs/api/mapseries.html i making attempt @ creating promise.series, have seems work intended ( it totally wrong, don't use it, see answers ): promise.series = function series(promises){ return new promise(function(resolve,reject){ const ret = promise.resolve(null); const results = []; promises.foreach(function(p,i){ ret.then(function(){ return p.then(function(val){ results[i] = val; }); }); }); ret.then(function(){ resolve(results); }, function(e){ reject(e); }); }); } promise.series([ new promise(function(resolve){ resolve('a'); }), new promise(function(resolve){ resolve('b'); }) ]).then(function(val){

ios - Read UI Label Value and Perform some tasks -

i'm creating radio application 5 radio stations. i've included rotary wheel select preferred station. use label view display selected station. when user presses play button how can selected value play defined url. i've defined 5 url's already, not sure how play button play the selected station @ url when user presses play. if looking play multiple urls, create method plays them switch-case statement.. such following - (void) playmusicatindex:(int)index { switch(index) { case 0: // play url 1; break; case 1: // play url 2; break; case 2: // play url 3; break; … } } then, when going off selected option url of radio, set url @ index number, , (inside method) [variablename playmusicatindex:0..or 1.. or 2, whatever index you're playing]; hope helps!

java - Save output into two variables in Android from HTTP call -

i saw few posts (like one: android httppost: how result ) of answers deprecated in mid 2016 latest android , don't answer full question. i'm having app http call ( http://52.35.9.101:8080/server/keeper/login_test.jsp?username=[uniquexx] ), this: new httprequest().execute("http://52.35.9.101:8080/server/keeper/login_test.jsp?username=[uniquexx]"); intent intent = new intent(getactivity(), mainactivity.class); startactivity(intent); which passes async java file called http request: public class httprequest extends asynctask<string, string, string> { @override protected string doinbackground(string... uri) { httpclient httpclient = new defaulthttpclient(); httpresponse response; string responsestring = null; try { response = httpclient.execute(new httpget(uri[0])); statusline statusline = response.getstatusline(); if(statusline.getstatuscode() == httpstatus.sc_ok){ bytearrayoutputstream out = new byte

jquery dialog will not close after clicking a URL -

i have put jquery dialog on webpage let visitors choose language. worked fine little while, still works, except box not close when 1 of urls clicked. in tags have following code: <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <link rel="stylesheet" href="https://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <script> $(document).ready(function(){ $( "#hello" ).dialog( {width:350},{ autoopen: true }); }); </script> in tag following code appears: <div id="hello" title="welkom - welcome!"><p align="center"><font face="georgia" size="4"> kies uw taal - choose language</font></p> <div align="center"><a href="index.html">nederlands</a> <a href

php - Different header image for each page in Wordpress -

i have wp theme supports custom headers in sense can upload number of header images , randomize them user browses site need each page display single image media gallery related content on page. i've tried add custom-header.php if(is_page('about')){ echo '<img src="the-path-to-image/about.jpg" />'; or this <?php if(is_home) { ?> <?php if( get_header_image() ): ?> <div id="custom-img-header"><img src="the-path-to-image/about.jpg" alt="" /></div> <?php endif; ?> <?php } ?> but nothing changes ... code functions.php require get_template_directory() . '/inc/custom-header.php'; code header.php <header id="masthead" class="site-header" <?php echo beluga_header_image_background(); ?> role="banner"> <div class="masthead-opacity"></div> <div class="site-branding">

python - Issues setting up CKAN virtual environment -

i'm following prepare use extensions document , i'm having issues installing ckan virtual environment. sudo apt-get install virtualenv python-pip mercurial virtualenv /home/ubuntu/pyenv . /home/ubuntu/pyenv/bin/activate at first failed, found virtualenv should python-virtualenv . now i'm having issues with: pip install -e hg+http://bitbucket.org/okfn/ckan#egg=ckan i'm getting error code 255, , when visit url, looks source has been deleted , moved github. i'm beginner ubuntu, python , ckan i'm not sure how change command point new location. i tried use following, didn't work me: pip install -e hg+https://github.com/ckan/ckan#egg=ckan how should continue install ckan in virtual environment? if go url in browser, see has pointer github now: this repository has been deleted our apologies, repository "ckan" has been deleted. lives @ https://github.com/okfn/ckan . so, instead do: pip install -e 'git+git:/

python - Pandas dataframe grouping by multiple columns and dropping duplicate rows -

i trying task (in bioinformatics, tcga data) using dataframe of following form: df = pd.dataframe({'id':['tcga-ab-0001','tcga-ab-0001','tcga-ab-0001','tcga-ab-0001','tcga-ab-0002','tcga-ab-0002','tcga-ab-0002','tcga-ab-0002','tcga-ab-0003','tcga-ab-0002'], 'reference':['hg19','hg18','hg19','grch37','hg18','hg19','grch37','hg19','grch37','grch37'], 'sampletype':['tumor','tumor','normal','normal','tumor','normal','normal','tumor','tumor','tumor'] }) which looks like: id reference sampletype 0 tcga-ab-0001 hg19 tumor 1 tcga-ab-0001 hg18 tumor 2 tcga-ab-0001 hg19 normal 3 tcga-ab-0001 grch37 normal 4 tcga-ab-0002 hg18

angular - Use globalDependencies (Typescript tsd files) from Angular2 -

i'm trying use typescript tsd's definitelytyped in angular2 project (rc.0), global dependencies doesn't seem load properly: typings install --save dt~hellojs --global --save npm install --save hellojs i've configurations: typings.json: "globaldependencies": { "hellojs": "registry:dt/hellojs#0.2.3+20160423145325" } angular.cli.build.js: module.exports = function(defaults) { return new angular2app(defaults, { vendornpmfiles: [ 'systemjs/dist/system-polyfills.js', 'systemjs/dist/system.src.js', 'zone.js/dist/**/*.+(js|js.map)', 'es6-shim/es6-shim.js', 'reflect-metadata/**/*.+(js|js.map)', 'rxjs/**/*.+(js|js.map)', '@angular/**/*.+(js|js.map)', 'angular2-moment/**/*.+(js|js.map)', 'moment/**/*.+(js|js.map)', 'hellojs/**/*.+(js|js.map)' ] }); }; system-config.ts /** map rela

swift - Creating an online game feature without Server Side logic? -

so im developing simple game. using swift + firebase. users can login in game , click button fight "boss". other users can fight same boss "instance". on firebase db there reference "instance" of "boss" amount of "life","dmg players per second", "# of players fighting it". i use realtime database update "boss's life" , "# of players fighting it" on each user's viewcontroller . my question since "boss instance" "damage per second" how can make sure thats running when users put game in background? i can put nstimer in viewwillappear() but want player damaged in background , if player's life reaches 0 -> save in db , note "player has died" in db well. when come run check , tell them have died , boot them main view controller . hope makes sense! iv been trying figure out weeks , im @ point cant skip it!

rdp - Is it possible to preview remote desktop on php website? -

is possible view remote desktop connection on php website? preview, not interactive window. know, how connect remote desktop using vnc opens in separate tab , can control window. short answer is: no. how typically done getting server generate screenshots , getting images embedded in php gets displayed on site. if fancy live stream them you'd need service generates feed in way php can display it. guy here did screen casting online sessions: https://www.youtube.com/watch?v=dyrji_u3ka8 basically using google hangouts broadcast youtube , embedding in page using: https://github.com/kassius/youtube-live-embed from example: require_once('embedyoutubelivestreaming.php'); // use if class file repo in same directory $channelid = 'replace_me'; // channel id $api_key = 'replace_me'; // google project api key youtube api enabled $youtubelive = new embedyoutubelivestreaming($channelid, $api_key); hope helps!

ruby on rails - will_paginate gem using model associations -

i using will_paginate gem , attempting utilize using model associations. right now, have group , post models, each group has list of posts. however, when attempt chain these models using will_paginate, not work. yet test in terminal group.find(15).posts.order('created_at desc') , works. not sure if missing or if has how i'm handling partials. group show.html.erb <%= render "posts/index" %> post _index.html.erb <%= render 'posts/posts' %> ... <%= will_paginate @posts %> post _posts.html.erb <% @group.posts.each |post| %> <%= render 'posts/post', post: post, group: @group %> <% end %> post _post.html.erb ... <%= post.caption %> post index.js.erb $('#posts').append("<%= escape_javascript(render 'posts')%>"); $('.pagination').replacewith('<%= escape_javascript will_paginate(@posts) %>'); scroll.js $(document).ready(function()

testing - Passing parameter externally to a TestNG class -

my @dataprovider looks restful url below. @dataprovider(name = "dbconfig") public object[][] providedbconfig() { map map = swaggerutility.getswaggerdata(" http://petstore.swagger.io/v2/swagger.json "); i ideally want way pass url externally testng run or class. there way that? ideally tests integrated ci tool needs pass parameter down testng job. not see way pass parameters directly testng class. please let me know if there way around you can pass argument system level property - read in beforeclass method using system.getproperty("nameofprop") , set variable need class.

How to use jquery in non-react javascript on rails? -

i've incorporated react_on_rails (not react-rails ) gem rails 4.2 code base. i want introduce new react components app has fair amount of javascript code. i ran "hello world" generator react on rails which, among other things, commented out //= require jquery line application.js -- result of pre-existing coffeescript (which depended on jquery being present) no longer works. new generated demo hello world react components work. when comment out added //= require vendor-bundle , //= require app-bundle lines application.js , add in //= require jquery lines -- opposite happens, react components stop working pre-existing coffeescript works again. my question -- how set things both work? is, new react components work, , pre-existing coffeescript (that relies on jquery) works well. thanks in advance! i haven't used generator, i'm not sure contains. have react-rails gem , jquery working in bunch of apps, here's imports like; applica

android - How to create portable hybrid WebView library -

xamarin has razortodo sample demonstrates how build hybrid app using webview , razor. contains portable library contains views, models, , forth. however, when adding program portable library, can't find template that. can create normal "portable" library, doesn't have "views" folder. can create one, there's no template adding .cshtml files. can create file of different type .cshtml extension, nice vs know type. missing something? thanks. -john using views folder convention. legitimate add folder. if working inside of xamarin studio, can add .cshtml file project choosing "preprocessed razor template" under "text templating" in "new file" dialog. visual studio doesn't include template type, can add text file or html file project, named .csthml file extension, , turn preprocessed razor template editing properties on file , setting "custom tool" razortemplatepreprocessor .

Use jquery cookie to remember which div is toggled on page refresh -

how set cookie using jquery remember div toggled , keep toggled when page refreshed? i have have tried many solutions , have figured out, i'm getting stuck when setting , retrieving cookie. my html: <a href="javascript:showonlyone('newboxes2');" >login</a> <a href="javascript:showonlyone('newboxes3');" >register</a> <div class="newboxes" id="newboxes1" style="display: block"> default text shown when no cookies set </div> <div class="newboxes" id="newboxes2" style="display: none"> login form </div> <div class="newboxes" id="newboxes3" style="display: none"> register form </div> my script: /************jquery cookie**************/ ;(function(g){g.cookie=function(h,b,a){if(1<arguments.length&&(!/object/.test(object.prototype.tostring.call(b))||null==

sprite kit - Basic Swift SpriteKit Collisions using PhysicsBodys -

the problem: seem having little trouble getting player collide coin, , adding +1 coinlabel upon collision. player should continue moving after coming in contact coin. what have now: code have now, player travels through coin, there no collision takes place , +1 isn't added coin label. i still learning swift language, appreciate given. code: struct collidertype { static let playercategory: uint32 = 0x1 << 0 static let boundary: uint32 = 0x1 << 1 ​ ​static let coincategory: uint32 = 0x1 << 2 ​ ​static let bodya: uint32 = 0x1 << 4 ​ ​static let bodyb: uint32 = 0x1 << 8 } ​override func didmovetoview(view: skview) { ​ var coinint = 0 ​ ​ ​ ​self.physicsworld.gravity = cgvectormake(0.0, -7.0) physicsworld.contactdelegate = self player = skspritenode(imagenamed: "player") player.zposition = 1 player.position = cgpoint(x: cgrectgetmidx(self.frame), y: cgrectgetmidy(self.frame)) player.physicsbody = skphysicsbody(circleofradius:

php - Div not showing in wordpress -

<?php if (is_user_logged_in()) { echo '<div id="signin-box"> ' . wp_login_form() . ' </div>'; } else { echo 'hi'; } ?> is i've got. login form working, not being wrapped in div. without else/if statement, works. does work you? <?php if (is_user_logged_in()) { ?> <div id="signin-box"> <?= wp_login_form(); ?> </div> <?php } else { echo 'hi'; } ?>

java - Is it possible to create a generic site.xml in a enterprise pom that is inherited by all projects? -

i have parent pom organization: <project <groupid>org.myorg</groupid> <artifactid>oss-parent</artifactid> <packaging>pom</packaging> <version>6-snapshot</version> ... </project> and in same project site.xml: <project> <skin> <groupid>org.apache.maven.skins</groupid> <artifactid>maven-fluido-skin</artifactid> <version>1.5</version> </skin> <custom> <fluidoskin> <sidebarenabled>true</sidebarenabled> </fluidoskin> </custom> <body> <menu ref="reports" /> </body> </project> if run mvn clean site fluido theme. now, in actual project somewhere else in org, inherits our enterprise pom, not part of module build it: <project> <modelversion>4.0.0</modelversion> <parent> <groupid>org.myor

javascript - How to keep content of a div always visible despite moving scrollbar down -

i trying duplicate left nav @ http://www.kahuna-webstudio.fr/ . if take @ http://www.kahuna-webstudio.fr/ , , scroll down 50 pixels or so, see div appear off left of screen has navigation in it. have of working, of of @ stackoverflow. 1 part not have working content of div, images, not stay stationary in place (or visible) scroll down. so want happen is: when div appears @ left of screen, when user scrolls down, want content of div appear in view. right have working is: through animate() set height of left nav div document height, , width grows 80 pixels, , images fadein(). page long , user scrolls down able scroll down height of left nav div; , want content of left nav appear in view user. i think person posted similiar question ( keeping header in view ) finding difficult attach if example code. can help? appreciate lot. here code: $(window).scroll(function(){ var wintop = $(window).scrolltop(); var docheight = $(document).height(); var winheight = $(window).hei

javascript - Can't get jQuery .off() to remove event handler -

i can't seem figure out why .off('click') jquery method isn't working considering removing event binding '.reveal-menu'. first animation works fine each div moves respective location in increments of 78. can't seem go back. jquery $(function(){ var usermenudivs = $('#user-menu div:gt(1)'); usermenudivs.hide(); $('.reveal-menu').on('click', function(){ $(this).addclass('down'); iconspacercount = 78; usermenudivs.show(); $.each(usermenudivs, function(index,value){ $(this).animate({top:iconspacercount},200); iconspacercount += 78;}); }); $('.reveal-menu').off('click', function(){ $(this).removeclass('down'); iconspacercount = 0; $.each(usermenudivs, function(index,value){ $(this).animate({top:iconspacercount}); }); }); }); html <div id="user-menu"> <div clas

javascript - Shadow is abnormally-shaped for MeshLambertMaterial in Three.js r76? -

Image
using r70, shadow shows expected - r70 example (shadow correct shape) using r76 however, shadow abnormally shaped - r76 example (shadow abnormally shaped) you can see shadows on meshlambertmaterial on ground plane not expected. why shadows becoming abnormally shaped? needs changed working in r76? here code using (same in both example): var light; light = new three.spotlight(0xdfebff, 1); light.position.set(300, 400, 50); light.castshadow = true; light.shadowcameravisible = true; scene.add(light); var groundmaterial = new three.meshlambertmaterial({ color: 0xff0000, }); plane = new three.mesh(new three.planegeometry(500, 500), groundmaterial); plane.rotation.x = -math.pi / 2; plane.receiveshadow = true; plane.castshadow = false; scene.add(plane); var boxgeometry = new three.cubegeometry(100, 100, 100); var boxmaterial = new three.meshlambertmaterial({ color: 0x0aeedf }); var cube = new three.mesh(boxgeometry, boxmaterial); cube.castshadow = true; cube.position.x

c# - Why does BadRequest(ModelState) return Status Code 500? -

i have web api controller turning return badrequest(modelstate) if fails modelsatate.isvalid check so. if(modelstate.isvalid) { return badrequest(modelstate); } but why response code 500 , not 400? if return badrequest() without modelstate, 400. if(modelstate.isvalid) { return badrequest(); }

wordpress - Conditional execution of function by post date -

below code need executed on posts till particular date, eg. november 11, 2015. i know if...else condition, don't have idea how create condition. kind of appreciated... so in fact /this wordpress/ need "format" in way posts till particular date, , posts newer date excluded function below: function user_content_replace($content) { $sentences_per_paragraph = 3; // settings $pattern = '~(?<=[.?!…])\s+~'; // punctuation , trailing space(s) $sentences_array = preg_split($pattern, $content, -1, preg_split_no_empty); // sentences array $sentences_count = count($sentences_array); // count sentences $output = ''; // new content init // see php modulus for($i = 0; $i < $sentences_count; $i++) { if($i%$sentences_per_paragraph == 0 && $i == 0) { //divisible settings , first $output .= "<p>" . $sentences_array[$i] . ' '; // add paragraph , first sentence } elseif($i%$sentences_per_paragraph == 0 &

linux - The diff command for files with empty content -

if want difference between 2 directories, use command below: diff -arun dir1/ dir2/ > dir.patch so dir.patch file should comprise differences want, right? but if dir2/ contains file empty content, , file not existent in dir1/ , example, dir1/ dir2/empty_content_file.txt ------ empty content. then diff command not generate patch empty_content_file.txt, needed file. is there expertise or alternative way this? thank in advance. it's because you're using -n option, added explicitly treat absent file empty. man diff says : -n, --new-file treat absent file empty

javascript - Undesired shaded area when exporting NVD3 line chart to PNG -

Image
i new nvd3. have created line chart in nvd3. haven't set area attribute in data 'true' in line chart.however when export line chart png,the line chart shows shaded region in png while there no shaded region in actual line chart visualization.i tried putting "area:false" in data used line chart worked reverse , displayed shaded area in actual line chart.also,a dark background dispalyed isn't present in actual visualization , believe because of no axes/lines visible.how correct in exported png of line chart. how rid of shaded area in exported png of line chart visualization? actual visualization looks this: downloaded png looks current code is: <!doctype html> <html> <head> <meta charset="utf-8"> <link href="../build/nv.d3.css" rel="stylesheet" type="text/css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.2/d3.min.js" charset=&

numpy - Python: find contour lines from matplotlib.pyplot.contour() -

Image
i'm trying find (but not draw!) contour lines data: from pprint import pprint import matplotlib.pyplot z = [[0.350087, 0.0590954, 0.002165], [0.144522, 0.885409, 0.378515], [0.027956, 0.777996, 0.602663], [0.138367, 0.182499, 0.460879], [0.357434, 0.297271, 0.587715]] cn = matplotlib.pyplot.contour(z) i know cn contains contour lines want, can't seem them. i've tried several things: print dir(cn) pprint(cn.collections[0]) print dir(cn.collections[0]) pprint(cn.collections[0].figure) print dir(cn.collections[0].figure) to no avail. know cn contourset , , cn.collections array of linecollection s. think linecollection array of line segments, can't figure out how extract segments. my ultimate goal create kml file plots data on world map, , contours data well. however, since of data points close together, , others far away, need actual polygons (linestrings) make contours, not rasterized image of contours. i'm surprised qh

java - Recursive method to calculate log -

i did following calculate recursive logarithm:(b base of log here) int log(int b, int n ) { if (n/b ==1) { return 1; } else { return log( b, n/b)+1 ; } } however, it's wrong.i'm doing opendsa interactive platform.the original question following: function "log", write missing base case condition , recursive call. function computes log of "n" base "b". example: log 8 base 2 equals 3 since 8 = 2*2*2. can find dividing 8 2 until reach 1, , count number of divisions made. should assume "n" "b" integer power. 1 int log(int b, int n ) { 2 if <<missing base case condition>> { 3 return 1; 4 } else { 5 return <<missing recursive case action>> 6 } 7 } my code incorrect.i'm getting infinite recursion. if format must this: int log(int b, int n ) { if <<enter base case>> { return 1; } else { return <<enter action

html - How do I get rid of the right margin on my div? -

i have div on contact page id of contactdetails. according chrome's developer tools has margin on right taking rest of page , not allowing me place google maps located, opposite contact details. html <div class = "content"> <!--begin content--><!-- instancebegineditable name="editablecontent" --> <div id = "contactdetails"> <ul> <li><img src = "images/icons/png/houseicon.png" alt = "address icon"><p>23 kingfisher court, werribee 3030, victoria</p></li> <li><img src = "images/icons/png/emailicon.png" alt = "email icon"><p>contact@greenery.com</p></li> <li><img src = "images/icons/png/phoneicon.png" alt = "phone icon"><p>0397488945</p></li> </ul> </div> <div id = "contactdetails-right">

http - What is the source of packet size in a GET request? -

i analyzing http network traffic different websites. have noticed packet size differs between websites. i thought uri length decided packet size, yet different websites have different values. example "get /" has size of 339 1 website, yet 390 another. also, noticed websites longer uri text have smaller packet sizes, , vice versa. who responsible size of packet? browser, client, server or who? thanks first of all, discrepancy observing due either different host headers or passing of cookies between client , server, although referrer source of variation. a given get packet of following format. in case of below example, packet size 361 bytes. get / http/1.1\r\n host: google.com\r\n user-agent: mozilla/5.0 (windows; u; windows nt 6.1; en-us; rv:1.9.1.2) gecko/20090729 firefox/3.5.2 (.net clr 3.5.30729)\r\n accept: */*\r\n accept-language: en-us,en;q=0.5\r\n accept-encoding: gzip,deflate\r\n accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7\r\n keep-alive: 3

java - Multiple Databases with Play Framework 2.1.x -

i have 2 databases need connect to. can connect them in application.conf file so: db.default.driver=org.postgresql.driver db.default.url="jdbc:postgresql://localhost/db1" db.default.user=postgres db.default.password="password" db.secondary.driver=org.postgresql.driver db.secondary.url="jdbc:postgresql://localhost/db2" db.secondary.user=postgres db.secondary.password="password" ebean.default="models.db1.*" ebean.secondary="models.db2.*" i have model classes in packages, , ddl generates tables properly. the problem lies in working these entities. not in "default" package throws error (using users table in secondary database example) if try query rows of table: list<users> users = users.find.all(); it throws error: [persistenceexception: models.db2.users not entity bean registered server?] even though 100% sure users table there in backend, registered table ddl works , makes table properly, ,

Compare functions in Javascript -

i have api takes function input, , inside api, intent add function array if function not added array. the call api of form: myapihandle.addifunique(function(){ myresource.get(myobj); }); the api is: myapihandle.addifunique(myfunc) { if (myarray.indexof(myfunc) === -1) { return; } // add array } now not work expected, since each time new function being passed in. my question is: there way pass in function myapihandle.addifunique call allow me compare existing functions in array function passed in? comparison should compare function name , object, , if both same, not add function array. want avoid adding argument addifunique call if @ possible. in other words, below possible: myapicall.addifunique (somefunc) { } if so, somefunc. , logic inside api detect if function exists in myarray? the same problem occurs addeventlistener , removeeventlistener , callback must identical (in === sense) removeeventlistener remove it. as you've foun