Posts

Showing posts from July, 2015

mysql - Error querying database using Diesel, r2d2, and r2d2-diesel -

i've set system using connection pooling system utilizing diesel , r2d2 , , r2d2-diesel serve api host web application. i've been following blog post basis has helped me set things up. however, i've made modification of switching mysql database backend; i've added necessary diesel features , assumed wouldn't issue. here's code use set connection pool (very same blog post): use diesel::prelude::*; use diesel::mysql::mysqlconnection; use r2d2::{ gettimeout, pool, pooledconnection, config }; use r2d2_diesel::connectionmanager; pub struct db(pooledconnection<connectionmanager<mysqlconnection>>); impl db { pub fn conn(&self) -> &mysqlconnection { &*self.0 } } pub fn create_db_pool() -> pool<connectionmanager<mysqlconnection>> { let config = config::default(); let manager = connectionmanager::<mysqlconnection>::new(format!("{}", db_credentials)); pool::new(config, mana

material design - Close programmatically an overlay MUI CSS -

how close overlay created mui css ? for now, see : mui.overlay('off', modalel); but looks ugly since modalel has global reachable in function that'll trigger closing of overlay had same issue, yes way go declare modal global in view, using hide modal mui.overlay('off', modalel) using display modal mui.overlay('on', modalel);

docker odoo 9 install pika error -

i have simple docker build want achieve. pull base image odoo:9 , install pika library from odoo:9 run pip install pika but can't proceed i'm getting error. enter image description here btw, using docker in windows environment. my solution that, pull dockerfile official docker odoo. add line "&& pip install pika" shown in attached image. enter image description here build again , have customize docker image pika library installed.

java - Retrofit - Multipart Form with image upload and string array -

i creating android app using retrofit 2.0 send post request server. request allow user create group has name, array of users, , image. using multipart form in request because app uploads image server in form of file. this presenter, given fields needed request. public void submitgroup(@nonnull final string accesstoken, @nonnull final string userid, @nonnull final string groupname, @nonnull final string groupiconuri, @nullable final string[] members) { file file = new file(groupiconuri); requestbody requestowner = requestbody.create( mediatype.parse("multipart/form-data"), userid); requestbody requestgroupname = requestbody.create( mediatype.parse("multipart/form-data"), groupname); /** * requestmembers string[] containing member * id. field having trouble * making re

recursion - what is the base case here in this recursive function?? How its working actually? -

what base case here ?? functional how it's working? int ispali(char *s, int l, int r) { return ((l == r) || (s[l] == s[r] && ispali(s, l+1, r-1))); } int main() { char str[100]; scanf("%s", str); if(ispali(str, 0, strlen(str)-1)) printf("palindrome\n"); else printf("not palindrome\n"); } it's in line of function. remember short-circuit logic in evaluating expressions. or can changed to if (l == r) return true; else return (s[l] == s[r] && ispali(s, l+1, r-1)); of course, can apply short-circuit else part: else if s[l] == s[r] return ispali(s, l+1, r-1); else return false;

soap client - How to create wsse header with python-suds and adding attributes to it -

i trying add wsse header xml envelope interact webservice. the xml should below <?xml version="1.0" encoding="utf-8"?> <soap-env:envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.testingsite.com/------something" xmlns:ns2="http://www.testingsite.com/-----something" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> <soap-env:header> <wsse:security mustunderstand = "true"></wsse:security> </soap-env:header> <ns0:body> <mainrequest></mainrequest> xmlns="http://www.everythingisosm.com/something"> <block1> xmlns="http://www.everythingisosm.com"> </block1> <requestparameters/> </mainrequest&

Not able to launch DynamoDB Storage Backend for Titan with Gremlin Server on Amazon EC2 by using a AWS CloudFormation template -

i trying configure dynamodb storage backend titan gremlin server on amazon ec2 using aws cloudformation template, following link here under prerequisites mentioned need gremlin-server , dynamodb.properties files. q1. have got files github link . these correct files , can use or need modify contents of these files ? q2. on using these files is, able create cloudformation stack creates ec2 instance not able ssh ec2 instance . not creating gremlin server , no tables in dynamodb, per documentation should. not getting doing wrong? any highly appreciated. please try new cloudformation template available on janusgraph branch . tested yesterday , appears work.

javascript - Angular2 test "provide => use value" -

i have following code invoke angular2 import { platformbrowserdynamic } "@angular/platform-browser-dynamic"; import { appmodule } "./src/app"; export function runangular2app(legacymodel: any) { platformbrowserdynamic([ { provide: "legacymodel", usevalue: model } ]).bootstrapmodule(appmodule) .then(success => console.log("ng2 bootstrap success")) .catch(err => console.error(err)); } and somewhere invoking in manner - var legacymodel = {}; // data require(["myangular2app"], function(app) { app.runangular2app(legacymodel); // input app }); header.component.ts , in component use legacy model - import { component, viewencapsulation, inject } '@angular/core'; @component({ selector: 'app-header', encapsulation: viewencapsulation.emulated, styleurls: [ './header.less' ], templateurl: './header.html' }) export class headercompo

Step Eval Common Lisp -

i have been trying find method "step" eval. call function , evaluates nested list common lisp. for example: '(+ 2 (+ 3 4)) ; eval to: '(+ 2 7) in example evaluated 3 + 4 , stopped right there. did not continue on eval 2 + 7 lisp do. so want code find nested list , eval nested list, without evaluating whole list. for example: '(+ 2 3 4 5 (+ 4 5 (- 5 6) 1 (+ 10 8 5 (- 10 11))) 10 7) it find nested list, (- 10 11) , , eval so: '(+ 2 3 4 5 (+ 4 5 (- 5 6) 1 (+ 10 8 5 -1)) 10 7) again evaluates once, , not evaluate whole list @ once. does know how go make step evaluation nested list? use eval or execute nested part of list without eval ing whole list @ once? problem i'm having don't know how evaluate nested list , put together. don't know how approach this. please enlighten me on how master lisper this. the order of evaluation left-to-right, not right evaluate deepest nested list if want emulate common lisp's behaviou

mysql - Select most "popular" follower for particular person. The more followers someone has, the more "popular" they are -

find "popular" follower specific person. more followers has, more "popular" are. i need sql query select popular follower of particular people. my table - (followers) id | person_id | follower_person_id 1 1 2 2 1 3 3 2 1 4 2 4 5 3 1 6 3 2 7 3 4 8 4 3 for example person_id 1 has total 2 follower, person_id 2 has total 2 followers, person_id 3 has total 3 followers , person_id 4 has total 2 followers. therefore, person_id 3 popular follower person_id 1, person_id 1 popular follower person_id 2 , on... here query not working... select follower_person_id followers f f.person_id = 1 group f.follower_person_id having max(select count(*) followers person_id = f.follower_person_id) you can use following query number of followers each person: select person_id, count(*) cnt followers group person_id output: pers

java - Getting NullPointerException while adding element to ArrayList -

my code: import java.util.random; import java.util.arraylist; public class percolation { arraylist<int[]> grid; random dice = new random(); public percolation(int n){ for(int i=0;i<n;i++){ grid.add(new int[n]); } output(grid,n); } public void output(arraylist<int[]> x,int n){ for(int i=0;i<n;i++) for(int j=0;j<n;j++) system.out.println(x.get(i)[j]); } public static void main(string[] args){ percolation p = new percolation(2); } } using code throws nullpointerexception @ grid.add(new int[n]) . how can add data grid ? you haven't initialize arraylist . arraylist<int[]> grid = new arraylist<>();

css - Style odd and even sibling elements - excluding those set to display:none -

consider these elements: <div class="accordion-content"> <div><?php the_field('f_1'); ?></div> <div><?php the_field('f_2'); ?></div> <div><?php the_field('f_3'); ?></div> <div><?php the_field('f_4'); ?></div> <div><?php the_field('f_5'); ?></div> <div><?php the_field('f_6'); ?></div> <div><?php the_field('f_7'); ?></div> <div><?php the_field('f_8'); ?></div> <div><?php the_field('f_9'); ?></div> <div><?php the_field('f_10'); ?></div> <div><?php the_field('f_11'); ?></div> </div> and styling .accordion-content div:empty{display: none} .accordion-content div:nth-of-type(odd) { background-color:#f0f0f1; } .accordion-content div:n

ios - How to fix Apple Mach-O Linker Error Group issue in xcode? -

Image
i try implement push notification: source but got issue : apple mach-o linker error group no such file or directory: '/users/arunkumar/library/developer/xcode/deriveddata/sample-bskvypzxnjnnszbjeelvenubespf/build/products/debug-iphonesimulator/librctpushnotification-tvos.a how fix issue ? run react-native link you. or use these steps step 1 .xcodeproj file inside it's folder. drag file project on xcode (usually under libraries group on xcode) step 2 click on main project file (the 1 represents .xcodeproj) select build phases , drag static library products folder inside library importing link binary libraries step 3 project's file, select build settings , search header search paths . there should include path library (if has relevant files on subdirectories remember make recursive, react. refer 1 link

javascript - Angular table and HTML Checked Boxes with Disabling Feature in Remaining Checked Boxes -

the goal have checked boxes become disabled when 1 box checked. when use jquery code below, reason not work in solution mentioned here . in example populating table using mvc controller in nodejs , angular stack. when table displays, there checkbox next each name prints in table. is there solution correctly disable checkboxes being populated in angular script when 1 checked box selected? html <table> <thead> <th>names</th> </thead> <tr dir-paginate="x in names | filter:search | itemsperpage:8"> <div class="checkbox" id="namelist"> <td><label><input type="checkbox" name="name" value={{x.name}}> {{ x.name }}</label></td> </div> </tr> </table> js $(document).ready(function(){ $('#namelist input[type=checkbox]').change(function(){ if($(this).is(':checked')){ $('#namelist').find(':ch

java - What is wrong with my Rolling Craps code? -

this question has answer here: what nullpointerexception, , how fix it? 12 answers so coding game of craps requires me roll 2 dice , return sum of dice. rolling 7 or 11 wins game, rolling 2, 3, or 12 lose game. rolling 4, 5 ,6, 8, 9, 10 "establish point" user continues roll until roll same number established or until roll 7, in case lose. in case, exception says "exception in thread "main" java.lang.nullpointerexception @ craps.getsum(craps.java:24) @ craps.playround(craps.java:29) @ craps.main(craps.java:70) c:\users\owner\appdata\local\netbeans\cache\8.2\executor-snippets\run.xml:53: java returned: 1 build failed (total time: 2 seconds)" my die class looks this: import java.util.random; public class die { private int number; private random generator; public die() { generator = new random(); rol

How to add and immediately remove html element by jquery -

i have button , want create or append element when clicking , after 1 sec has removed automatically how can it you can try $('#btnid').click(function(){ $( "#divid" ).append( "<p id="test">test</p>" ); settimeout(function(){ $('#test').remove(); }, 1000); })

Post Map<String,Object> to Spring Controller using Ajax -

i'm trying post model contains map controller, have tried 2 ways: first i'm using regular tag, reaches controller right string key, object of map gets null <c:foreach items="${productquote.prodcontm}" var="productquoteobjtm" varstatus="status"> <tr> <td>${productquoteobjtm.key}</td> <td> <input value="${productquoteobjtm.value.qty}" name="prodcontm['${productquoteobjtm.key}']${productquoteobjtm.value}" id="inputquote${status.index}"/> </td> <td>${productquoteobjtm.value.totalprice}</td> </tr> </c:foreach> also tried pass map using form tag instead, shown in line below: doesn't reach controller, i'm passing form ajax function: $(document).ready(function() { $('#quoteform').submit( function(event) { $.ajax({ url : $("#quoteform").attr("action"), data : $("#

javascript - Adding image in option -

Image
i want add image left of option when list opened , i'm using awesomplete autocomplete plugin , i'd add picture show want do. i try add inline css nothing change $(document).ready(function() { $('.awesomplete').on('awesomplete-select', function() { var $this = $(this), $sibling = $this.next(); if ($sibling.attr('id') == 'mylist') { settimeout(function() { var val = $this.find('input').val(); var datalink = $sibling.find('option:contains("' + val + '")').data('link'); //console.log(datalink); location.href = datalink; }, 500); } }); }); .awesomplete>ul { border-radius: .3em; margin: .2em 0 0; background: hsla(0, 0%, 100%, .9); background: linear-gradient(to bottom right, white, hsla(0, 0%, 100%, .8)); border: 1px solid rgba(0, 0, 0, .3); box-shadow: .05em .2em .6em rgba(0, 0, 0, .2); text-s

javascript - Uncaught ReferenceError: require is not defined -

i trying implement cordova-plugin-email-composer .i installed plugin using cli cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git i got error uncaught referenceerror: require not defined @ email_composer.js:22. in link u can find plugin. added code attached below in index.js file. can solve this? thankyou. index.js: bindevents: function() { document.addeventlistener('deviceready', this.ondeviceready, function () { cordova.plugins.email.isavailable( function (isavailable) { alert("is email mobile available? " + (isavailable ? "yes" : "no")); if(isavailable){ window.plugin.email.open({ to: 'anu.barbie143@gmail.com', subject: 'greetings', body: 'how you? nice greetings leipzig' }, callback, scope); }

php - How to create session on html link click in laravel? -

in laravel project have view-client page link named "add contract" particular client.here have send client_id "contract/create" link how can pass client_id contract page default selected client_id in contract page. there way on link click create session or other way on weigh it. add contract link in client view page. <a href="javascrip:void(0)" name="addcontract" class="btn bg-info-300">+add contract</a>

javascript - How to show and hide legends in google chart -

could let me know best method show/hide line legends (if using checkbox changing visibility). i should having maximum 7 legends in line chart. my code below: function drawgraph(chartsdata, title, charttype) { //debugger; google.charts.load('current', { 'packages': ['corechart'] }); google.charts.setonloadcallback(drawchart); function drawchart() { var data = new google.visualization.datatable(); data.addcolumn('string', ''); data.addcolumn('number', ''); try { var data = google.visualization.arraytodatatable(chartsdata); } catch (e) { //debugger; //document.writeln(e); } var optionsbar = { title: title, isstacked: true, haxis: { type: "datetime", showtextevery: 1, ticks: [2016,2017,2018,2019,2020,2021,2022,20

android - FirebaseProvider not found even if firebase not added to the project -

i have never added firebase in project , eventhough get caused by: java.lang.classnotfoundexception: didn't find class "com.google.firebase.provider.firebaseinitprovider" on path: dexpathlist[[zip file "/data/app/com.wma.ozfoodhunter-1.apk"],nativelibrarydirectories=[/data/app-lib/com.wma.ozfoodhunter-1, /system/lib]] @ dalvik.system.basedexclassloader.findclass(basedexclassloader.java:56) @ java.lang.classloader.loadclass(classloader.java:497) @ java.lang.classloader.loadclass(classloader.java:457) @ android.app.activitythread.installprovider(activitythread.java:4762) @ android.app.activitythread.installcontentproviders(a

How to simplify PHP logical operator? -

i have searched , read documentation , experimented on these logical operator seem nothing works. want simplify if statement if variable same don't need keep rewriting it. example: <?php if($var_1 == 'val_1' || $var_1 == 'val_2' || $var_1 == 'val_3' || $var_2 == 'val_4' || $var_2 == 'val_2' || $var_3 == 'val_5') { // } else { .... } ?> i want simplify this: <?php if($var_1 == ('val_1' || 'val_2' || 'val_3') || $var_2 == ('val_4' || 'val_2') || $var_3 == 'val_5') { // something.. } ?> however code above not work, rather writing $var_1 on , on each different value, how write once ? strictly looking answers using if statement, not switch or other statement, know can use switch case, looking logical operator. thank in advance. you can use in_array() function. more on subject: http://php.net/manual/en/function.in-array.php . e.g. <?php //d

Interpolation non-linear curve in matlab -

can interpolate data: x y 5840 0.01904 5860 0.01906 5880 0.01911 5900 0.01918 5920 0.01928 5940 0.0194 5960 0.01956 5980 0.01974 6000 0.01995 6020 0.02019 6040 0.02044 6060 0.02072 6080 0.02101 6100 0.02132 6120 0.02163 6140 0.02196 6160 0.02228 6180 0.02261 6200 0.02293 6220 0.02325 6240 0.02356 6260 0.02386 6280 0.02415 6300 0.02442 6320 0.02468 6340 0.02492 6360 0.02515 6380 0.02536 6400 0.02554 6420 0.02571 6440 0.02586 6460 0.02599 6480 0.02609 6500 0.02618 6520 0.02625 6540 0.02629 6560 0.02632 6580 0.02632 6600 0.02631 6620 0.02627 6640 0.02622 6660 0.02615 6680 0.02606 6700 0.02595 6720 0.02582 6740 0.02568 6760 0.02553 6780 0.02535 6800 0.02517 6820 0.02497 6840 0.02477 6860 0.02455 6880 0.02432 6900 0.02409 6920 0.02385 6940 0.0236 6960 0.02335 6980 0.02311 7000 0.02286 7020 0.02261 7040

jquery - angularjs - Request header field is not allowed by Access-Control-Allow-Headers in preflight response -

i'm using lib https://github.com/doedje/jquery.soap/ connect ionic app asmx webservice. however, i'm getting error: xmlhttprequest cannot load http://10.10.9.169/userservice3/webservice1.asmxgetuserbyusername . request header field soapaction not allowed access-control-allow-headers in preflight response. jquery.soap.js:456 uncaught error: unexpected content: undefined here's controller.js code: $scope.enterlogin = function(usern,pass) { $.soap({ url: 'http://<webservice's ip address>/userservice3/webservice1.asmx', method: 'getuserbyusername', data: { uname: usern, passw: pass }, success: function (soapresponse) { console.log('response = ' + soapresponse); }, error: function (soapresponse) { // show error console.log('response error = ' + soapresponse); } }); } i've ad

Multiple prototypical inheritance in Javascript -

i have 2 base classes, parentclass1 , parentclass2 . want multiple prototypical inheritance childclass . with single parent class , had code follows. var parentclass = function() { }; parentclass.prototype.greetuser = function(name) { console.log('hi. hello,', name); }; var childclass = function(name) { this.greetuser(name); }; childclass.prototype = object.create(parentclass.prototype); var obj = new childclass('john'); // hi. hello, john and when have inherit 2 parent classes , tried following code. var parentclass1 = function() { }; parentclass1.prototype.greetuser = function(name) { console.log('hi. hello,', name); }; var parentclass2 = function() { }; parentclass2.prototype.askuser = function(name) { console.log('hey, how you,', name); }; var childclass = function(name) { this.askuser(name); this.greetuser(name); }; childclass.prototype = object.create(par

jquery - Cannot get the datetimepicker from second row onwards in my view page -

i not able see div creating datetimepicker first row in create schedule section (create_event.php page). datetimepicker div not visible second row onwards also.please in resolving this. view page->create_event.php <?php $mainmenu ="create_event"; ?> <html lang="en"><head> <title>konnect</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="/konnect1/css/bootstrap.min.css"> <link rel="stylesheet" href="/konnect1/css/bootstrap-responsive.min.css"> <link rel="stylesheet" href="/konnect1/css/matrix-style.css"> <link rel="stylesheet" href="/konnect1/css/matrix-media.css"> <link rel="stylesheet" href="/konnect1/css/colorpicker.css"> <link rel="stylesheet" href="/konnec