Posts

Showing posts from February, 2012

Loopback ACL on an individual property? -

it's possible set acl on method basis in loopback. instance can set access levels on find, update, delete etc. there way filter out sensitive properties on models? say want expose user model via rest, want properties protected acl. example maybe don't want expose phonenumber or address if query isn't made owner or administrator. i see 2 different ways achieve this: extend basic user model own remote method findbyid , check user roles, exposing different data them. add "before" remote hook findbyid , check if user $owner - if call next, if not, call custom method returns data want expose public (check out https://docs.strongloop.com/display/public/lb/remote+hooks ), not 100% sure works built in user methods thought hope helps, greetz

c# - Popup in windows phone app -

is possible show popup in windows phone app based on user action, want display 1 pop when user tap once on screen. for example, in windows phone if select text single tap gives copy button popup, wanted display popup when user tap twice. , should work in app, browser, email, message etc if understand correctly, application show "popup" on user action in other applications. far i'm aware not allowed have interaction of kind other applications , there no system api define or add kind of behavior (would security nightmare). can send/share data other applications, or have background tasks can run code in background.

When does angularjs create new scopes -

angularjs seems create new scopes, in there parent scope, child scope, , sibling scope. what determines when new scope created? example, if use ng-inspector view scopes present, there $rootscope, , other scopes, not obvious me other scopes correspond to, nor clear me when these other scopes created/destroyed. believe created/destroyed because $id changes. changes occur if navigate around , press forwards/back. angular creates new scope every instantiated controller on part of dom. angular creates scope every directive (except scope:false, means directives isolated scope, , scope:true). scope created built in directives such ng-repeat creates scope every repeated item. also when use ng-if directive can remove , add parts of dom , when adds controllers , directives add scopes again.

How to implement a retry mechanism in jersey-client java -

i doing http rest api calls using jersey-client. want retry failure request. if return error code not 200 want retry again few times. how can using jersey client for implementing retries in situation, check out failsafe : retrypolicy retrypolicy = new retrypolicy() .retryif((clientresponse response) -> response.getstatus() != 200) .withdelay(1, timeunit.seconds) .withmaxretries(3); failsafe.with(retrypolicy).get(() -> webresource.post(clientresponse.class, input)); this example retries if response status != 200, 3 times, 1 second delay between retries.

C++ Template Classes and Matlab Mex -

i'm wondering if there elegant way write matlab/mex interface templated c++ code. here situation: have written nice set of c++ template classes so: template<footype t> foo{ private: //some data public: //constructors, methods }; template<bartype s> bar{ private: //some data public: //constructors, methods }; template<footype t, bartype s> myclass{ private: foo<t> *d; bar<s> *m; public: //constructors, methods }; if have say, n different footype s , m different bartype s, have n*m different parameter choices myclass ( footype , bartype custom typename s, incedentally). now, if writing c++ program use these classes, simple: int main() { foo<footype1> *f = new foo<footype1>(params); bar<bartype3> *b = new bar<bartype3>(params); myclass<footype1,bartype3> *m = new myclass(f,b); m->dothing(); re

tv - Panasonic API for Firefox OS Apps -

thanks mdn deployed simple app on panasonic cxw754. far good. i'd have access screen settings brightness etc. there api provided panasonic or can plain firefox os api somehow? i looked @ https://github.com/mozilla-b2g/gaia/tree/master/tv_apps but navigator.mozsettings null , navigator.tv not exist on tv runtime :( you should able change screen brightness using navigator.mozpower.screenbrightness powermanager api. certified apps can access api though.

FHIR: Nested extensions -

what correct representation of multi-level fhir extension? <extension url="http://example.com/dataelement/researchauth"> <extension url="http://example.com/dataelement/researchauth.type"> <valuecode value="local" /> </extension> <extension url="http://example.com/dataelement/researchauth.flag> <valueboolean value="true" /> </extension> </extension> -- or -- <extension url="http://example.com/dataelement/researchauth"> <extension url="http://example.com/dataelement/researchauth#type"> <valuecode value="local" /> </extension> <extension url="http://example.com/dataelement/researchauth#flag> <valueboolean value="true" /> </extension> </extension> in structuredefinition, should url sub-extensions qualified (url: " http://example.com/dataelemen

php - Laravel 5.1 - Return Data from Jobs? -

i'm starting use jobs in laravel 5.1 , wondering if it's practice return data job? haven't seen examples of that, here's scenario. lets internal messaging system between users: // controller method public function store(request $request) { if (!$this->messagevalidator->isvalid($request->all())) { return redirect()->back()->withinput()->witherrors($this->messagevalidator->geterrors()); } $this->dispatchfrom(postmessage::class, $request, [ 'user' => auth::user() ]); return redirect('messages'); } so job take request data , user, , perform several tasks // in postmessage job public function handle( // dependencies here) { // create new thread // add message database // store recipients of message in database // send email notifications involced return $message_id; } at end of handle() method, returned $message_id can use redirect in controll

java - Can't start Application using Websphere 8.5.5, hibernate jpa 4.2.6, oracle 12c -

i have problem freaking me out. this persistence.xml, persistence unit correct. <persistence-unit name="pu-administrativo" transaction-type="jta"> <provider>org.hibernate.ejb.hibernatepersistence</provider> <non-jta-data-source>jdbc/oracle</non-jta-data-source> <!-- incluir entidades --> <class>grupousuario</class> <class>dominio</class> <properties> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.format_sql" value="true" /> <property name="hibernate.dialect" value="org.hibernate.dialect.oracledialect" /> <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.webs

css - How to place this div at the bottom of the document? -

This summary is not available. Please click here to view the post.

Google Maps Android API v2 not show the map -

i've problem show map using google map android api v2. the app debug dont show error when call activity blank mapview no map inside. my code is: activity_map.xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" > <com.google.android.gms.maps.mapview android:id="@+id/map_view" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </linearlayout> mapvieweractivity public class mapvieweractivity extends activity { mapview mapview; googlemap map; /** called when activity first created. */ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.a

sql - Should validation be carried out at the application or database level? -

i relatively new database programming , find coding aspect of sql counter intuitive. coding mean, example, finding single string value in column , capitalizing it, concatenating value, modifying based on table references it, etc. my question whether better enforce rules governing data @ database level or @ application level, , why. this article (see enforcing integrity via applications), example, argues should enforced @ database level. here 2 examples, 1 obvious, 1 more complex. if have simple person table so create table person( id serial, age int check (age>=0) ); it makes sense enforce non negative age @ database level. however, if have more complicated example so create table person( id serial, age int check (age>=0), spouse int references person (id) ); ensuring both spouses on 18 both spouses single @ time of marriage spouses not in polygamous relationship requires more complex triggers. alternatively, these checked when add

Rails rollback when creating user with nested forms -

i'm getting rollback when trying add user db , i'm not sure why. i have 3 models: company.rb class company < activerecord::base acts_as_paranoid has_many :locations, dependent: :destroy has_many :users, dependent: :destroy has_many :tests, through: :locations has_many :reports, dependent: :destroy accepts_nested_attributes_for :locations, :users validates_presence_of :name end ** user.rb ** class user < activerecord::base acts_as_paranoid devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable, :registerable belongs_to :company has_and_belongs_to_many :roles end ** location.rb ** class location < activerecord::base acts_as_paranoid belongs_to :company has_many :network_hosts, dependent: :destroy has_many :tests, dependent: :destroy has_many :commands, dependent: :destroy validates_presence_of :company, :identifier, :name validates_uniqueness_of :identifier delegate

java - How to transfer outputs of methods to the dialog boxes? -

