Posts

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...