Posts

Showing posts from March, 2014

database - Paralelizing a sql query with only ansi sql -

i have clustered application in-memory cache in it. during runtime load data cache database. takes time. since cache replicated want trigger load process nodes. master node runs sql. let's have simple table as; column1 column2 field1 field1 . . . if have 1000000 rows , 2 nodes, want load first 500000 first node , 500000 second node. if node size get's more number of rows divided node count. but cannot figure out how limit , partition data using ansi sql standart. have tried rownum syntax different rownum providers.

javascript - How to pass content of html with ajax (MVC) -

i need html specific form , save in html file in project. so have builder ajax function sending html server , saving it. i have problem send html server, if send string "hello word" , working "<p>hello</p>" not working. what right way send html content ajax? i know [validateinput(false)] not working this controller: [httpget] [validateinput(false)] public void updatehtml(string html) { try { string path1 = @"d:\test\my.html"; system.io.file.writealltext(path1, html); } catch (exception ex) { } } this ajax: function btn_upload_click() { var html = tinymce.activeeditor.getcontent();//my html //var html = "hello"//like working var token = $('input[name="__requestverificationtoken"]').val();//checked:ok var funcurl = $("#btn_savehtml").data(&q

Getting 403: Forbidden when consuming SOAP service using apache cxf in java -

while trying consume soap service using apache cxf 3.1.6 , java 8, changing payload content, getting either '200 ok' or '403 forbidden'. the weird part is, if print out payload , put on soapui, 200 ok. have encountered similar issue? how solve this? so not stuck days me, scratching head , thinking why on heart happening, here issue explained , solution. the issue happens because default apach cxf uses "chunking", sends small chunks of data endpoint, once defined threshold reached. results in soap messages being sent while not complete, resulting in '403' (assuming server not support 'chunking')! solution disable "chunking", changing spring-config.xml to: <http-conf:conduit name="*.http-conduit"> <http-conf:client connection="keep-alive" maxretransmits="1" allowchunking="false" /> additional info: on org.apache.cxf.trans

Python - Kivy, Have I Structured this wrong? -

Image
at moment have 1 floatlayout in sheditormain, inside class sheditormain i've declared bunch of widgets (buttons, popups, labels, etc..) , used self.add_widget add them. now want create new window opens inside/over floatlayout , can't seem works. examples i've seen far regarding multiple windows either using app main class creation of widgets inside layouts. suggestions or have restructure code? class sheditormain(floatlayout): def __init__(self, **kwargs): super(sheditormain, self).__init__(**kwargs)as self.add_widget(blabla) self.add_widget(blabla) self.add_widget(blabla) self.add_widget(blabla) self.dbconnection = dbconnection() #declare popups etc def functionevents(self, instance): yaddayadda def functionevents(self, instance): yaddayadda def functionevents(self, instance): yaddayadda class sheditor(app): def build(self): self.root = sheditormain()

scala - Error. Object apache is not a member of package org -

i'm compiling scala application , found error typed in title. scala version: scala 2.11.8 spark version: spark 1.6.1 intellij: 2016 1.3 i follow example http://spark.apache.org/docs/latest/quick-start.html , change sbt file this: name := "simple project" version := "1.0" scalaversion := "2.11.8" librarydependencies += "org.apache.spark" %% "spark-core" % "1.6.1" it possible there not compatibility between scala , spark versions? i not sure compatibility between scala , spark versions . in project using scala 2.10 , spark 1.6 . using last 1 year in production .

jsf - Adding an image before <h:link> value -

currently using h:graphicimage inside h:link , adds image after text. <h:link outcome="some outcome" value="some text"> <h:graphicimage value="image.png" /> </h:link> it produces output some text(image.png) want achieve (image.png)some text help. remove value attribute , put text directly after image : <h:link outcome="some outcome"> <h:graphicimage value="image.png" /> text </h:link>

javascript - I decided to use sashido for migration of my parse server code but getting error the module twillo not found -

how can use twillo sms service predefined module in parse while migrating parse cloud sashido in parse twillo predefined. followed link : https://www.twilio.com/blog/2012/11/get-started-with-twilio-and-parse-in-the-twilio-cloud-module.html with sashido don't have give on convenience of using twilio. here should in order use it: add twilio's noje.js module in package.json simply use require() before you can same other packages - have advanced cloud code , can use purpose.

c++ - What does cv::Mat's deallocate method do? -

the following code int main(int argc, char** argv) { cv::mat1b i1(cv::size(1, 2)); i1.at<uchar>(0, 0) = 1; i1.at<uchar>(1, 0) = 1; cv::mat1b mask(i1.size()); mask.at<uchar>(0, 0) = 1; mask.at<uchar>(1, 0) = 0; cv::mat1b masked; mask.copyto(masked, mask); masked.release(); //or .deallocate() cout << masked << endl; i1.copyto(masked, 1 - mask); cout << masked << endl; return 0; } behaves differently when masked.release() replaced masked.deallocate() . in latter case seems matrix masked not modified @ , output masked sum of masked , invert masked matrices, equal original im1 matrix. deallocate() member method do? use opencv 3.1. deallocate() deallocate data directly form cv::mat . however, release() decrease ref_count of cv::mat , if hits 0, call deallcoate itself. summary: use release until know doing. be aware not need invoke of them. release invoked during destructor of cv::ma

javascript - SweetAlert2 add dynamic options to select input -

i want add dynamic options sweetalert2 input type select looks this: swal({ title: 'select ukraine', input: 'select', inputoptions: { 'srb': 'serbia', 'ukr': 'ukraine', 'hrv': 'croatia' }, inputplaceholder: 'select country', showcancelbutton: true, inputvalidator: function(value) { return new promise(function(resolve, reject) { if (value === 'ukr') { resolve(); } else { reject('you need select ukraine :)'); } }); } }).then(function(result) { swal({ type: 'success', html: 'you selected: ' + result }); }) instead of 3 countries want add own options saved in object. how can using javascript? you possibly try building options object this. function linkthing() { //this assume loaded via ajax or something? var myarrayofthings = [ { id: 1, name: 'item 1' }, { id: 2, name: 'i

Setup ASP.NET MVC 4 or 5 project with Angular 2 -

i learning angular 2 typescript. i using following resource. quickstart angular 2 now there , other examples found telling create package.json file lists dependencies project. i think creating package.json file , listing dependency packages kind of structure followed in .netcore project. in mvc 4 or 5 have packages.config file lists although packages going use. i not saying can not use package.json file when have package.config file. but there simple way integrate angular 2 typescript in mvc webapplication project using nuget packages , started? if not available please let me know how can setup angular 2 type script in asp.net mvc 4 or 5? as said, in asp.net mvc application have package.config file. file holds information nuget packages you've installed in app. file related server-side packages. package.json file related front-end part of app. holds list of packages you've installed in app. time npm packages. holds information app , more. can rea

android - cannot evaluate module 'react-native-maps' : Configuration with name 'default' not found -

a problem occured while building application 'react-native-maps' here setting.gradle file include ':react-native-maps' project(':react-native-maps').projectdir = new file(rootproject.projectdir, '../node_modules/react-native-maps/android') dependencies of android/app/build.gradle file dependencies { compile project(':react-native-maps') compile filetree(dir: "libs", include: ["*.jar"]) compile "com.android.support:appcompat-v7:23.0.1" compile "com.facebook.react:react-native:+" // node_modules compile 'com.airbnb.android:react-native-maps:0.6.0' } here mainactivity.java file updated mapspackage() protected list<reactpackage> getpackages() { return arrays.<reactpackage>aslist( new mainreactpackage(), new mapspackage() ); } error coming: js server running. building , installing app on device (cd android &a

javascript - Redux state changes but shouldn't -

i have problem. have simple grid , grid gets data redux state. when sort, noticed data changes in state, shouldn't or missunderstood redux @ point. here bit of code reducer: const gridoptions = { columns: ["id", "name", "lastname"], data: [ {id: 1, name: "test", lastname: "test2"}, {id: 2, name: "test1", lastname: "test3"} ], sortby: {}, filter: {} } const rootreducer = combinereducers({ data: function (state = gridoptions.data, action) { return [...state]; }, selectedrow: function (state = {}, action) { switch (action.type) { case "row_selected": return action.data default: return state } }, sortby: function (state = gridoptions.sortby, action) { switch (action.type) { case "sort_change": return object.assign({}, action.column); default: return state; } }, columns: function (state = gridoptions.columns, action) { return state; }, filter:

ios - `CountedSet` initialization issue -

i'm comparing characters contained within 2 words. in seeking accomplish this, set (aka nsset ) seemed way go accomplish task. i've discovered returns false positives on matches, attempting use countedset (aka nscountedset ) instead. i'm able initialize set without issue, can't countedset initializer work. here's i've done... i start string : // let's mytextfield.text = "test" let textfieldcharacters = mytextfield.text?.characters // word string enable list of words let wordcharacters = word.characters then dump characters array : var wordcharactersarray = [character]() character in wordcharacters { wordcharacterarray.append(character) } var textfieldcharactersarray = [character]() character in textfieldcharacters { wordcharacterarray.append(character) } then create set character arrays: let textfieldset = set<character>(textfieldcharactersarray) let wordset = set<character>(wordcharactersarray) fi

r - customize shiny checkboxinput font using css, error unused argument (style = " -

i trying change font size , color of checkboxinput using inline css. library(shiny) shinyui( navbarpage("first app", tabpanel("a", sidebarlayout(sidebarpanel(h5("sidebar") ), mainpanel(checkboxinput("add", "add" , style = "font-weight: 500; color: #4d3a7d;" )) )), tabpanel("b") ) ) but error unused argument (style = "font-weight: 500; color: #4d3a7d;") how can fix this? you should try : library(shiny) shinyui( navbarpage("first app", tabpanel("a", sidebarlayout(sidebarpanel(h5("sidebar") ), mainpanel(checkboxinput("add", "add" , style = "font-weight: 500; color: #4d3a7d;" )) )), tabpanel("b"), tags$head(tags$style("#add{color: #4d3a7d;

Ant Zip - Exclude all files but not two specific files -

i have directory (c:\source) contains (demo1, demo2, demo3) directories , files (xyz.bat, abc.bat, 123.bat, save.exe, save.jar, copy.exe, copy.jar). i want have following in zip. demo1 demo3 xyz.bat save.exe save.jar i want exclude *.jar, *.exe, *.jar need add above mentioned files. please help.

php - SQL OR functioning like AND -

this relevant line of code: $woquery = $dbc->prepare("select * workorder statusid <> 15 or statusid <> 12 order datein asc"); the problem having code, or function seems working , function. if change (for example): statusid <> 15 or statusid <> 15 then correctly excludes records 15 statusid, same if set 12 if have single function no or, filters correctly. however, when have both, filters neither 12 or 15. use not in 2 or operations $woquery = $dbc->prepare("select * workorder statusid not in( 15, 12) order datein asc"

.net - Regex: not arbitrary non capturing group -

i'm trying write regex cover cases. have parse xml , capture properties. example: <item p2="2"/> <item p1="1" p2="2"/> <item p1="1" p2="2" p3="3"/> <item p1="1" p2="2" p3="3" p4="4"/> <item p1="1" p2="2" p3="3" p4="4" p5="5"/> i have capture value of "p2" property , know "p2" present in line. want capture value of "p4" property not present. at first i'm trying satisfy first 4 cases(first 4 lines in example) , wrote regular expression this: \<item.+?p2=\"(?<val1>\d+)".*?(?:p4=\"(?<val2>\d+)\")?\/\> and works fine. "val1" group returns value. , "val2" group returns value if "p4" property presented. but cover last case: <item p1="1" p2="2" p3="3" p4="4&

Abbreviated form of Java getter/setter field methods -

im curious if there exists abbreviation form getter/setter methods of objects simpleobject osimple = new simpleobject(); osimple.setcountervalue(osimple.getcountervalue() + 1); like 1 simple datatypes int counter = 0; counter += 2; info the getter/setter methods required. addition if there isn't language feature thats support idea, convenient way deal in context of , clean code? as geert3 said there no shortcut setters/getters in java without accessing property directly. in case simpleobject -class should have method increasecounter() , maybe increasecounterby(int add) (or add(int a) ).

c# - Why is the last part of this url not empty with ASP.NET webforms? -

why last part of url not empty? when visit website, default.aspx automaticly loads doesn't appear in url. use url highlight menu on website, doesn't work when first visit website. this code how make menu-items: string url = httpcontext.current.request.url.tostring(); // last part of url string path = url.split('/').last(); if (path == menupath || ((path == "default.aspx" && i==0) || (path == "" && i==0 ))) panel.controls.add(new literalcontrol("<a class='active' href='/" + menupath + "'>")); else panel.controls.add(new literalcontrol("<a href='/" + menupath + "'>")); you think if url is: http://example.com/ path variable "" , should give class active right? right doesn't work , have no idea why. make sure url lowercase if have issue! credits of suggestion go ron c the problem httpcontext.current.request.url.absolut

Facebook API Unsupported Operation for v2.3 but Valid for v2.6 -

i have been using fb graph api using v2.3. write access token in input field. example api call is https://graph.facebook.com/v2.3/461151203975788/insights it returning { "error": { "message": "unsupported operation", "type": "oauthexception", "code": 100, "fbtrace_id": "b5syg3ovxbj" } } however, when use v2.6, returns me of insights data expected. 100% sure access token correct. happening different pages have access to. has been working few days ago, seems happening right after started testing v2.6. i suspect somehow , v2.3 usage has been blocked after using v2.6, if facebook forcing me use newest api version.

Abort Jenkins pipeline (workflow) build after timeout -

whenever build gets stuck of fails somewhere timeout kicks in build not aborted , stuck running forever until cancel build, go console , press link click here forcibly terminate running steps here sample code i'm trying not working: stage concurrency: 1, name: 'build' def buildsteps = [:] buildsteps['server'] = { timeout(1) { node('build') { timestamps { bat "waitfor nothing /t 120 >nul" } } } } parallel buildsteps this log [pipeline] stage (build) entering stage build proceeding [pipeline] parallel [pipeline] [server] { (branch: server) [pipeline] [server] timeout [pipeline] [server] { [pipeline] [server] node [server] running on ci106 in c:\jws\workspace\jftimeout [pipeline] [server] { [pipeline] [server] timestamps [pipeline] [server] { [pipeline] [server] bat 14:42:52 [server] [jftimeout] running batch script 14:42:53 [server] 14:42:53 [serv

excel vba - Optimising For...Next loops in Select Case -

i have 3 different case s in bit of code, each of has minor variations on routine revolving around for...next loop. question is, there difference in efficiency , speed depending on how nest them? in other words, is: select case sposition case = "first" j = 17 65 [do stuff] next j case = "middle" j = 17 65 [do stuff] next j case = "last" j = 17 65 [do stuff] next j end select ...any more or less efficient than: for j = 17 65 select case sposition case = "first" [do stuff] case = "middle" [do stuff] case = "last" [do stuff] end select next j more of question codereview so, regardless, dependent on intending loops. in first situation, have condition , loop through data in accordance result of condition, doing same thing data. in second case, re-

SQL Server 2016 timestamp data type -

i have following problem: i using archiving software exports data ms sql database, 1 of columns being designated timestamp_s (which represents unix time), , 32 bit integer. this database needs queried different reporting software. problem reporting software requires entries have field named "timestamp" , data type sql timestamp. i trying select data archiving software sending , format reporting software can use it. seeing cannot convert data type timestamp, know work-around problem? any appreciated!

function - C: Variable is uninitialized for linked list -

i'm relatively new c , creating program involves linked-list. here abbreviated version of code that's giving me trouble. #include <string.h> #include <stdio.h> #include <stdlib.h> #define strlen 100 struct gene { int num[4]; struct gene *next; }; typedef struct gene item; void build_list(item *current, item *head, file *in); int main() { file *input; file *output; input = fopen("test.data", "r"); output = fopen("test.out", "w+"); item *curr; item *head; head = null; int i; build_list(curr, head, input); curr = head; while(curr) { (i = 0; < 4; ++i) fprintf(output, "%d\n", curr->num[i]); curr = curr->next; } fclose(input); fclose(output); free(curr); } void build_list(item *current, item *head, file *in) { char gene[strlen]; char *tok; char gene_name[strlen]; char *se

angularjs - Angular JS issue when implementing another angular lightbox plug in -

angular.module('birdsapp.controllers', ['bootstraplightbox']); angular.module('birdsapp.controllers', []). controller("birdsscontroller", ['$scope','$http', function($scope, $http, lightbox) { $scope.namefilter = null; $scope.searchfilter = function (writer) { var keyword = new regexp($scope.namefilter, 'i'); return !$scope.namefilter || keyword.test(birdfinder[1]); }; $http.get('app/demo2.txt?callback=json_callback').success (function(data,index){ $scope.birdfinderlist = data.aadata; console.log(index); console.log(data.aadata[1].list[1].bird_img); //$scope.birdfinderlist2 = data.aadata.list; //console.log(data.aadata[1].list.bird_englishname); $scope.openlightboxmodal = function (index) { //lightbox.openmodal($scope.images, index); console.log(data.aadata[1].list[1].bird_img); lightbox.openmodal(data.aadata[1].list[1].bi

php - I want to develop an application for making vAnimated videos how to proceed? -

i have done research on internet ffmpeg provides solution this. can suggest me in technology should go desktop based application or web based application fine. if there other gif image generators available. thanks. i suggest go web based application instead of desktop based application. web appplication can accessed anywhere , device mobile or pc or tab. desktop application on other hand dependent machine. go 1 serves business purpose well. for generating images can use php's image library. check below link : http://www.jeroenvanwissen.nl/weblog/php/howto-generate-animated-gif-with-php enter link description here

android - I want to use camera on background service using mobile vision -

i make android app project. application's purpose detection blinking of eye. i use mobile vision api. using sample code face detection of mobile vision blink detection code. my first question mobile vision api can working on background service? my second question combine camera api mobile-vision api? camera api can work on background service can't use mobile-vision face detection class.. please, me.. my app's service code public class serviceclass extends service{ private static final string tag = "facetracker"; public camerasource mcamerasource = null; public camerasourcepreview mpreview; private graphicoverlay mgraphicoverlay; private static final int rc_handle_gms = 9001; // permission request codes need < 256 private static final int rc_handle_camera_perm = 2; static int x=0; //camera variables //a surface holder private surfaceholder sholder; //a variable control camera private camera mcamera; //the camera parameters private camer

javascript - Mapbox Geolocation, how to load into map? -

i have being playing around mapbox , having issues getting geolocation api send data map , update it. this got right now: mapboxgl.accesstoken = 'token-here'; var map = new mapboxgl.map({ container: 'map', // container id style: 'mapbox://styles/mapbox/streets-v9', center: [-0.968539, 54.562917], zoom: 9 }); map.on('style.load', function() { map.addsource("mymap", { "type": "geojson", "data": "https://api.mapbox.com/geocoding/v5/mapbox.places/uk_address_here.json?country=gb&types=address&autocomplete=true&access_token=toekn" }); map.addlayer({ 'id': 'test1', 'type': 'line', 'source': 'mymap', 'interactive': true }); }); the answer may lie how encoding uk_address_here . https://api

Circular dependency angularjs -

can tell me circular dependency in following code? var homeapp = angular.module("homeapp",['nganimate', 'ui.bootstrap']); 'use strict'; homeapp.factory('admindashboardservice', ['$http', '$q', function($http, $q){ return { 'response': function(response) { // on success console.log("yes command comes here"); return response; }, getallholidays: function(monthyeararrayforholidaylist) { console.log("for full list of holidays list length: "+monthyeararrayforholidaylist.length); var ismonthly="no"; return $http.get('/tasktrac/holiday/getholiday/ismonthly/'+ismonthly+'/'+monthyeararrayforholidaylist) .then( function(response){ return response.data; },

division - Python 2.7 - Continued Fraction Expansion - Understanding the error -

this question has answer here: is floating point math broken? 20 answers i've written code calculate continued fraction expansion of rational number n using euclidean algorithm: from __future__ import division def contfract(n): while true: yield n//1 f = n - (n//1) if f == 0: break n = 1/f if n 3.245 function never ending apparently f never equals 0. first 10 terms of expansion are: [3.0, 4.0, 12.0, 3.0, 1.0, 247777268231.0, 4.0, 1.0, 2.0, 1.0] which error since actual expansion only: [3;4,12,3,1] or [3;4,12,4] what's causing problem here? sort of rounding error? the issue you're testing f == 0 (integer 0) never true floats. loop goes on forever. instead, check precision of equivalent 0 ( which can wrong sometimes ): >>> __future__ import division >>> >

django - Unabe to get token from DRF get-token api -

my custom signup api from rest_framework import viewsets rest_framework import serializers class signupserializer(serializers.serializer): email = serializers.emailfield(required=true) password = serializers.charfield(required=true, write_only=true) def validate_email(self, val): try: user.objects.get(username=val) raise serializers.validationerror("email-id exist") except user.doesnotexist: return val class signupview(viewsets.modelviewset): serializer_class = signupserializer def create(self, request, *args, **kwargs): serializer = self.get_serializer(data=request.data) serializer.is_valid(raise_exception=true) data = serializer.data email = data.get('email') password = data.get('password') u = user(email=email, username=email) u.set_password(password) u.save() data = { 'message': &#

css - Using iTextSharp to export to PDF and repeat headers -

i have gone through quite few posts , tried suggested, header not being repeated on page webgrid flows on to. here code : public filestreamresult exportcombinedpdf(int projectid) { list<pipelinedetails> pipelist = new list<pipelinedetails>(); projectmanager pm = new projectmanager(); pipelist = pm.getpipelinelist(projectid); //this css styling webgrid string webgridstyle = pm.pipeline_htmlforexport(projectid); //this creating table other details being exported string projecthtml = pm.project_htmlforexport(projectid); webgrid grid = new webgrid(source: pipelist, canpage: false, cansort: false); string gridhtml = grid.gethtml(tablestyle: "webgrid", headerstyle: "webgridheader", alternatingrowstyle: "webgridalt", columns: grid.columns( grid.column("

api - Getting Unauthorized error when trying to execute the RestSharp request that retrieves data from ArangoDB -

if send http request through postman works , result. same not working , getting unauthorized when execute through restsharp. below code snippet: var client = new restclient( "http://username:password@localhost:port/_db/databasename/_api/simple/all"); var request = new restrequest(method.put); request.addheader("content-type", "application/json"); request.addparameter("application/json", "{\n \"collection\":\"collectionname\"\n}", parametertype.requestbody); irestresponse response = client.execute(request); return response; according the restsharp wiki cannot specify authentication parameters via url: var client = new restclient("http://example.com"); client.authenticator = new simpleauthenticator("username", "foo", "password", "bar"); var request = new restrequest("resource", method.get); client.execute(request); in general

Resetting Master password in Android Studio -

i sure dumb question, cannot find answer anywhere. have resetted master password. key , keystore passwords still remembered, when try build apk, error: "failed read key store (jks file). keystore tampered with, or password incorrect". need build project again? did check following link . happen because choosing directory , not keystore file.

javascript - Get an element of an array only once -

i have array 4 colors. ex: var c1 = getcolor(); var c2 = getcolor(); var c3 = getcolor(); var c4 = getcolor(); function geracolor() { var colors = ['#3498db', '#8e44ad', '#e67e22', '#1abc9c']; //return each value once } i have list of teachers, each teacher has sublist disciplines. this: professor , disciplines each time click on professor, everytime click on professor's name, add disciplines inside calendar (alreay done). what need is: need generate unique color (random or not) each professor click/expand. obs: have limit of 4 professors, need generate 4 colors. obs2: everytime click again on professor, closing disciplines. need make color using avaliable again. afa understood question, maybe want achieve : var colors = ["red", "green", "yellow", "orange", "blue", "pink"]; var defaultcolor = "black"; function getrndcolor() {

c - Placing an integer unto a two dimension array (matrix) -

ok, guys i'm trying make program in guess inputted number placed randomly unto matrix or 2 dimensional array. example user inputted '3' , integer placed on random row , column of matrix. #include<stdio.h> #include<conio.h> #include<stdlib.h> #define r 4 #define c 4 void display(char a[][c]); void placing(char b[][c]); void guess(int m, int n); void main(){ int x=0,y=0,m,n,number; int matrix[r][c]; char a[r][c]={{'x','x','x','x'},{'x','x','x','x'},{'x','x','x','x'},{'x','x','x','x'}}; printf("\t\t\t welcome game"); printf("\nenter number: "); scanf("%d",&number); display(a); placing(a); printf("\n\nyour number being placed @ random location"); printf("\n\nguess number located (row) (column)"); printf("\n\nenter coordinates: "); scanf("%d%d",&

objective c - Equality comparison result unused in iOS 9 -

i moved ios 9 , noticed new warnings on old code: description.becomefirstresponder == yes; display warning 'equality comparison result unused' how can handle warning. thank you! you meant assign, in: description.becomefirstresponder = yes; ^ ( == equality comparison operator). the compiler complaining result of comparison wasn't being used, in: if (description.becomefirstresponder == yes) { /* */ }

python 3.x - Getting a single merged histogram for two different variable but want two different plot -

Image
python code plotting histogram seaborn.distplot(sub2["s2aq16a"].dropna(), kde=false); plt.xlabel('age') plt.title('age when started drinking') seaborn.distplot(sub2["sibno"].dropna(), kde=false); plt.xlabel('no. of siblings') plt.title('no. of siblings alcoholic') i expected output 2 histogram individual variables.but got histogram both variable merged in one. here screenshot of output. if run code 1 one plotting histogram single variable while leaving code plotting histogram of other variable comment, correct output. you plotting both histograms on same axes. if want them separate, plot them on different axes. here's 1 way of doing it. fig, axes = plt.subplots(2, 1) seaborn.distplot(sub2["s2aq16a"].dropna(), kde=false, ax=axes[0]); axes[0].set_xlabel('age') axes[0].set_title('age when started drinking') seaborn.distplot(sub2["sibno"].dropna(), kde=false, ax=axes[1]

c - What is with the null character in reverse string program? -

i had make simple program reverse string. got code own understanding google since couldn't work. runs fine , outputs should , understand of except reverse[j] = '\0' statement. kept getting symbols in output when didn't state want know how works. can explain please? #include<stdio.h> int main(void) { char original[20], reverse[20]; int length, i, j; printf("enter string:\n"); gets(original); length = strlen(original); (i = length - 1, j= 0; >= 0; i--, j++) reverse[j] = original[i]; reverse[j] = '\0'; //i don't know statement printf("the string reversed is:\n %s\n", reverse); return 0; } if want character array contain string has have terminating zero. for example function strlen used in program counts characters in character array before terminating zero. also function printf used format specifier %s outputs characters character array until terminating 0

neo4j - Graph Database Object Relationship Diagram Tool -

Image
i used use tool translate text file diagram this but don't remember name of tool - can remind me? as input take text file defined objects , relationships , export out image file 1 above. note not auto-generated existing database text file has object , relationship definitions. you're referring graphviz . tool used pretty extensively within neo4j ecosystem.

cross platform - Hybrid Mobile Application - Compare with the different aspects -

hybrid mobile application development tools best application deliver clients: which product/platform cross-platform? which product/platform provides native capability? what product/platform provides best alm(application lifecycle management)? what product/platform has compatibility emm/mdm’s (enterprise mobile management/mobile device management)? what product/platform provides best roi(return on investment)?

css animations - Page transitions in Angular 2 -

since angular 2 animations not yet totally updated, there way animate page css? i tried adding host in component wasnt helpfull. for example component: @component({ selector: 'pos-projects-list', pipes: [asyncpipe, searchpipe], directives: [rippledirective], templateurl: 'app/dashboard/pages/projects/templates/list.html', host: {'class' : 'ng-animate'} }) so doing here adding class pos-projects-list can see in screenshot. screenshot the regular css animation work fine: http://www.w3schools.com/css/css3_animations.asp https://developer.mozilla.org/en-us/docs/web/css/css_animations/using_css_animations update : actual question "how change class of host element?" here example: @component({ selector: 'pos-projects-list', host: {'[class.ng-animate]':'somefield'} }) export class posprojectlistcomponent implement afterviewinit { somefield: bool = false; // alternat

Scala Array Slicing with Tuple -

i try slice 1d array[double] using slice method. i've written method returns start , end index tuple (int,int) . def getslicerange(): (int,int) = { val start = ... val end = ... return (start,end) } how can use return value of getslicerange directly? i tried: myarray.slice.tupled(getslicerange()) but gives compile-error: error:(162, 13) missing arguments method slice in trait indexedseqoptimized; follow method `_' if want treat partially applied function myarray.slice.tupled(getslicerange()) i think problem implicit conversion array arrayops (which gets slice gentraversablelike ). val doublearray = array(1d, 2, 3, 4) (doublearray.slice(_, _)).tupled function.tupled[int, int, array[double]](doublearray.slice) (doublearray.slice: (int, int) => array[double]).tupled

python - LDA gensim. How to update a Postgres database with the correct topic number for every document? -

i taking different documents database , check lda (gensim), kind of latent topics there in these documents. works pretty well. save in database every document probable topic. , not sure best solution it. could, example, @ beginning extract unique id of every document database text_column , somehow process know @ end id belongs topic number. or may should in last part, print documents , topics. don't know how connect database. comparison of text_column document , assigning corresponding topic number? grateful comment. stop = stopwords.words('english') sql = """select text_column table nullif(text_column, '') not null;""" cur.execute(sql) dbrows = cur.fetchall() conn.commit() documents = [] in dbrows: documents = documents + list(i) # remove words stoplist , tokenize stoplist = stopwords.words('english') additional_list = set("``;''".split(";")) texts = [[word.lower() word in document

Replcae inner space in Python -

iam new python, , need remove space between string , digit not between 2 strings. eg: input : paragraph 25 in documents , paragraph number in file. output : paragraph25 in documents , paragraph number in file. how can done in python ? tried regex re.sub("paragraph\s[a-z]", "paragraph[a-z]", input) but not working. >>> re.sub(r'\s+(\d+)', r'\1', 'program 25 fun') 'program25 fun' that might work in pinch. i'm not familiar regexes, can chime in more robust. basically match on whitespace succeeded numbers , remove it.

node.js - Atom node debugger as good as the one at visual studio code -

i know there similar question here ( debugging nodejs atom ide ) not i'm asking. i'm using atom node programming , visual studio code debugging. uncomfortable , inefficient. reason? node debugger of visual studio code amazing, useful , easy use. wondering if equivalent atom. tried node-debugger , poor alternative visual studio code. there package node debugging in atom? if not, suggest editor has best of both, vsc , atom? things keeping me away visual studio code totally useless fixed left bar, lack of symbols explorer , visual branch manager (maybe minimap).

Apple's Swift Sprite Kit: linearDamping, how is this property used mathematically? -

i'm working on game engine in java. while using sprite kit swift , property lineardamping used in skphysicsbody slowing down skphysicsbody. question is, how used mathematically reduce velocity? have velocity game engine, gradually slow down moving object, need know how lineardamping property used doing so. thoughts or knowledge great, thanks. the formula box2d velocity *= 1.0f / (1.0f + time * lineardamping);

c# - Entity framework self referencing key not writing to database -

i have entity framework code first object self referencing key. child records don't have parent id in self referencing key when data written database. public class contract { public contract() { contracts = new list<contract>(); } public int id { get; set; } public list<contract> contracts { get; set; } } the object has many more properties above i've simplified sake of example. not many many relationship. each contract has 1 parent, apart master contracts have no parents. when add sub contract list of contracts , call savechanges on dbcontext, contract , sub contract written database fields correct. apart entity framework generated field contract_id null. i've got similar self referencing keys working correctly other classes, in fact contract has these classes properties. these other classes work expected, self referencing keys indicating parent object populated correctly. i've created simple test class same