try { project.firebuildstarted(); project.init(); projecthelper projecthelper = projecthelper.getprojecthelper(); project.addreference("ant.projecthelper", projecthelper); projecthelper.parse(project, buildfile); // if no target specified default target executed. string targettoexecute = (target != null && target.trim().length() > 0) ? target .trim() : project.getdefaulttarget(); project.executetarget(targettoexecute); project.firebuildfinished(null); success = true; } catch (buildexception buildexception) { project.firebuildfinished(buildexception); joptionpane.showmessagedialog(null, buildexception, "warning", joptionpane.warning_message); throw new runtimeexception( "!!! unable restart iehs app !!!", buildexception); } above methods giving output on console, need them in dialo

javascript - Prevent anchor click after one click -

i facing 1 issue, want disable anchor click after 1 click. have on-click attribute set in anchor tag. below html <a style="cursor:pointer;" id="someid" onclick="myfuntion()">verify</a> after click "verify" changing anchors text "verifying..." , 1 more thing trying disable anchor avoid click in between verification logic going on. i have tried event.preventdefault() , added disabled attribute anchor. nothing works. please help! if using jquery have done more easly. here add new class link show has been clicked already. check when click made. <a style="cursor:pointer;" id="someid">verify</a> $('#someid').on('click',function(){ //check if button has class 'disabled' , function. if(! $(this).hasclass('disabled')){ $(this).addclass('disabled'); myfuntion(); $(this).removeclass('disabled'

scala - Combinatorial explosion of implicit objects -

i have case class, this: case class container[t, m](value: t, modifier: m) i want make possible have ordering on container t have ordering too. don't want make t <: ordered[t] , because container should able contain non-orderable values well. my first try implement ordered , this: case class container[t, m](value: t, modifier: m) extends ordered[container[t, m]] { override def compare(that: container[t, m])(implicit ev: ordering[t]): int = ev.compare(value, that.value) } but doesn't work: because of implicit parameter, compare no longer implements trait. so decided try type class approach: class containerordering[t, m](implicit ev: ordering[t]) extends ordering[container[t, m]] { override def compare(x: container[t, m], y: container[t, m]): int = ev.compare(x.value, y.value) } implicit object containerorderingint extends containerordering[int, int] this works (if import ordering.implicits._ ), have new problem: every type m , need separate impl

c# - Ninject resolve all for interface type -

public selectuserquery: iquery{ public string command { get{ return "...."; } } } public class querydispatcher : iquerydispatcher { //... //.. public void dispatch<tquery>(tquery query) tquery : iquery { foreach (var handler in kernel.resolveall<iqueryhandler<tquery>>()) { handler.handle(query); } } } public class querymanager{ //... public activate(){ querydispatcher.dispatch(new selectuserquery()); } } this resolving types used querydispatcher.dispatch(new selectuserquery()); but creating private method in querymanager run dispatch operations this: public class querymanager{ //... public seletectuser(){ apply(new selectuserquery()); } private apply(iquery query){ querydispatcher.dispatch(query);

Prestashop, How to Create a New Non-CMS Page For JS,CSS, PHP -

prestashop v1.6 hi, i need create new non-cms form page includes logic, js, css, , maybe php. this page submit php script perform logic , redirect page. if possible include php in form page, if not, need include php in formpagecontroller , use template file or something. apart body, include form, page needs shop need include header , footer. i tried using cms page restrictive in allow. i set root file: form-page.php <?php include(dirname(__file__).'/config/config.inc.php'); tools::displayfileasdeprecated(); include(dirname(__file__).'/header.php'); $smarty->display(_ps_theme_dir_.'form-page.tpl'); include(dirname(__file__).'/footer.php'); a controller: formpage.php <?php class formpagecontrollercore extends frontcontroller { public function init(){ parent::init(); } public function setmedia() { parent::setmedia(); $this->addcss(_theme_css_dir_.'form-page.css');

javascript - JS, using foo.exports to return an array to share across different pages -

i have 2 js files in node.js app using socket.io , need share array between 2 files, using js exports so: foo.exports = function(){ return usernames } this works great if array has values, if array empty doesn't return empty array returns error in terminal: typeerror: object #<object> has no method 'rooms' in file error occurs include js array so: var chat = require('./index.js') chat.rooms() now, thinking because array empty js doesn't recognize empty function function @ all, tried below code make usernames array have value (if empty, push 'empty' array). check value 'empty' in array: but still same error... if(usernames.length > 0){ return usernames; console.log('usernames has values'); } else { console.log('empty usernames array'); return usernames.push('empty'); } regards

sql - How to Group by with Count and Join? -

i have 2 tables, a(id, name), b(id). want record group name, , count of a(id) , b(id) i trying way select left(od.number, 3) terminal, count(left(od.number, 2)) ordercount, count(ot.orderid) gff_bog_orderlocation.dbo.orderdetail od, gff_bog_orderlocation.dbo.ordertable ot ot.orderid in (select orderid gff_bog_orderlocation.dbo.orderdetail left(number, 3) in(select left(number, 3) gff_bog_orderlocation.dbo.orderdetail group left(number, 3))) group left(od.number, 3) order terminal but not getting properly. based on question , not sql i'd you'd need this. create table tablea (id int, name varchar(50)) create table tableb (id int) insert tablea values (1, 'us'), (2, 'us'), (3, 'canada'), (4, 'mexico'), (5, 'm

Is it possible to link IPython widgets less naively? -

i'll start simple example of i'm trying do: say, have 2 intslider-widgets. have 1 represent x , other x^2 (unidirectional link). maybe want first slider display sqrt(x^2), if play second slider (bidirectional link). this would,very naively, translate in this: l1 = traitlets.link((widg1, 'value'),(widg2, 5* 'value')) which of course doesn't, because second tuple argument supposed string, passing 'valuevaluevaluevaluevalue'. anyway, possible , if yes, has been implemented? link passes on same value. if want transform value, need callback: def widg1_changed(name, new_value): widg2.value = 5 * new_value widg1.on_trait_change(widg1_changed, 'value') i don't know of way bidirectionally @ present.

windows 8.1 - Access Virtual Smart Card In Javascript -

i trying access smart card through web browser (only ie), on windows 8.1, in javascript. given read on web, possible using activex, don't know application.class used access smart card readers, , smart card itself. what activex object should instanciate access smart card readers ? is other way open connection smart cards ? (given project's limits, can not use winrt or create java, .net or web application)

android - What is the recommended design pattern to avoid null pointer exceptions on references within a runnable when calling removeCallbacks() -

referencing code below. myratingbar.setrating , myhandler.postdelayed within runnable sporadically null pointer exception after calling stop(). i'm not sure best way avoid is. problem worsens if runnable contains objects listeners , listeners have references. private handler myhandler; private runnable myrunnable; private ratingbar myratingbar; public void start() { myrunnable = new runnable() { public void run() { myratingbar.setrating(1); myhandler.postdelayed(this, 1000); } } myhandler = new handler(); myhandler.postdelayed(myrunnable, 0); } public void stop() { if(myhandler != null) { myhandler.removecallbacksandmessages(null); myhandler = null; } myrunnable = null; myratingbar = null; } adding stacktrace. in stacktrace valueanimator onanimationupdate executing within runnable. idea same overall. still executing in runnable when stop() goes set null. 08-07

javascript - Reference return by window.open() is Undefined in Edge browser -

the following code isn’t working edge though works other browsers. function postlink(locn, trgt) { = document.createelement("a"); a.id = 'link'; a.targt = trgt; a.href = locn; var newwin = window.open(a); newwin.opener = newwin; } <a onclick="postlink('http://www.google.com','_blank');return false;">clickme</a> it gives newwin undefined . whereas, window.open() works edge. explanation / appreciated. from window.open() docs: syntax: window.open(url,name,specs,replace) http://www.w3schools.com/jsref/met_win_open.asp so, why not simplify code this: <a onclick="window.open('http://www.google.com','_blank');">clickme</a> https://jsfiddle.net/3aaljjoh/

java - Multipart Config max file size not working in Tomcat 8 -

Image
i have post api consumer multipart/form-data data. @post @consumes(mediatype.multipart_form_data) public response postevent(@headerparam("id") string id, @headerparam ("schema-version") string schemaversion, byte[] serializedevents) i wanted limit maximum uploaded file size 64 kb. so, made following change in webapps\<appname>\web-inf\web.xml <multipart-config> <max-file-size>65536</max-file-size> <max-request-size>65536</max-request-size> <file-size-threshold>0</file-size-threshold> </multipart-config> but not seem working. tried changing maxpostsize parameter of connector, though, know work case consuming body application/x-www-form-urlencoded . i using tomcat 8.0 , jersey rest implementation. can please suggest going wrong here? edit: here screenshot of request: and, here part of web.xml : <servlet> <servlet-name>jersey-servlet</servlet-name>

Unable to use bar function after updating to Matlab 2014b -

this pretty straight-forward question. unable plot bar graph since updated matlab 2014b. when try simple example matlab documentation : y = [75 91 105 123.5 131 150 179 203 226 249 281.5]; bar(y) i receive following message (and no figure) : warning: error updating bar. following chain of causes of error: attempt reference field of non-structure array. i run matlab in unix , not problem matlab 2013b. still able plot regular lines , surfaces. anyone has same issue? in advance.

java - Android can't load FragmentActivity from MainActivity -

i'm following google android tutorial basic feel of how apps created can't figure out how implement tabbed menu bar on action menu. following, first set of tutorials, can create basic input form , load inputted text new activity. tried create new button , link activity tutorial below. it's exact copy of google's example https://developer.android.com/training/implementing-navigation/lateral.html here manifest file. have original main activity, form input , demo activity contains action bar tabbed menu <activity android:name=".mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".displaymessageactivity" android:labe

node.js - Insert document with nested ObjectId -

i trying insert document mongodb looks this: _id : objectid(<id>) players : { objectid(<id>) { entry : 'foo' } } however, can't form json in node objectid key. what's best practice this? thanks! according mongodb documentation : field names strings. so can't use objectid's keys, can use string representation: var playersobj = {}; playersobj[objectid()] = { entry : 'foo' }; // stringify objectid var document = { _id : objectid(), players : playersobj };

javascript - Adding a custom drop down to highstock range selector menu -

Image
i want add custom drop down button following image highchart. tried adding custom button in this fiddle , doesn't provide way add drop down above chart. 1 know correct method. exporting: { buttons: { custombutton: { x: -150, onclick: function () { alert('clicked'); }, symbol: 'circle' } } } you can use html select defined css styles, position absolute , top/left. mean using tag in html, placed absolutely. html: <div class="chart"> <select> <option>ohlc</option> <option>candlestick</option> </select> <div id="container" style="height: 400px; width:750px;"></div> css: .chart { position:relative; } .chart select { position:absolute; right:50%; top:45px; z-index:9999; } example: http://jsfiddle.net/7v2bwv

WCF Duplex Is it possible to wait for callback to complete? -

i writing n duplex wcf application, want make sure client call must halt till callback method complete. suggestions appreciated! just want make sure client call must halt till callback method complete. to understanding, in case, don't need employ duplex communication system. singular request - reply communication system should suffice; way, default communication mechanism.

sql server - how to show year in SQL -

i able group item counts 3 years prior , 3 years after on date, not able break item counts in 3 separate years. take please? select item, case when date >='12/6/02' , date <'12/6/05' , item ='rice' 'rice prior' case when date >='12/06/05' , date <'12/6/08' , item ='rice' 'rice post' end type, count (qty) rice #temp date >='12/6/02' , date <'12/6/08' group item, case when date >='12/6/02' , date <'12/6/05' , item ='rice' 'rice prior' case when date >='12/06/05' , date <'12/6/08' , item ='rice' 'rice post' end could please take , break down 3 years please? running script, result shows type, rice rice prior 444 rice post 555 my desire output like: year3, year2, year1 year1, year2, year3 4 44 400 5 500 50 thanks, joe this should match desired query using pivot , d

windows phone 8.1 - Isolated storage in In a multi-page c# -

i have created 2 pages in application ... there on front page tkstpeix write name when entering storage , set application on page, , when enter second page in application name not come out! example: when open app , type in name "ibra" text box on second page name not appear! ->page1: using myproject.model; public partial class test1 : phoneapplicationpage { isolatedstoragesettings data = isolatedstoragesettings.applicationsettings; list<userdata> objuserdatalist = new list<userdata>(); public test1() { initializecomponent(); this.loaded += test1_loaded; } private void test1_loaded(object sender, routedeventargs e) { if (data.contains("usernamedata")) { navigationservice.navigate(new uri("/test2.xaml", urikind.relative)); } } private void namebox_gotfocus(object sender, routedeventargs e) { textbox tb = (textbox)sender; tb.

html - Down menu and tablet -

i have small piece of code displays small pop-up menu in css not work tablet because "hover" can not implemented. how enhance menu can scroll 1 touch of touch screen? <html> <head> <title>test</title> <style type="text/css"> #menu ul { margin:0; padding:0; list-style-type:none; text-align:center; } #menu li { float:left; margin:auto; padding:5px; background-color: #2672ec; font-family: "segoe ui light","segoe ui web light","segoe ui web regular","segoe ui","segoe ui symbol","helveticaneue-light","helvetica neue",arial,sans-serif; font-weight: bold; color:white; } #menu li { display:block; color:white; text-decoration:none; padding:5px; border: 1px solid #2672ec; } #menu li a:hover { border: 1px solid #ffffff; } #menu ul li ul { display:none; } #menu ul li:hover ul { display:block; } #menu li:hover ul li { float:none; } </style> <!--[if !ie]> &l

cordova - How to check whether data exists and insert by one query in websql? -

can have 1 full query check whether data has been in database , insert if not? i believe can done in normal sql using transaction . the consideration not manual select query insert have more 1 table done. since websql implementation of sqlite, use insert or ignore manage conflict resolution in single transaction. for example, if had following table: create table data (id integer primary key, event_id integer, track_id integer, value integer); create unique index data_idx on data(event_id, track_id); which contained data: 1|1|2|3 2|2|3|4 you issue following sequential statements: insert or ignore data values (null, 1, 2, 3); insert or ignore data values (null, 2, 3, 5); insert or ignore data values (null, 3, 4, 5); and result of select * data be: 1|1|2|3 2|2|3|4 3|3|4|5 the existing rows not updated because of constraint violation, first 2 statements ignore instead of fail, third execute , third row inserted.

googletest - How to set an EXPECT_CALL to function being called after a specific time? -

i'm setting expectations (using gtest , gmock) on functions, like: expect_call(mockedtimer, expired()).times(1); how can set expectation like: "expect function executed in 100ms" ? probably easiest way set timer measures how long takes expired() invoked, , add test assertion duration 100ms. in context of test, this: void startstopwatch(); void stopstopwarch(); unsigned getstopwatchresult(); test(timertest, timerexpiresin100ms) { // set mocktimer, etc. expect_call(mockedtimer, expired()).willonce(invoke(&stopstopwatch)); startstopwatch(); // test logic, waits until expired() called, goes here assert_eq(100u, getstopwatchresult()); } this rough, of course, idea. let me know if helpful. on editorial note, in general, tests rely on specific timing (i.e. rely on event occuring within specific time frame) rather unreliable. unless there's very reason 100ms constraint, might worthwhile re-think test logic :)

python - Conda can't activate environment -

microsoft windows [version 6.1.7601] copyright (c) 2009 microsoft corporation. rights reserved. c:\users>conda env list # conda environments: # deepdream c:\users\appdata\local\continuum\anaconda32\env s\deepdream pd16.2 c:\users\appdata\local\continuum\anaconda32\env s\pd16.2 root * c:\users\appdata\local\continuum\anaconda32 c:\users>activate deepdream no environment named "deepdream" exists in c:\users\appdata\local\continuum\anaconda32\envs c:\users> i've made environment deepdream code , i'm unable activate through command prompt. seems conda recognizes environment, activating fails any ideas? i don't know why, folder containing environments env conda looking folder called envs - have 2 options: rename env folder envs set conda_envs_path environment variable point path.

c# - Array-List not contains -

i have list 2 attributs/objects. first int-array 2 ids. i want add new object list, if value 12 and 21 (only in combination) not exist in ids-array of hole list. //if 1 single id found okay - combination of both ids needs jump else-case. :) *12 , 21 vars later, no static values i don't know why, isn't working... if (id != destination.id && !(thisdistances.exists(x => x.ids.contains(12)) && thisdistances.exists(x => x.ids.contains(21))) ) { ... } public class distancedata { public int[] ids; public int distance; } protected void makedistances(int id, double geolat, double geolon, int limit = 100) { int = 0; list<distancedata> thisdistances = new list<distancedata>(); foreach (var destination in destinations) { if (id != destination.id && !(thisdistances.exists(x => x.ids.contains(12)) && thisdistances.exists(x => x.ids.contains(21)))) { thisdistances.add(n

node.js - NodeJS application behind APache2 reverse proxy get error "413 Request Entity Too Large" on upload files -

i work on node.js application permits users upload large files. when run on 8080 or 3000 or whatever, okay. but when access on 80 behind apache2 mod_proxy configured reverse proxy, error on upload (files > 1mb ) 413 request entity large i tryed add directive apache config : limitrequestbody 0 but doesn't change behavior. don't know search right conf. solved. it seems apache reverse proxy works mod_proxy needs mod_proxy_http . in case application works fine fisrt apart uploading files > 1mb. i found references mod_proxy_http , enabled : # a2enmod proxy_http # apache2 restart now seems work. trying upload larger , larger files server test it. last 160mb , uploaded fine.

jquery load with chart.js -

i'm loading parts of page jquery load , want use chart.js plugin build chart part of page. load html loads fine , chart build if refresh page, sometimes, never builds chart on first page load. need defer or promise here? yes, if loading html canvas element using jquery .load() , need put chart initialization in complete callback, so $("#result").load("canvas.html", function () { var data = { labels: ['a', 'b', 'c', 'd', 'e', 'f', 'g'], datasets: [ { data: [12, 23, 23, 43, 45, 12, 33] } ] }; var ctx = document.getelementbyid("mychart").getcontext("2d"); var mylinechart = new chart(ctx).line(data); }); where canvas.html is <canvas id="mychart" height="300" width="500"></canvas> the canvas element needs have non-zero render size when data loaded

oracle11g - Why is Oracle using full table scan when it should use an index? -

i'm doing experimentation query plans in oracle, , have following table: --create table use create table skewed_data( emp_id int, dept int, col2 int, constraint skewed_data_pk primary key (emp_id) ); --add index on dept create index skewed_data_index1 on skewed_data(dept); i insert 1 million rows of data 999,999 rows have dept id 1, , 1 row has dept id 99. before calculating statistics on table, oracle autotrace shows when running following queries, using index scan both: select avg(col2) skewed_data d dept = 1; select avg(col2) skewed_data d dept = 99; it's understanding more efficient in case use full table scan dept id 1, , index scan dept id 2. i run following command generate statistics table: execute dbms_stats.gather_table_stats ('harry','skewed_data'); and querying dba_tab_statistics , user_tab_col_statistics confirms stats , histograms have been gathered. running autotrace on following queries shows full table scan both!

optimization - genetic algorithm optimiyation r -

i kindly ask if has idea how build genetic algorithm ga model able solve "diet problem" constraints , minimization objective in r? thank , appreciate contribution i use rgenoud package in r. see paper here: http://sekhon.berkeley.edu/papers/rgenoudjss.pdf

jquery - How to show div depending on the amount of value -

how show div depending on amount of value? my code - fiddle jquery(function () { jquery('#btn_test').click(function () { $(this).parent().children('#test_inner').slidetoggle('500'); return false; }); jquery("input[type='radio']").change(function () { calculate(); }); function calculate() { var sum = 0; jquery("input[type='radio']:checked").each(function () { sum += isnan(this.value) || $.trim(this.value) === '' ? 0 : parsefloat(this.value); jquery("#totalsum").html(sum); $("input[type='radio']").change(function () { if (value <= 8) { jquery("#test_result_item_1").show(); } else if ((9 <= value) && (value <= 12)) { jquery("#test_result_item_2"

hapijs - Multiple connections on a hapi server -

i want add plugins hapi server has multiple connections listening on different ips. is possible add plugin servers configured? or how loop on servers add plugin of them? by default plugins add routes connections when calling server.route() . to limit connections plugin adds routes to, can use labels when creating connections , specify labels when registering plugins. here's example: var hapi = require('hapi'); var server = new hapi.server(); server.connection({ port: 8080, labels: 'a' }); server.connection({ port: 8081, labels: 'b' }); server.connection({ port: 8082, labels: 'c' }); var plugin1 = function (server, options, next) { server.route({ method: 'get', path: '/plugin1', handler: function (request, reply) { reply('hi plugin 1'); } }); next(); }; plugin1.attributes = { name: 'plugin1' }; var plugin2 = function (server, options, ne