Posts

Showing posts from September, 2015

ruby - Train neural network with sine function -

i want train neural network sine() function. currently use code , ( cerebrum gem): require 'cerebrum' input = array.new 300.times |i| inputh = hash.new inputh[:input]=[i] sinus = math::sin(i) inputh[:output] = [sinus] input.push(inputh) end network = cerebrum.new network.train(input, { error_threshold: 0.00005, iterations: 40000, log: true, log_period: 1000, learning_rate: 0.3 }) res = array.new 300.times |i| result = network.run([i]) res.push(result[0]) end puts "#{res}" but not work, if run trained network weird output values (instead of getting part of sine curve). so, doing wrong? cerebrum basic , slow nn implementation. there better options in ruby, such ruby-fann gem. most problem network simple. have not specified hidden layers - looks code assigns default hidden layer 3 neurons in case. try like: network = cerebrum.new({ learning_rate: 0.01, momentum: 0.9, hidden_l

Using django-mptt to get only the categories that have items -

sample structure: all uppercase: category mixed case: item root ├── books │   ├── fiction │   │   └── classics │   └── non-fiction ├── clothing └── electronics ├── laptops ├── phones │   ├── apple │   │   ├── iphone 6 │   │   ├── iphone 6 plus │   │   ├── iphone 6s │   │   └── iphone 6s plus │   ├── motorola │   │   ├── moto g4 │   │   ├── moto g4 play │   │   ├── moto g4 plus │   │   └── moto x │   └── samsung └── tablets └── apple i'm trying have index page show "electronics" category. "clothing" category shouldn't show since it's empty , "books" category shouldn't show either since, although has child categories, child categories don't have items. similarly, "electronics" page should show "phones" category. "laptops" category shouldn't show since it's empty , "tablets" category shouldn't show either since

android - Error generating Gradle in Eclipse ADT -

i have android project built in eclipse, , wish migrate android studio. though android studio works fine without gradle build files, want create them using eclipse adt explained here . however, when trying generate gradle files, eclipse shows me error log click on "finish". have tried decode means no avail. here error in question: java.lang.reflect.invocationtargetexception @ org.eclipse.jface.operation.modalcontext.runincurrentthread(modalcontext.java:477) @ org.eclipse.jface.operation.modalcontext.run(modalcontext.java:372) @ org.eclipse.jface.wizard.wizarddialog.run(wizarddialog.java:1028) @ com.android.ide.eclipse.adt.internal.wizards.exportgradle.gradleexportpage.generatebuildfiles(gradleexportpage.java:293) @ com.android.ide.eclipse.adt.internal.wizards.exportgradle.gradleexportwizard.performfinish(gradleexportwizard.java:32) @ org.eclipse.jface.wizard.wizarddialog.finishpressed(wizarddialog.java:827) @ org.eclipse.jface.wizard.wizarddialog.buttonpressed(wizar

Python TypeError: 'type' object does not support item assignment -

i have design , implement twosum class. should support following operations: add - add number internal data structure. find - find if there exists pair of numbers sum equal value. here code: class twosum(object): dict = {} def add(self,n): dict[n] = n #typeerror: 'type' object not support item assignment def find(self,n): in range(0,len(dict)+1): if dict[i] == none: continue val = n - dict[i] if dict[val] != none , val != i+1: return true return false test = twosum() test.add(1) test.add(3) test.add(5) print(test.find(4)) # true print(test.find(7)) # false i got error message typeerror: 'type' object not support item assignment "dict[n] = n" any or suggestion? thank much! lot of issues here, i'll try go through them 1 one the data structure dict = {} not overwriting python's dict , (see mgilson's co

javascript - Java with RWeka packege -

i have mac el capitan, 10.11.5, used rweka package, downloaded correctly , initialized error, when apply j48(species ~ ., data = iris) i have error error in .jnew("weka/core/attribute", attname[i], .jcast(levels, "java/util/list")) : java.lang.unsupportedclassversionerror: weka/core/attribute : unsupported major.minor version 51.0 i used java version these details, 52f85:~ kameljabreen$ java -version java version "1.7.0_79" java(tm) se runtime environment (build 1.7.0_79-b15) java hotspot(tm) 64-bit server vm (build 24.79-b02, mixed mode) please me solve problems, problm since 1 month, read lot problem in web sites. did thing, installing java jdk version 1.8 .... ect. used java 1.7. please give me solutions. in advance the rweka package depends on rjava package r-to-java communication, includes , uses own java 1.6 runtime. make things worse, behavior of rjava package platform dependent - uses "built-in" java on p

Android recyclerview adding duplicate elements on each activity creation -

when launch new fragment navigation drawer, it's meant take me home page cardview of matching profiles. works great first time , every profile want show there. however, when navigate away fragment , click on again, elements duplicated, , each subsequent time refresh page items duplicated once more. believe problem lies somewhere in recyclerview adapter not clearing on activity create, have't been able pinpoint it. here's fragment class public class homefragment extends fragment { private customlistadapter listadapter; private static final string profileurl = "http://10.0.2.2:3000/apip/buyers/profiles"; private static final string tag = selectbuyerprofile.class.getsimplename(); private progressdialog pdialog; private listview listview; private list<buyerprofile> buyersprofiles = new arraylist<buyerprofile>(); private view root; //private rvadapter recycleradapter; @override public view oncreateview(layoutin

reporting services - SSRS RowNumber counting a Groups in the report sequentially -

here need achieve. import purchasing system. created ssrs report works fine. im missing 1 more step finish it. i'll try explain achieved , remains achieved. achieved: lineid   lnarr2  1      751  1      793  1      804  2      804  3      804  4      804  1      807  2      807  3      807 the avobe 4 payments. payment id represented by: "lnarr2" (751, 793, 804 , 807). "lineid" counts number of lines pertaining group (purchase) in ssrs achieved by creating group, name: "lnarr2_grp" , group on: "lnarr2" expression "lineid" =rownumber("lnarr2_grp") remains achieved following on example above. need add document id (docid) . similar lineid represented follows: docid   lineid   lnarr2  1     1      751  2     1      793  3     1      804  3     2      804  3     3     

node.js - Meteor deploy on Heroku Error deploying Node -

Image
i built meteor app, , runs on local machine, have meteor installed. i have never deployed app online, , trying put app on heroku. i first tried use buildpack/jordansissel/heroku-buildpack-meteor.git, got error "meteor requires node v0.10.41 or later" i tried use buildpack/michaltakac/meteor-buildpack-horse.git failed push because couldn't unpack node. lastly i've tried kevinseguin/heroku-buildpack-meteor.git lots of warnings npm depricated http://prntscr.com/bewzak when @ logs says "slug compilation failed: failed compile node.js app" i error: mongo_url must set in environment i don't know enough understand errors are, or how app deployed image of errors: http://prntscr.com/bex0av my goal site on gr-fireworks.herokuapp.com i contacted heroku helpdesk , said couldn't me because issue outside scope of heroku support. i tried reach out snap ci said successful in deploying it, when try type in did, still getting error node http

Powershell insert object into SQL Server database more elegant solution -

i have array of objects ( $itemobjectarray ), each 1 having these properties , values so: id : 1234 location : usa price : $500 color : blue i have sql server 2012 table called items column names match object property names so: table items ( id location price color primary key (id) ) i have created following code insert object sql server table. think code little crude. there more elegant way since column names match object property names? $itemobjectarray | %{ #step through array #get property names, match column names $names = $_ | get-member -membertype properties foreach($name in $names.name){ #make sql string column names $cols += $name + "," } $cols = $cols.trimend(",") #get rid of last comma foreach($name in $names.name){ #step through properties, values , build values string $vals += "'" + $_.$($name) + "'," } $vals

java - Getting a "money converter" Android app to convert one currency to another based on user input -

so here instructions: retrieve current currency conversion rates : http://api.fixer.io for example, convert dollars british pounds call: http://api.fixer.io/latest?base=usd&symbols=gbp 2- provide 2 spinners 5 currencies of choosing. 3 - use async calls conversion lookups, shouldn't block ui thread. now i've gotten far pulling values json api , getting display conversion rate of 1 usd 1 gbp (this done hard coding in usd , gbp pull json api. i'm struggling trying hard coded currencies instead pulled pair of spinners containing 5 different currencies. additionally i'm struggling rate multiply user specified amount (for example if rate 0.69 , user wants convert 10usd gbp app should report converted amount 6.90gbp) @ present getting "operator * cannot applied double" @ present app crashes @ launch , first priority getting run , convert 1 monetary unit equivalent amount of monetary unit. this fetchconversionratetask.java f

c++ - In Lists, is remove same as erase? -

those 2 sample examples of trying say. first example. std::list<someclass*> somelist; // have defined someclass m method remove std::remove(somelist.begin(), somelist.end(), m); method erase auto = std::find(somelist.begin(), somelist.end(), m); if (it != somelist.end()) { somelist.erase(it); } question: there difference in behavior or performance? second example. well actual purpose of asking question, std::list<someclass*> somelist; someclass* m = nullptr; using same methods first example, behavior, using both methods. here standard says: erase: iterator erase(const_iterator position); iterator erase(const_iterator first, const_iterator last); invalidates iterators , references erased elements. remove: void remove(const t& value); template <class predicate> void remove_if(predicate pred); erases elements in list referred list iterator i for following conditions hold: *i == value, pred(*i) != false. in

plsql - IT IS SHOWING THAT PROCEDURE CREATED WITH COMPILATION ERROR? -

/* procedure */ set serveroutput on; declare number; b number; sum number:=0; procedure addd(x in number,y in number,sum out number) begin sum:=x+y; end; begin a:=12; b:=54; addd(a,b,sum); dbms_output.put_line(sum); end; /

C++ Can't Figure Out How To Shuffle Image -

i've been stuck on bit now. need break image down 9 boxes(2d array) , shuffle it. imported image twice, once src , once target, 2 arrays. need src image shuffle , output target, without repeating tile, cant figure out how that....here's code: #include "pgmio.h" #include <iostream> #include <ctime> void shuffle_image_3(pgm src, pgm & target); int main(int argc, char ** argv) { srand(time(null)); pgm src, target; readpgm("random.pgm", src); //2d array src readpgm("random.pgm", target); //2d array target shuffle_image_3(src, target); writepgm("random_shuffled.pgm", target); system("random_shuffled.pgm"); return 0; } void shuffle_image_3(pgm src, pgm & target) { if (src.row != target.row || src.col != target.col) { return; } //if sizes aren't equal, returns nothing //"used[i][j]==true means tile in source //at row , column j has been co

Returning (android.hardware.Camera) in landscape mode -

i building app contains video capture custom camera surface view. works fine in portrait mode, when change landscape mode camera preview goes blank screen. here's code i'm using: @override public void onconfigurationchanged(configuration newconfig) { super.onconfigurationchanged(newconfig); setcontentview(r.layout.camera_activity); camera1 = camera.open(camid); try { camera1.setpreviewdisplay(surfaceholder); camera1.startpreview(); } catch (ioexception e) { e.printstacktrace(); } } in configurationchanged function i'm not getting camera1 object. how can solve this? you need override onsaveinstancestate(bundle savedinstancestate) , write application state values want change bundle parameter this: you can saved instance of each variable this @override public void onsaveinstancestate(bundle savedinstancestate) { super.onsaveinstancestate(savedinstancestate); // save ui

Trying to remove top row from excel spreadsheet using Python -

this first question here if don't follow perfect etiquette please forgive me. have been searching answer 6 hours figured time ask. i'm new python, , i'm trying automate data entry selenium. i'm doing well, stuck @ part pull data excel. data pulling isn't problem, telling excel delete top row, or move onto next, is. here sample of script: import pandas pd pandas import excelwriter import numpy np xl = pd.excelfile('c:\\users\\steph_000\\desktop\\students2.xlsx') xl wr = pd.excelwriter('c:\\users\\steph_000\\desktop\\students2.xlsx') xl.sheet_names ['sheet1'] df = xl.parse('sheet1') #this reads sheet dataframe df cp = pd.read_excel('c:\\users\\steph_000\\desktop\\students2.xlsx') idnum = cp[:1] #this pulls first row variable print(idnum) #this prints search bar student chart = cp[1:] #this pulls first row variable print(chart) df.to_excel(wr, 'sheet1') wr.save() #this supposed overwrite it, saves bla

go - String pointers -

consider following program ( http://play.golang.org/p/ibastvudte ): package main import ( "fmt" ) func changestringvaluenotok(dest *string, src string) { dest = &src } func changestringvalueok(dest *string, src string) { *dest = src } func main() { := "hello" b := "world" changestringvaluenotok(&a, b) fmt.println(a) // still "hello" changestringvalueok(&a, b) fmt.println(a) // "world" } my goal call function , change value of string. works fine second function, not first. question: meaning of *dest = src compared dest = &src ? guess former "the contents of dest src" , latter "change dest variable points address of src" discards previous value, not contents of a. if right, don't understand how *dest = src works. i hope question isn't fuzzy. *dest = src is: set value pointed @ dest value in src . it's effective. dest = &a

Google Apps Engine: Using later version of NumPy -

i'm trying use pandas module through google apps engine. requires numpy 1.7 or later. unfortunately google apps engine stuck @ 1.6.1. i've loaded several other third party modules in libs folder, including plotly (for using pandas) without problem, placing later version of numpy in libs folder isn't working. so, know way use newer version of numpy apps engine? it looks libs folder supports pure python packages don't have c-extensions: https://cloud.google.com/appengine/docs/python/tools/using-libraries-python-27#installing_a_library numpy has sorts of c-extensions, looks may stuck older version of numpy google app engine supports. pandas doesn't supported library , has c-extensions, seems can't use either. i've read, have use google app engine flexible environment install class of packages.

running embedded R in C -

i have written piece of c code declares square matrix of size 4x4. samples sampling function called rgig in package generalizedhyperbolic in r. inverses matrix using gsl library gnu , spits out result. exercise in calling r c. #include <stdio.h> #include <stdio.h> #include <math.h> #include <stdlib.h> #include <stddef.h> // gsl #include <gsl/gsl_machine.h> #include <gsl/gsl_rng.h> #include <gsl/gsl_randist.h> #include <gsl/gsl_cdf.h> #include <gsl/gsl_cblas.h> #include <gsl/gsl_sf_gamma.h> #include <gsl/gsl_vector.h> #include <gsl/gsl_matrix.h> #include <gsl/gsl_blas.h> #include <gsl/gsl_linalg.h> // r embedding in c #include <rinternals.h> #include <rdefines.h> #include <rembedded.h> #include <r_ext/parse.h> void gsl_square_matrix_inverse (gsl_matrix *, gsl_matrix *, int); sexp get_rinvgauss(void); int main(void) { // define dimension n of matrix // , s

Java: Print first, fourth, seventh... of an array using only ONE LOOP? -

given array of integer. i want first print print 1st, 4th, 7th.. numbers. 2nd, 5th, 8th.. , 3rd, 6th, 9th.. i want use 1 loop iterate through array. how can this? (note: size of array 4, 7, 10, 13.. , on, i.e. in increments of 3.) thanks. write function private int index(int i, int length) which computes right index loop variable i edit wasn't easy first thought: public static void main(string[] args) { int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; (int = 0; < array.length; i++) { system.out.println(array[index(i, array.length)]); } } private static int index(int i, int length) { int third = (length + 2) / 3; if (length % 3 == 1 && >= third) { // spezial, because second third smaller return index(i - 1, length - 1); } int group = % third; return (group) * 3 + (i / third); } edit did cleanup;

javascript - pass value to iframe on popover using jquery -

i have written code show popover iframe on hover link. want pass link value iframe window on popover. how can that? here code <a href="#" class="show-pop-iframe btn btn-default " data-placement="vertical" id="sample" value="email@domain.com">email@domain.com </a> <a href="#" class="show-pop-iframe btn btn-default " data-placement="vertical" id="sample1" value="email1@domain1.com">email1@domain1.com </a> <div id="auto"></div> (function(){ var settings = { trigger:'hover', title:'send mail user', content:'<p>this webui popover demo.</p><p>just enjoy , have fun !</p>', width:auto, multi:true, closeable:false, style:'', delay:300, padding:true,

Loop through Array, with Similar items First in PHP -

array ( [0] => array ( [intid] => 3 [intvolumetype] => 1 [intvolume] => 10 [totalvolumes] => 10 [inttrack] => 10 [inttracktype] => 2 [totaltracks] => 10 ) [1] => array ( [intid] => 4 [intvolumetype] => 2 [intvolume] => 100 [totalvolumes] => 200 [inttrack] => 111 [inttracktype] => 3 [totaltracks] => 222 ) ) i want print above array as: intvolumetype = 1 totalvolumes = 10 intvolumetype = 2 totalvolumes = 200 inttracktype = 2 totaltracks = 10 inttracktype = 3 totaltracks = 222 how loop through php array. there total 6 elements in array. might increase upto 20. print first volume information, track, , on.please help try here: http://phpfiddle.org/ <?php $a = array ( 0 => [ 'intid' => 3, "intvolumetype" => 1, "int

r - Stargazer Title -

i have issue giving stargazer tables in r right title. can change title says "table 1:" before title. unfortunately have more 1 table i'd change "title 2", "title 3" latter tables. how done? tables like: stargazer(fixed_coups, fixed_coups_navco, title="fixed-effect linear regression results coups", style="apsr", align=true, column.labels = c("without navco", "with navco"), covariate.labels = c("lagged repression", "coup", "attempt", "log population", "log gdp per capita", "non-violent campaign", "violent campaign"), dep.var.labels = ("repression"))

ios - Gradient color in Circle -

Image
this question has answer here: ios - circle shaped gradient 4 answers i have create circle animation, have created , working fine. problem add gradient color. please refer screen shot attached below code creating circle animation: let linewidth: cgfloat = 20 dispatch_async(dispatch_get_main_queue()) { () -> void in let startangle = -90.0 let endangle = -90.01 let circlepath = uibezierpath(arccenter: cgpoint(x: self.frame.width/2,y: self.frame.height/2), radius: cgfloat(self.frame.width/2 - (self.linewidth/2)), startangle: cgfloat(((startangle) / 180.0 * m_pi)), endangle:cgfloat(((endangle) / 180.0 * m_pi)), clockwise: true) // circle layer let circlelayer = cashapelayer() circlelayer.path = circlepath.cgpath circlelayer.fillcolor = uicolor.clearcolor().cgcolor circlelayer.strokec

c - how do i renew a kerberos service ticket using GSS API -

i use gss api authenticate myself smb 2.0 server using kerberos authentication (gss_init_sec_context call). know can renew tgt using kinit -r command. want able renew service ticket obtained well. in protocol spec says client needs renew kerberos tickets.. is possible renew service ticket? or should create new context? any pointers related smb 2.0 reauthentication using gss api welcome does service ticket contain renewable flag? you cannot renew tickets gss-api. must done mechanism below other means. gss-api high-level, not know underlying mech -- in case kerberos -- technique. this shouldn't bother actually, long service ticket cached in cc, api will/should reuse new context. since smb session-based, must have new gss context that. if stil want tamper mechanics below, study this site. though not recommed this.

video streaming - gst-launch-1.0 no element "hlssink" error -

i having trouble creating hls(http live streaming) gstreamer. trying this: gst-launch-0.10 videotestsrc is-live=true ! x264enc ! mpegtsmux ! hlssink max-files=5 playlist-root=http://server.com location=/var/www/hlssink playlist-location=/var/www/hlssink and getting error: warning: erroneous pipeline: no element "hlssink" can help? have tried install gstreamer-plugins-bad package , gstreamer-libav package. receiving same error. any appreciated. for hlssink element, there dependent packages. so, have install them first. are nettle & libgcrypt first have install above packages, , goto gst-bad-plugins directory, , ./configure --prefix=< prefix path > make sudo make install after configure, show list of plugins going build, in list if found hls, after make install element.

How to get value from other table and insert the value to new table using php and oracle -

this coding. value id "add basket" button. select form artwork values artwork want insert table sales. insert not function. <?php include("dbconn.php"); $artid =$_get['id']; $temp=oci_parse($conn, "select * artwork artw_id = '$artid'"); oci_execute ($temp); $p = oci_fetch_assoc($temp); $ids = $_post['artw_id']; $title = $_post['artw_title']; $yy = $_post['artw_year']; $price = $_post['artw_price']; $sql = oci_parse($conn, "insert sale values ('".$ids."', '".$title."', '".$yy."', '".$price."')"); header("location: checkout.php"); exit(); ?>

qt creator - Use qtcreator with makefile project -

i have makefile project. know in eclipse cdt possible load makefile project. is possibile load in qtcreator? as greenflow mentioned, qt creator can import existing project doesn't depend on existence of makefile . need import of existing project specify high-level folder in sources of project located (including sources in subdirectories) , set name project - name qt creator use display name. qt creator asks files should included project again, display of sources in project tree, not build. qt creator uses make tool in specified build directory default build project can override setting. example, in company work have custom build system , custom build tool. when import project qt creator , specify directory sources, set name, specify build directory, override default make build tool our custom one, add include paths file .includes, if necessary, specify macros in file .config , develop things, that's it. you can see more detailed information import existin

java - Jtable handling long running task -

i creating desktop application using java , h2 database using cardlayout , netbeans gui builder. app crud operation , used save customer data, purchases , list of products. i load data database jtable when data grows, loading time begin slow down , application seems froze or unresponsive user. after few days of googling, have came across swingworker, thread, runnable , edt(not sure else more). i run codes below in constructor. think problem here. private void updatetable() { vector<object> columnnames = new vector<object>(); vector<object> data = new vector<object>(); connection conn = new dbconnection().connect(); try { statement st = conn.createstatement(); string numofrow = cbonumberofrow.getselecteditem().tostring(); if (numofrow == "all") { numofrow = "-1"; } string query = "select c.custid \"id\",c.custna

Architecture style and patterns diffrenet? -

i new software engineering. when try find out 2 topics architectural patterns , architectural styles become confused. because of document in internet explain them same , others explain 2 topics. in documents says 2 terms didn't explain how differ. so need figure out. there no clear distinction, don't have confused. many terms in software engineering, these used differently different people. makes worse many people use these terms without having clue, think bullshit bingo. however there seems consensus styles more general , less specific patterns. pattern more recipe software architecture or part of can derived. so consider layered architecture style model-view-controller pattern. own opinion.

elk stack - ELK docker access via localhost -

Image
i have installed docker on windows, cloned elk stack machine, went cloned folder, run following command: docker-compose and when try access http://localhost:5601 , or 5600 port, page not found error. what's wrong? how access docker? if need access localhost, have setup virtualbox vm in order port-forward port vm host. see instance " using boot2docker run docker on mac or windows " andrew odewahn : that way, don't have find out ip of machine is.

android - How to start Fragment directly for espresso test instead of activity -

i running espresso tests. problem instead of opening main.activity, want open fragment directly part of main activity before starting tests. you can't. purpose of fragment run alongside activity. if want, can create empty activity run fragment , layout, , put activity mainactivity in manifest

c# - DataTable to Pre Defined DataGridView Columns -

i have dgv pre defined columns below , here generation method , binding method fixgridalarm(dgvalarmlar); public void fixgridalarm(datagridview gvw) { gvw.autogeneratecolumns = false; gvw.rowtemplate.height = 75; gvw.columncount = 3; gvw.columns[0].name = "no"; gvw.columns[0].width = 60; gvw.columns[0].readonly = true; gvw.columns[0].headercell.style.alignment = datagridviewcontentalignment.middlecenter; gvw.columns[0].defaultcellstyle.alignment = datagridviewcontentalignment.middlecenter; gvw.columns[1].name = "tarih/saat"; gvw.columns[1].width = 490; gvw.columns[1].readonly = true; gvw.columns[1].headercell.style.alignment = datagridviewcontentalignment.middlecenter; gvw.columns[1].defaultcellstyle.alignment = datagridviewcontentalignment.middlecenter; gvw.columns[2].name = "açıklama"; gvw.columns[2].width = 1195; gv

angularjs - How to implement ng-if within ng-repeat for array of objects condition? -

this code var app = angular.module('plunker', []); app.controller('mainctrl', function($scope) { $scope.masterdata=[ {id:1,name:"name1"}, {id:2,name:"name2"}, {id:3,name:"name3"}, {id:4,name:"name4"}, {id:5,name:"name5"}, {id:6,name:"name6"}, {id:7,name:"name7"}, {id:8,name:"name8"}, {id:9,name:"name9"} ] $scope.columndata = { key1 : { id : 1, name : 'name1' }, key2 : { id : 2, name : 'name2' }, key3 : { id : 11, name : 'name3' } }; }); <!doctype html> <html ng-app="plunker"> <head> <meta charset="utf-8" /> <title>angularjs plunker</title> <script> document.write('<base href="' + document.location + '" />'); <

amazon web services - Create ubuntu user on instance launch ansible aws -

i using ansible launch aws instance. there default user on aws instance called "ubuntu" , need setup new user. here guide setup user manually, there way automatically via ansible? here's version, 1 avoid using shell module , instead use native user module, same thing authorized_keys --- - hosts: "{{ host_name }}" become: yes become_method: sudo tasks: - name: create user deploy user: name=deploy comment="the deploy user" group=admin shell=/bin/bash - name: copy deploy's authorized_keys file authorized_key: user=deploy key="your_authorized_key_file_name"

Angular 2 subscribe not executing -

plunkr: https://plnkr.co/edit/arrowxsfyrasbeazciyf?p=preview i'm trying subscribe observer can't work. subscribe method never activated reason, notifyaboutchange runs , correct id passed after calling next subscribe method doesn't seem pick on being called. the service contains observer: import {injectable} '@angular/core'; import {subject} 'rxjs/subject'; @injectable() export class apiservice { public notifier = new subject(); public changeoccurrence$ = this.notifier.asobservable(); constructor() {} notifyaboutchange(id: string) { this.notifier.next(id); } } directive calls notifyaboutchange method: constructor(private _elementref: elementref, private _renderer: renderer, private _api: apiservice) { this.eventhandler = _renderer.listen(_elementref.nativeelement, ('ontouchstart' in window ? 'touchend' : 'click'), (e) => { this.isallchecked = !this.isallchecked; (let checkbox of this.c

Python timezone '%z' directive for datetime.strptime() not available -

using '%z' pattern of datetime.strptime() i have string text represent date , i'm able parse , transform clean datetime object: date = "[24/aug/2014:17:57:26" dt = datetime.strptime(date, "[%d/%b/%y:%h:%m:%s") except can't catch entire date string the timezone using %z pattern specified here date_tz = 24/aug/2014:17:57:26 +0200 dt = datetime.strptime(date, "[%d/%b/%y:%h:%m:%s %z]") >>> valueerror: 'z' bad directive in format '[%d/%b/%y:%h:%m:%s %z]' because this bug report says strftime() implemented per platform i precise there no such problem naive tzinfo directive '%z' workaround : casting tzinfo string tzinfo object i can make following workaround transforming gst time format string tzinfo object [as suggested here][4] using dateutil module , insert tzinfo datetime object question: make %z available plateform? but need %z pattern further project find solution avoid wo

Run a Docker Image as a Container -

i built docker image dockerfile. see image built successfully, do it? shouldn't able run container? new docker misunderstanding on end, great. the specific way run depends on whether gave image tag/name or not. $ docker images root@dockertest:~# docker images repository tag id created size ubuntu 12.04 8dbd9e392a96 4 months ago 131.5 mb (virtual 131.5 mb) with name (let's use ubuntu ): $ docker run -i -t ubuntu:12.04 /bin/bash without name, using id: $ docker run -i -t 8dbd9e392a96 /bin/bash please see https://docs.docker.com/engine/reference/run/ more information.

c# - MVC Remote Controller action is only called on form submit -

to understanding, thought remote validation calls controller action user leaves textbox. trying validate username (email) controller action called when submit form (when click submit button). want called leave email textbox. doing wrong here ? viewmodel public class registerviewmodel { [required(errormessage = "email required")] [datatype(datatype.emailaddress)] [remote("isemailavailable","register", errormessage = "email registered, use forgot password reset password if case.")] [display(name = "email")] public string username { get; set; } [required(errormessage = "first name required")] [display(name = "first name")] public string firstname { get; set; } [required(errormessage = "lastname required")] [display(name = "last name")] public string lastname { get; set; } [datatype(datatype.password)] [required(errormessage = "passwo