Posts

Showing posts from March, 2010

Is it possible to have a custom url for a docker container? -

i have following dockerfile , wondering need in order access host machine visiting myapp.dev : from ubuntu:16.04 user root run apt-get update && apt-get -y upgrade && apt-get install apt-utils -y && debian_frontend=noninteractive apt-get -y install \ apache2 php7.0 php7.0-mysql libapache2-mod-php7.0 curl lynx-cur git expose 80 add www /var/www/site run echo "servername localhost" >> /etc/apache2/apache2.conf cmd /usr/sbin/apache2ctl -d foreground expose 80 i using following command run container: docker run -d -p 8080:80 if want able resolve locally add alias localhost in hosts file. locate hosts file. linux: /etc/hosts macos: /private/etc/hosts windows: c:\windows\system32\drivers\etc\hosts add line @ end of file: 127.0.0.1 myapp.dev now can access container using myapp.dev:8080 .

Symfony 2.8 session lost after login_check redirect -

i porting old custom framework symfony-based custom framework using symfony's components. far going smoothly, except login part. here few details project: i'm using symfony security component v2.8 my sessions being stored in database using pdosessionhandler i'm using guard authenticate users. the problem arises when user tries login admin area using form. after form submission, user forwarded login_check route credentials checked. user role role_admin set , user redirected secure page, gets redirected automatically login. order of events so: login -> login_check -> admin -> login i have done debugging setting breakpoints in contextlistener::onkernelresponse , found out token never saved in session,because method returns here: if (!$event->getrequest()->hassession()) { return; } also, able see session being added database table , session id remains constant throughout redirect. in end bounced login page , user set .anon somewhere be

How to display two differents models in my view with will_paginate in rails? -

hi have question , looking on google don't find answer. i'm want display post model , user model search in same page , want use will_paginate display of them . i try solution => **require 'will_paginate/array' @posts =post.search(params[:q]).order("created_at desc") @users=user.search(params[:q]).order("created_at desc") @all_records = (@posts + @users).paginate(:page =>params[:page], :per_page => 10)** and in view want display query found ,so try => **<%unless @posts.nil?%> <% @posts.each |post| %> .... ** **<% unless @users.nil?%> <% @users.each |user| %> ...** <%= will_paginate @all_records %> but doesn't work nothing happend, want know how @posts , @users records in @all_records => ** <% @all_records[@posts].each do.. %> <% @all_records[@usets].each ..%> ** saw solutions suggest use 2 differentes paginate in view => **<%= will_paginate @posts %>

vagrant - Authentication failure. Retrying... in Vagrantfile while using a custom created box -

i use following command package vm, vagrant package --base vmid —-output builder.box my vagrantfile looks follows, box = "centos/7" prefix_ip_addr = "174.10.10." vagrant.configure("2") |config| config.vm.box = box builder_ip = "%s100" % [prefix_ip_addr] config.ssh.forward_agent = true config.ssh.insert_key = false config.vm.define :builder |builder| # setup builder vm , ip builder.vm.hostname = "builder" builder.vm.network :private_network, ip: builder_ip # setup builder vm system requirements builder.vm.provider "virtualbox" |v| v.memory = 1024 * 16 v.cpus = 8 v.customize ["modifyvm", :id, "--natdnshostresolver1","on"] v.customize ["modifyvm", :id, "--natdnsproxy1", "on"] end end end then use created box machine, vagrantfile look

passport.js - Passport-azure-ad passport plug-in refresh the token -

i'm working on outlook add-in using ms graph api. in add-in, i'm using azuread-openidconnect passport plug-in authenticate users using oidc strategy on azure-ad v2 endpoint. i'm running typical issue access token expired, , need use refresh token date access token. docks ( https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols-oauth-code ) can check , refresh token manually. however, assume functionality has been baked passport plug-in. if how go checking , refreshing token plug-in? there's no method in passport-azure-ad that. passport's role authorize initial access token, can used access apis (including refresh token api) @ provider. so may need refresh these tokens yourself, or using separate library passport-oauth2-refresh .

ios - Presenting an alert from a view controller that has closed -

