Posts

javascript - How to nest Sequelize associations? -

i trying nest associations using node/sequelize/postgresql. common scenario (i believe), have yet determine how it. here scenario. person -- location (1:m) ----- sublocation (1:m) the person model has belongstomany association working great. have personlocation table holds ids of both person , location , location(s) returned person query. here's gets tricky. need associate personlocation sublocation needs 1:m relationship. person.belongstomany(location, {through: 'personlocation'}); --this how envision work, since defined personlocation association, cannot access way. personlocation.belongstomany(sublocation, {through: 'personlocationsublocation'}); the person have 1:m locations, each of locations have multiple 1:m sublocations. when doing query on person, want see person/locations/sublocations person. the database person id name location id name sublocation id name personlocation id personid locationid pers...

authentication - Google service account doesn't see project ID -

i'm trying authorize using gcloud service account: gcloud auth \ activate-service-account "${gc_service_account}" \ --key-file <filename> \ --project <project name> it authorizes successfully, can't seem find project showing following error commands: error: (gcloud.compute.copy-files) not fetch instance: - resource 'projects/<project name>' not found p.s. works fine gcloud auth login for sake of else encounters problem: looks transient issue. please generate new service account , try again. if doesn't work, please comment on answer.

Spring/AngularJS- receiving null data on server -

on ui/form have <div ng-controller="myformcontroller"> <form name="dataform" ng-submit="submitform()"> first name:<br> <input type="text" ng-model="user.firstname" value="{{user.firstname}}"><br> last name:<br> <input type="text" ng-model="user.lastname" value="{{user.lastname}}"> <br><br> <input type="submit" value="submit"> </form> </div> and controller on ui-side configured mycontrollers.controller('myformcontroller', ['$scope','$http', function myformcontroller( $scope, $http){ $scope.user = { "firstname": "firsname", "lastname": "lastname", ...

r - why function rbind.data.frame behave different in do.call -

Image
i have question do.call, pretty strange 1. trying do i trying bind many data frames 1 single data frame, data frames in list t3, may see pic below: 2. methods 2.1 1 works t4 <- do.call(rbind.data.frame, t3) 2.2 not works t4 <- rbind.data.frame(t3) the error message below: 3. question i think rbind.data.frame behave same if remove do.call, why works if using do.call? in advance. the function do.call(fun, list) designed accept input function fun along list input list . applies function each element in list , aggregates results. in call t4 <- rbind.data.frame(t3) you trying rbind list of data frames, when rbind.data.frame function expecting single data frame instead of t3 input. you use rbind.data.frame without do.call if wanted to. assuming had 5 elements in list t3 , following should work: t4 <- rbind.data.frame(t3[[1]], t3[[2]], t3[[3]], t3[[4]], t3[[5]]) as can see, tedious (and not readable) quickly. advantage...

cordova - backbutton event is not been fired in phongap -

i developing mobile app using phonegap, have problem in handling backbutton event. code is, i have device ready in index.js var app = { // application constructor initialize: function() { this.bindevents(); }, bindevents: function() { document.addeventlistener('deviceready', this.ondeviceready, false); }, ondeviceready: function() { parseplugin.initialize("xxxxxxx", "xxxxxxx", function(){ //nothing required }, function(e){ alert('unable initialize parse!'); }); parseplugin.getinstallationid(function(id) { window.localstorage.setitem("devicetoken", id); }, function(e) { alert('unable devicetoken!'); }); app.receivedevent('deviceready'); window.location = "main.html" }, // update dom on received event receivedevent: function(id) { } }; app...

c++ - QT QIcon properties for custom widget in designer -

Image
i have been working little while on creating qt custom designer widget gui menus. idea being drag designer, select number of frames you'd like, how many buttons per frame, etc. , generates , sizes you. the way widget structured there properties configure each button frame in. example, use button0text field enter text under button0 while editing in frame 0, use again edit button0 in frame 1. both buttons retain individual changes each frame. the problem normally when switch frames of properties updated reflect status of frame. exception being qicon. correct icon retained in actual graphical representation , builds correctly, file path in property list of last edited property. think extremely confusing end user , have found no way fix it. example, if set text , icons in frame 0 switch frame 1 text in property list update reflect state of frame 1 icon path names still show last edit in frame 0 , not actual icon in frame 1. i have tried things simple as: setproperty(...

javascript - JS function to hide or show elements -

Image
i have json files, load them both 2 tables this: $(window).load(function(){ $.getjson('http://1xxxxxx/xxxxx_1_18.json', function(data) { var output="<div class='outer'>"; (var in data.lbclassic118) { output+="<div style='visibility:hidden;' class='lbclassic118'id="+"age" + data.lbclassic118[i].ageinweeks+">"+ '<table class="table table-responsive"><tr class="cabecera"><th colspan="3"><center><strong>age (weeks)'+ data.lbclassic118[i].ageinweeks+'</strong></center></th></tr><tr><td rowspan="3">body weight (g)</td><td>average</td><td><strong>'+ data.lbclassic118[i].average+'</strong></td></tr><tr><td>range min</td><td><strong>'+ data.lbclas...