i have objectve c ios application in attempting show uialertcontroller, uiviewcontroller in process of closing. have tried adding common workaround in appdelegate : - (uiviewcontroller *)currenttopviewcontroller { uiviewcontroller *topvc = [[[[uiapplication sharedapplication] delegate] window] rootviewcontroller]; while (topvc.presentedviewcontroller) { topvc = topvc.presentedviewcontroller; } return topvc; } called with: [appdelegate.currenttopviewcontroller presentviewcontroller:alert animated:yes completion:nil]; however error still appearing: warning: attempt present uialertcontroller on myviewcontroller view not in window hierarchy! can advise? if want display alert upon closing viewcontroller, can implement dismiss completion block , display there. example: [self dismissviewcontrolleranimated:yes completion:^(void) { // uialertcontroller code here }];

web services - PHP Socket Connection to an API -

i'm trying connect api using php sockets. i've tried in many ways, can't working. know there other answers, no 1 works. can't achieve it. i'm trying @ least 2 days. here error: php_network_getaddresses: getaddrinfo failed: name or service not known code (sockets - not work): var $url = 'api.site.com.br/'; public function getusers(){ $path = "users/?accesstoken=c24f506fe265488435858925096bc4ad7ba0"; $packet= "get {$path} http/1.1\r\n"; $packet .= "host: {$url}\r\n"; $packet .= "connection: close\r\n"; if (!($socket = fsockopen($this->url,80,$err_no,$err_str))){ die( "\n connection failed. $err_no - $err_str \n"); } fwrite($socket, $packet); return stream_get_contents($socket); } code (curl - works!): public function getusers2(){ $path = "users/?accesstoken=c24f506fe265488435858925096bc4ad7ba0"; $method = 'get'; $c

floating point - How to format a long variable to use commas in python -

hi format variable volume before printed below, cant seem find tut helps correctly. def volume_sphere(radius): """radius = 12,742 / 2 (earth diameter)""" pi = 3.141592653589 volume = ( 4 / 3 ) * pi * radius ** 3 format('{:20,.2f}'.format(volume)) # volume format 0,000,000,000,000,000,000 print ("calculate volume of sphere (the earth) \nvolume = ( 4 / 3 ) * pi * radius ** 3") print ("radius = ", radius, "kms") print ("the volume of earth = ", volume, "kms3\n\n") volume_sphere(6371) this fixed formatting. print ("the volume of earth = ", '{:20,.2f}'.format(volume), "kms3\n\n") enjoy!!!

Apple Mach-O Linker Error on Xcode 8 when using CocoaPods and Git -

i've had happen me twice in last few months. solution obvious , easy, took me while remember since current s.o. questions , solutions found on error didn't work. hopefully, title others target specific situation have. @ least, remind me when error occurs again! if added new library (via cocoapods or manually), , switched branch not have it, following error: error #1: apple mach-o linker error: linker command failed exit code ... linker command failed exit code 1 (use -v see invocation) what happening i never git commit installed cocoapods; podfile. so, when change branches installed pods dir out of sync podfile. the solution simple re-run pod install or bundle exec pod install command. clean project, , run again. update lesson no. 2 : sometimes may forget removed framework file or did not check in. cause linker flag problem when cloning else or checking out new branch. check frameworks folder red text clue. most importantly, right click

java - How manage two assertion at the same time -

i wondering how part of policy should interpreted. first of all, part of policy valid? happens if send token10, work? token11? i'm asking because if use policy apache cxf 2.7.x or 3.x "invalid policy exception" if use cxf 2.x.xxx.redhat-1 seems working, doubt if normal, or red hat libraries goes against standard. <wsp:policy xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" wsu:id="securityservicesignthenencryptpolicy"> <wsp:exactlyone> <wsp:all> <sp:asymmetricbinding> <wsp:policy> <sp:initiatortoken> <wsp:policy> <sp:x509token sp:includetoken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/includetoken/alwaystorecipient&q

reactjs - How can I detect when video finished playing react? -

since react uses lifecycle methods , virtual dom how can detect when video has finished playing. found question on stackoverflow suggested use componentwillunmount there's no point @ remove video dom, componentwillunmount won't fired... how can detect when video finished playing react? use ref callback obtain reference <video dom element when mounts. <video ref={el => this.videoelement = el}></video> combine componentdidmount() add event listener video element. ended event you're looking for. the ended event fired when playback or streaming has stopped because end of media reached or because no further data available. componentdidmount() { this.videoelement.addeventlistener("ended", mycallback); }

How to pass rgb color values to python's matplotlib eventplot? -

Image
i'm trying plot tick marks specific color using matplotlib's eventplot. i'm running python 3 in jupyter notebook %matplotlib inline. here's example code: import numpy np import matplotlib.pyplot plt spikes = 100*np.random.random(100) plt.eventplot(spikes, orientation='horizontal', linelengths=0.9, color=[0.3,0.3,0.5]) it outputs following error: valueerror: colors , positions unequal sized sequences the error occurs presumably because not providing list of colors of same length data (but wan't them same color!). gives error when use color string 'crimson' or 'orchid'. works when use simple one-letter string 'r'. am restricted using extremely limited set of one-letter color strings 'r','b','g','k','m','y', etc... or making long color list when using eventplot? according docs : you can pass (r, g, b) or (r, g, b, a) tuple, each of r, g, b , in range [0,1

php - Can't get result from $this->db->last_query(); codeigniter -

quite simple thing ask , must discussed many times, still not able result of $this->db->last_query();. $this->db->select('count(*) totalverified,res_sales.upduser, employee.name'); $this->db->from('res_sales'); $this->db->join('employee','employee.user_id = res_sales.upduser'); $this->db->where('date>=', $fromdate); $this->db->where('date<=', $todate); $this->db->where('verificationnumber<>', ''); $this->db->where('verificationnumber<>', null); $this->db->group_by('res_sales.upduser'); $this->db->group_by('employee.name'); $q = $this->db->get(); $str = $this->db->last_query(); print_r($str); if ($q->num_rows() > 0) { return $q->row(); } return false;

iphone - How to apply an user interface orientation to an iOS storyboard scene -

i developing ios application allows play 1 of 2 different games. both games played in set of rounds. when player finishes round application transitions new scene displays results , either transitions round scene or end game scene. because of transient nature of scenes in application, makes little sense persist scenes done in more traditional applications, can return previous scene. to end, scene navigation accomplished using uinavigationviewcontroller , calling setviewcontrollers(animated:) supplying array contains uiviewcontroller next scene, , works quite well. i mentioned application allow play 1 of 2 games. turns out that, on iphone, 1 game best played in portrait mode, , other game works best played in landscape mode. want able control user interface orientation used particular uiviewcontroller when becomes active. i have experimented using supportedinterfaceorientations property of uinavigationcontroller , application(_ application: supportedinterfaceorientat

javascript - Find instance of a pattern in SQLITE that excludes another pattern -

i have database following schema: id vendor 1 ab "vendor":"0089900" acx 2 cd "vendor":"0089900" "vendor":"0089700" xca 3 cd "vendor":"0012300" sda 4 ad "vendor":"0089900" sd "vendor":"0089901" fdfd 5 adc "vendor":"0089900" "vendor":"0012345" dasd the "vendor" column contains strings various amount of key value pairs. json response contained within string. my constraints must use sqlite queries generate results following conditions: if there occurrences of vendors pattern of "vendor":"xx899xx" , pattern "vendor":"xxxxxxx" iterations, return row. in above example, valid rows returned

android - Get element by id and order -

android newbie here, i have application displays list of items. each item looks this. <framelayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/apptheme.framelayout" android:id="@+id/job_list_item_main_frame"> <!-- cut inside code example --> </framelayout> there's 10-100 of these on screen @ once. need first element's height separate process. how can select element? edit: first item in list need retrieve. but, if there way select each item(with id job_list_item_main_frame) individually , it's position, ideal. edit 2: i'm making tutorial walk through. there's overlay arrow points image. however, image position changes 20dp depending on list item's height. need make adjustments arrow based upon list item. it's in recycler view . let me check real quick adapter it's using. in adapter have method onbindviewholder(viewholder, position); in met

node.js - GRPC client with multiple endpoints -

i writing node.js grpc client service exposes 2 endpoints, ex: localhost:50051, localhost:50052 . want able retry on localhost:50052 if request fails on localhost:50051 . one way can think of achieving creating 2 separate clients. however, wondering if there way achieve creating single client, ex: new test_proto.test(['localhost:50051', 'localhost:50052'],grpc.credentials.createinsecure()); i tried looking answer in various wiki pages , issues on github couldn't. any suggestion of great help, !

select - MYSQL - returning complete set of tags aftering filtering on specific tags -

i have normalised quotations table , have 4 separate tables pertaining quotes, authors, quotetags (tags classify quotations) , quotestotags (a quotation can have multiple tags e.g. love, happiness, death, etc) 70,000 quotations. the quotes table consists of fields id, quotation , authorid author table consists of fields id , author (name of author) quotetags consists of fields id , description (e.g. 1 -> happiness, 2 -> admiration) quotestotags consists of id, quoteid, tagid foreign keys quotes table , quotetags table eg (1,1,3 ... 2,1,6....3,2,17..etc) i want filter quotations series of tags..so if select happiness, love, relationships want select quotations have @ least 1 of these tags associated (alongside id, quotation , author). now, when filter tags, want return group_concat() of tags each of selected quotations not ones user wants filter by...so if 1 quotation contains 5 tags , 1 of them happiness, want group_concat() contain 5 tags associated it, not ones s/he f

functional programming - Immutablejs within plain objects - Monads -

the redux best practices says not mix plain javascript object immutablejs objects. i'm trying hand @ functional programming , seems monads require computations/values stored inside object, or container of sorts. afaik immutablejs maps can't store methods. there issues using fp libraries folktale? haven't noticed noticeable issues basic todo app (which can try @ moment), i'm hoping clarification on immutablejs best practices, fp leaning. never mix plain javascript objects immutable.js ok, feel fool. read linked article again , saw it's not performance, avoid confusion when data passed immutable or pojo. here's relevant section article in fact, might tempted put normal javascript object inside immutable map. don't this. mixing immutable , mutable state in same object reap confusion. http://jlongster.com/using-immutable-data-structures-in-javascript

github - New Repository From WampServer WWW Folder Not Publishing Completely -

Image
i using github desktop 0.7.0 on top of windows 10 , trying publish wampserver project github repository after publishing repository not seeing including files in neither desktop github or on github.com . here steps took publish repository called mapapp simple website application. 1- tried add anew repository github desktop file-> add local repository... option. 2- navaigated wampserver www folder 3- after selecting mapapp folder dialog puped up 4- clicked on create repository , dialog box appeared 5- typed name of repository mapapp , clicked on create repository and published repository but in both side of repository (desktop application/ web) not seeing of including files , folders! here output of desktop , web views sorry taking long tried illustrated did creating , publishing not enough see files published well. you need add , commit them locally, before publishing (again) repo (no need re-create though) see " committ

Angular 2 deploy to IIS sub folder - returns 404 for images in Assets -

i'm using angular-cli ng build build angular 2 build package. deploy files "dist" sub-folder in application root, "root/apps" in iis. application loads bundled .js files fine images in assets folder return 404. i've tried setting base-href "apps" , "/apps/" result same. using dev tools found application looking images @ root->assets. 1 option copy assets @ root level seems dirty-workaround. highly appreciated.

How can i post my json from one php to another? -

i ask if function exist file_post_contents() ? because file_get_contents() working , i'm curious if there get, there should post also? it not mandatory have post function when there get, file_get_content() similar function file() , difference returns string, opposite function may file_put_content() because file_get_content()' pull file data and file_put_content()` push data. of course can build file_post_content() admin ehow does , , may research before asking here, maybe link come helpfull you.

javascript - semi responsive image depends on width -

i have div 's 600px wide , have image inside of it. want image have maximum width of 600px don't want image 100% make responsive. a better example if have image width less 600px don't make responsive if it's greater 600 make responsive. <div style="max-width: 600px; width: 100%"> <img src="some-image.jpg" alt=""> </div> for image use width:100% , height:auto , container use max-width:600px ; makes image resopnsive.

c# - Extension Method on a null List with inner instantiation -

can use extension method on list may null, , if case instanciate inside extension method?? instanciate list inside extension method applies on it... sounds when try add or remove item list your iterating foreach loop. public static void addorupdate(this list<blabla> i, person p) { = ?? new list<blabla>(); //is ok no instantiate inside? i.removeall(t => t.id == p.id && t.role == roleenum.admin); i.add(p); //since reference type, dont need return (even "this" parameter) right? } and use this: //list<blabla> teamwork comes anywhere else, instantiated or not teamwork.addorupdate(apersona); teamwork.addorupdate(apersonb); dosomething(teamwork); no, not work, parameter should passed ref , can't use ref combined this keyword. but can likle this: public static list<blabla> addorupdate(this list<blabla> i, person p) { = ?? new list<blabla>(); i.removeall(t => t.id == p.id && t.role == rol

qsub on PBS doesn't give output -

i trying submit python jobs pbs , printed content output. easy example goes like: python file test.py: import time print(time.time()) pbs submit file job_test.pbs: #!/bin/bash #pbs -l nodes=2:ppn=8,walltime=8:00:00 #pbs -n test #pbs -q gpu module load anaconda/3 torque cuda80 cudnn cd /path-to-the-test.py-program python test.py and qsub command: qsub job_test.pbs since job easy, see status goes q e , c in no time using qstat. problem comes don't see output file should in /path-to-the-test.py-program. tried both setting #pbs -o /path-to-the-test.py-program/output.txt in pbs script , using command qsub -o /path-to-the-test.py-program/output.txt job_test.pbs none of them works. how can right?

javascript - How to close dynamically generated dropdown on clicking on the body using angularjs? -

hi developing web application in angularjs. on top right corner have 1 drop-down box , become active after user logged in. have scenario user clicks on dropdown , once clicks anywhere on page want close dropdown. struggling fix long time. have created plunker in order understand problem facing properly. `https://plnkr.co/edit/4rjrbdhe6mmxofwrovfb?p=preview` may here fix this? appreciated!. thank you... you can use $event.stoppropagation . can add following code make work html : <div class="user" ng-click="opendropdown($event)"> <h1>dropdown</h1> <div class="user-dropdown" ng-show="dp" id="profiledropdown"></div> </div> js : $scope.opendropdown = function(event) { if ($scope.dp === false || $scope.dp === undefined) { $scope.dp = true; event.stoppropagation(); } else { $scope.dp = false; } }; window.onclick = function() { if ($scop

Spark + Python - Ship pytz module dir to spark executors -

i have added new dependency 1 of python modules (pytz) in package , trying ship dependency (pytz ) spark executors via sc.addpyfile ex - sc.addfile('//lib/python2.7/site-packages/pyodin-0.0.0-py2.7.egg-info') but doesn't seem work . can 1 me understand how can ship complete python modules spark executors using spark-submit? i referring shipping python modules in pyspark other nodes? and have recommended using same doesn't seem work with.egg_info directories. while merging in new dependencies - getting following directories 1) /lib/python3.6/site-packages/pytz% ls exceptions.py init .py lazy.py reference.py tzfile.py tzinfo.py zoneinfo 2) /lib/python3.6/site-packages/pytz-2017.2-py3.6.egg-info% ls dependency_links.txt pkg-info sources.txt top_level.txt zip-safe could 1 please confirm of 2 paths should given part of sc.addpyfile() parameter. pointers appreciated ?

Javascript for loop to get unique failed -

i'm figuring out how find unique content that's in var test . in var test there's 5 content first row contentid . so, have var contentid show number of used contentid used var test . i'm pushing every content test array , , looping find contentid not being used. var test = "1#2#did know?#digital rapid! pair of biocarbon engineering drones can plant 100 ,000 trees day.#8#yes\n2#2#did know?#starting summer of 2017, ikea's smart light bulbs answer voice commands given amazon alexa, google assistant, or apple siri. internet of things (iot) revolutionising everyday appliances!#5#unknown\n3#2#did know?#cemex's (a cement company) collaboration platform allows employees share opinions, knowledge, , best practices. ideas every corner of cemex have led new initiatives , business outcomes.#5#unknown\n4#2#did know?#cemex's (a cement company) collaboration platform allows employees share opinions, knowledge, , best practices. ideas every corner of cemex

c - Why is the output reversed along with the first character missing? -

this question has answer here: assigning more 1 character in char 2 answers #include<stdio.h> int main() { char *a; char *temp ='55515'; = &temp; printf("%s ", a); } the expected output 55515 actual output 5155? '55515' multi-character constant converted int . platform has 32-bit int s msb byte discarded, , resulting int (int)0x35353135 . converted pointer char in implementation-defined manner. platform little-endian platform, , char conversion retains int value. value of pointer object laid out in memory temp: | 0x35 | 0x31 | 0x35 | 0x35 or | 0x35 | 0x31 | 0x35 | 0x35 it cannot deducted whether or not you're using 64-bit or 32-bit platform. make another pointer char * points first byte of pointer object , i.e. byte 0x35 , printf string %s . depending on platform printf call

javascript - Using Bluebird Promise in For Loop to build and return an Array of Objects -

i trying build , return object using bluebird promises. promise http request gets additional data add object. i created function carries out request in loop (i using framework carries out middleware - z. about) const getwebappcustomfielddetails = (z, url) => { const responsepromise = z.request({ url:url, headers:{ 'content-type': 'application/json' } }); return responsepromise .then(response =>{ return json.parse(response.content); }); }; this function called within following code: const webappfields = (z, bundle) => { //this section carries creates initial request gets bulk of data const responsepromise = z.request({ url: webappurl(bundle) + '/' + encodeuri(bundle.inputdata.webapp), headers:{ 'content-type': 'application/json' }, }); //this array hold objects created response var fields = []; return responsepromise .then(response => { respo

Remove n number of dot(.) from String in Java -

this question has answer here: java - trim leading or trailing characters string? 2 answers i have following string , want remove dynamic number of dot(.) @ end of string. "abc....." dot(.) can more one try this. uses regular expression replace dots @ end of string empty strings. yourstring.replaceall("\\.+$", "");

javascript - How to insert multiple images in different column same row using php (assign separate column field) -

database: actual field in database `users` ( `itemid` int(11) not null, `itemname` varchar(20) not null, `isfragile` varchar(255) not null, `noofpiece` int(20) not null, `userprofile` varchar(200) not null, `userprofile2` varchar(255) not null, `userprofile3` varchar(225) not null, `userprofile4` varchar(255) not null, `userprofile5` varchar(255) not null, `rrid` int(11) not null, `tempguid` int(11) not null, `createdon` datetime not null, `updatedon` datetime not null html form: using javascript add multiple images , calling in php name="file[]" function. <form method="post" enctype="multipart/form-data" class="form-horizontal" style="margin: 0 300px 0 300px;border: solid 1px;border-radius:4px"> <table class="table table-responsive"> <h2 style="text-align: center;font-size: 24px;color: #5db85c;font-weight: 600;">add item </h2> <tr>

ios - How to animate an object multiple times with delay in swift 3? -

i want animate multiple buttons multiple times in succession when button required animate twice or more, code doesn't work @ all. //function animates button func buttonanimationchain(buttoncolor:uibutton, idelaytime: int){ uiview.animate(withduration: 0.5, delay: double(idelaytime), options: [], animations: { buttoncolor.alpha = 0.0; }, completion: {finished in buttoncolor.alpha = 1.0; }) } //function displays sequence func showsequence(igeneratedarraysequence: [int]){ var idelaytime:int = 0; _ in 1 ... igeneratedarraysequence.count{ if(igeneratedarraysequence[idelaytime] == 1){ buttonanimationchain(buttoncolor: buttonblue, idelaytime: idelaytime); } if(igeneratedarraysequence[idelaytime] == 2){ buttonanimationchain(buttoncolor: buttonyellow, idelaytime: idelaytime); } if (igeneratedarraysequence[idelaytime] == 3)

Get a link to a specific line in a diff using GitHub API? -

using github api i'm looking way generate link specific line in diff. i can contruct "compare between commits" url, example: https://github.com/emmetog/feature-flags/compare/master...d8f9c29bfd0b87d26123b78b76feca8e4c87ad8 and visiting url in browser can click on specific line , this: https://github.com/emmetog/feature-flags/compare/master...d8f9c29bfd0b87d26123b78b76feca8e4c87ad8#diff-21171d4ef87ca8e3591556dd18dfa456r26 however, need generate last bit, #diff-21171d4ef87ca8e3591556dd18dfa456r26 bit, programatically throught github api, or else find way of linking specific line in diff without going through browser. is possible? it impossible. i read https://developer.github.com/v3/repos/commits/#compare-two-commits i tried curl https://github.com/emmetog/feature-flags/compare/master...d8f9c29bfd0b87d26123b78b76feca8e4c87ad8 by using github api, can not specify line 26th of different between new version , old version of file src/emmetog/featuref

ruby on rails - Capistrano/nginx/Unicorn: Website is randomly up and down -

i using capistrano deploy code digitalocean server. added deploy.rb file block restarting unicorn after every deploy, since have noticed when got browser , start refreshing website, refreshed website , blank (white) page. it's total random. deploy.rb : # config valid current version of capistrano lock "3.8.1" set :application, "project" set :repo_url, "git@bitbucket.org:username/project.git" set :branch, "master" set :tmp_dir, '/home/deployer/tmp' set :deploy_to, "/home/deployer/apps/project" set :keep_releases, 5 set(:executable_config_files, %w( unicorn_init.sh )) # files need symlinked other parts of # filesystem. example nginx virtualhosts, log rotation # init scripts etc. set(:symlinks, [ { source: "nginx.conf", link: "/etc/nginx/sites-enabled/default" }, { source: "unicorn_init.sh", link: "/etc/init.d/unicorn_#{fetch(:application)}" }, {

android - Handler not workig when device is locked screen -

activity open when device lock screen problem inside activity using handler showing dialog not working. handler working when device unlock dialog showing.my problem when device screen unlock want start handler inside activity showing dialog. here code: protected void oncreate(bundle savedinstancestate) { requestwindowfeature(window.feature_no_title); wind = this.getwindow(); wind.addflags(windowmanager.layoutparams.flag_dismiss_keygua‌​rd); wind.addflags(windowmanager.layoutparams.flag_show_when_lock‌​ed); wind.addflags(windowmanager.layoutparams.flag_turn_screen_on‌​); wind.addflags(windowmanager.layoutparams.flag_fullscreen); setcontentview(r.layout.activity_incoming_call); mhandler_calldismiss=new handler(); mhandler_calldismiss.postdelayed(runnable,30000); } in activity, befor lock, calls onpause() , after unlock , calls onresume(). can write handler code in onresume() functions the user ope

html - Getting attribute of element in XPath -

i want learn web-scraping. therefore, started practicing. trying data-ad-id html using xpath . html structure this: <body id="z1234"> <div class="viewport"> <div class="g-row"> <div class="g-col-9"> <div class="cbox cbox--content cbox--resultlist"> <div class="cbox-body cbox-body--resultitem dealerad rbt-reg rbt-no-top"><a class="link--muted no--text--decoration result-item" href="url" data-ad-id="248059713"></a> </div> </div> </div> </div> </body> xpath <a class="link--muted no--text--decoration result item" > //*[@id="z1234"]/div[3]/div[4]/div[2]/div[1]/div[11]/a . if choose different car, last div changes. according write c# code: var url = "https://suchen.mobile.de/fahrz

random - Randomness and probability in java -

i'm trying make small gambling game in java user has 2 options. a textfield can write in amount of how wants bet , combobox can choose how many precent chance him win . combobox provides options 10%, 20%, 30%, 40% , 50%. my problem don't know how apply probability in java. tried doing following: public class gamblinggame { private int rdmnumber; private int wonvalue; public int winorlose(int valuebetted, int precenttowin, label label, int attempts){ precenttowin = precenttowin/10; rdmnumber= threadlocalrandom.current().nextint(precenttowin, 10 +1); system.out.println("this rdmnumber: " + rdmnumber); system.out.println("this precentowin number: " + precenttowin); //if number rolled equal precent choose (ie if 10, number 1, if 20 number 2) if(rdmnumber == precenttowin) { wonvalue = valuebetted/precenttowin *2; system.out.println("you win!"); label.setstyle("-fx-text-fill: green

dotnetnuke - Dnn Remove Razor Host module from tab programmatically doesn't delete it properly -

i have razor script running in razor module, _bootstrapper.cshtml, responsible generating bunch of pages , adding modules them. when it's done there's button remove razor host module (_bootstrapper.cshtml) page. the code follows: public void removebootstrapper(int portalid, int pageid) { list<moduleinfo> listofmodules = getpagerazorhostmodules(portalid, pageid); foreach (moduleinfo module in listofmodules) { foreach (var settingkey in module.modulesettings.keys) { if (settingkey.tostring().tolower() == "scriptfile") { if (module.modulesettings[settingkey].tostring().tolower() == "_bootstrapper.cshtml") { deletemodulefrompage(pageid, module.moduleid, false); } } } } } public void deletemodulefrompage(int pageid, int moduleid, bool softdelete) { modulecontroller modulecontroller = new modulecontroll

Django URL in template with slug -

i have template (home.html) want list items in model, , when click on them, take user details page of item. home.html: {% item in menuitems %} <div class="col-md-4"> <h2><a href="{% url 'show_menuitem' slug=instance.slug %}">{{ item }}</a></h2> <p> </p> </div> {% endfor %} urls.py: urlpatterns = [url(r'^menuitem/(?p<menuitem_slug>[-\w]+)/$', menu_views.show_menuitem, name = 'show_menuitem'), ] views.py: def home(request): page_title = 'samplepagetitle' template_name="home.html" menuitems = menuitem.objects.all() context = { 'page_title':page_title, 'menuitems':menuitems, } return render(request, template_name, context) models.py: class menuitem(models.model): name = models.charfield(max_length=250, blank=false, unique=true) slug = models.slugfield(max_length=250, unique=true, def __str__(self): return sel

classification - Can a machine learning model provide information about mean and standard deviation of data on which it was trained? -

consider parametric binary classifier (such logistic regression, svm etc.) trained on dataset (say containing 2 features e.g. blood pressure , cholesterol level). the dataset thrown away , trained model can used black box (no tweaks , inside information can gathered trained model) . set of data points can provided , labels predicted. is possible information mean and/or standard deviation and/or range of features of dataset on model trained? if yes, how so? , if no, why can't we? thank response! :) svm not provide information data statistics, maximum margin classifier , finds best separating hyperplane between 2 datasets in feature space, linear combination of "support vectors". if use kernel functions, combination in kernel space, not in original feature space. svm not have straightforward probabilistic interpretation whatsoever. logistic regression discriminative classifer , models conditional probability p (y|x,w) y label, x data , w features. after m

amazon ecs - AWS ECS essential container equivalent in kubernetes -

we scheduling atlassian bamboo jobs ecs , looking doing same on kubernetes. have bamboo agent container 1-n side service containers based on job needs (database, docker daemon, selenium,...). in ecs marked main agent container 'essential' , when agent finished work , exited, entire ecs task collapsed, exiting other side containers. how same thing in kubernetes? seems option have regularly poke cluster , check pods bamboo-agent container terminated , terminate pods outside. there way make pod auto-collapse/terminate when 1 of containers dies? you want use kubernetes job objects: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/

html - Continuous flow of content of multi line div's without line-breaks -

there 3 divs having width 100%, each div contains 3 inner div's having width 50%, such that <style type="text/css"> .inner{ width: 50%; display: inline-block; } .outer{ width: 100%; } </style> <div class="outer"> <div class="inner"> content </div><div class="inner"> content </div><div class="inner"> content </div> </div> <div class="outer"> <div class="inner"> content </div><div class="inner"> content </div><div class="inner"> content </div> </div> <div class="outer"> <div class="inner"> content </div><div class="inner"> content </div><div class="inner"> content </div> </div> now question how can have 2 inner elements on each row ie, n

xamarin.forms - Do I need to specify Grid.ColumnDefinitions for a simple two column grid in Xamarin? -

i have code: <viewcell x:name="ss"> <grid verticaloptions="centerandexpand" padding="20, 0"> <grid.columndefinitions> <columndefinition width="*" /> <columndefinition width="auto" /> </grid.columndefinitions> <local:labelbodyrendererclass grid.column="0" horizontaloptions="startandexpand" text="show subcategory" /> <switch x:name="ssswitch" grid.column="1" toggled="ssswitch" verticaloptions="center" horizontaloptions="end" /> </grid> </viewcell> i found still works fine when remove column definitions: <viewcell x:name="ss"> <grid verticaloptions="centerandexpand" padding="20, 0"> <local:labelbodyrendererclass grid.column="0" horizontaloptions="startandexpand" text="

when using -e in bash, exclamation mark before a passing command still doesn't cause the script to fail -

i thought following script print 'hello' , exit '1' #!/bin/bash -e ! echo hello echo world however, prints hello world and exits 0 the following script exits 1: #!/bin/bash -e ! echo hello and following #!/bin/bash -e echo hello | grep world ! echo hello echo world but reason -e option doesn't manage fail script when command returns failing exit code due ! half way through. can offer explanation make me feel better this? http://www.gnu.org/software/bash/manual/bashref.html#the-set-builtin the -e command fail script command returning non-zero code, except cases, while loops, or commands returning 0 inverted ! option. ! echo hello return 1 (0 inverted ! ) -e option won't fail. but if make exit status 42 , have script failed.

java - Why do I get DEBUG level logging in console? -

i have log4j properties file defined so: log4j.rootlogger=info, stdout log4j.appender.stdout=org.apache.log4j.consoleappender log4j.appender.stdout.layout=org.apache.log4j.patternlayout log4j.appender.stdout.layout.conversionpattern=%d{yyyy-mm-dd hh:mm:ss} %-5p %c{1}:%l - %m%n log4j.logger.com.github.user=debug, file log4j.appender.file=org.apache.log4j.rollingfileappender log4j.appender.file.file=target/cucumber-parser.log log4j.appender.file.maxfilesize=5mb log4j.appender.file.maxbackupindex=10 log4j.appender.file.layout=org.apache.log4j.patternlayout log4j.appender.file.layout.conversionpattern=%d{yyyy-mm-dd hh:mm:ss} %-5p %c{1}:%l - %m%n based on understanding, info level logging should routed stdout (console) , debug should written file. both, info , debug level in console. doing wrong? because info level covers debug level. see both. see more logging levels

imagemagick - Adjust two images contrast/brightness/luminosity/etc -

what i'm trying accomplish : a user take picture of object i incrust image in both pictures taken in different conditions. is there way "normalize" programmatically image incrust match contrast/brightness/luminosity/etc... of picture taken user realistic possible ? edit : example : photo 1 : photo of taken in living room photo 2 : photo of dress taken in studio (on white background) i result photo 2 looking taken in same conditions photo 1.

windows - Detect object(Articles) from dino lite capture image based on object color by in C# -

i new in dino lite captured microscope image processing.i want know how detect object(articles) dino lite captured image based on object colors in c#. how use dino lite sdk in visual studio 2015.? how customize in dino lite sdk (dino capture)? how detect object(articles) dino lite captured image based on object colors in c# without dino lite sdk ? thanks in advance.

ruby on rails - How to get rid of Permission denied (publickey) error on running bundle exec foreman start? -

Image
whenever run bundle exec foreman start getting below error. it working fine till now, stopped working suddenly. procfile web: bundle exec rails s -p 3000 redis: redis-server --port 6379 db: /usr/local/bin/mysqld --gdb watch_re: npm run watch:js:re watch_vue: npm run watch:js:vue sidekiq: bundle exec sidekiq -q high -q default -q crawler_facebook -q crawler_twitter -q mckinley -q twitter_io -q twitter_reach_freq -q master_update -q twitter_check_notification -q tw_report_file_creator -q mojaco_tw_crawler -q mojaco_fb_crawler -q fb_report_file_creator -q cache_manager -q facebook_attribution ssh_tunneling_for_elasticache: ssh -n -l 60660:sherpa-production.y6mej4.0001.apne1.cache.amazonaws.com:60660 ec2-user@ec2-13-114-37-187.ap-northeast-1.compute.amazonaws.com -o "stricthostkeychecking no" -o "userknownhostsfile /dev/null" your public ssh-key unknown aws-server. ssh_tunneling_for_elasticache: