Posts

Showing posts from July, 2011

How to move mongoDB database from from one server to another server using Ubuntu -

i need 1 help. need move mongodb database 1 server in ubuntu. suppose have database named video in 10.*.*.* , need move db lets 100.*.*.* . found below command. db.copydatabase(fromdb, todb, fromhost, username, password, mechanism) is above command able task. here can not understand should value assign mechanism . please me. that command should accomplish task. mechanism value optional. method copydatabase defaults scram-sha-1 if wire protocol version maxwireversion greater or equal 3 (i.e. mongodb versions 3.0 or greater). should need specify mechanism mongodb-cr if need authenticate version 2.6.x fromhost version 3.0 instance or greater. reference: https://docs.mongodb.com/manual/reference/method/db.copydatabase/#definition

html - header redirect on php form not working -

i'm new php , needed form. had working earlier it's deciding not work. appreciated. php section header going page in same directory <!-- php form e-mailer --> <?php if (isset($_post["submit"])) { $name = $_post['name']; $phone = $_post['phone']; $message = $_post['message']; $from = 'very local'; $to = 'myemail@gmail.com'; // business email address $subject = 'message local'; $body ="from: $name\n number: $phone\n message:\n $message"; // check if name has been entered if (!$_post['name']) { $errname = 'please enter name'; } // check if email has been entered , valid if (!$_post['phone'] || !filter_var($_post['phone'])) { $errphone = 'please enter valid phone number'; } //check if message has been entered

windows - Using Sendkeys to press a space in Jscript -

i have line in batch file: kbd(['{right}','{right}', '{tab}', '{enter}','{space}', '%s']); it runs fine until end. not press space button. need press space button uncheck checkbox. i found answer. if using kbd command want press space not use {space} use ' '. this: kbd(['{right}','{right}', '{tab}', '{enter}','{space}', '%s']); to kbd(['{right}','{right}', '{tab}', '{enter}',' ', '%s']);

c++ - Halide optimal scheduling -

i'm trying work out best schedule benchmark halide code , might missing because timing results don't make sense me. i'm using aot compilation, , here's algorithm part of code: imageparam input1(type_of<float>(), 3); imageparam input2(type_of<float>(), 3); func in1 = boundaryconditions::constant_exterior(input1, 0.0f); func in2 = boundaryconditions::constant_exterior(input2, 0.0f); f1(x, y, z) = (in1(x + 1, y, z) + in1(x, y, z) + in1(x - 1, y,z)); f2(x, y, z) = (in2(x + 2, y, z) + in2(x + 1, y, z) + in2(x, y, z) +in2(x - 1, y, z) + in2(x - 2, y, z)); res(x, y, z) = f1(x, y, z) + f1(x - 1, y, z) + f2(x - 1, y, z) + f2(x, y, z); for schedule have: f1.store_at(res, y).compute_at(res, yi).vectorize(x, 8); f2.store_at(res, y).compute_at(res, yi).vectorize(x, 8); res.split(y, y, yi, 8).vectorize(x, 8).parallel(y); res.print_loop_nest(); i use current_time function time execution of code. when use mentioned schedule both f1 , f2 execution time more

algorithm - C - freeing memory of a binary tree using post-order traversal -

i want remove binary tree using post-order traversal . meaning left part of tree should removed first right 1 then remove whole tree , free memory in second function follows after. i'm not allowed changed arguments of function , can play inside of it: #include <stdio.h> #include <stdlib.h> #include <string.h> #include "telefonbuch.h" static inline bstree * create_node(unsigned long phone, char * name) { bstree * newnode = (bstree *) malloc(sizeof(bstree)); newnode->key.phone = phone; strcpy(newnode->key.name, name); newnode->left = null; newnode->right = null; return newnode; } void bst_insert_node(bstree * bst, unsigned long phone, char * name) { if (bst == null) { return; } if (bst->key.phone > phone) { if (bst->left == null) { bst->left = create_node(phone, name); return; } bst_insert_node(bst->left, phone, name);

android studio - Ionic framework/Could not reserve enough space for 2097152KB object heap -

ionic build android. when try above command i'm getting: this problem might caused incorrect configuration of daemon. example, unrecognized jvmoption used. error occurred during initialization of vm: could not reserve enough space 2097152kb object heap

node.js - how to form an object and push it into an array using http/https from the resultant of response -

i new nodejs , trying form array of products having invalid imageurls using "http.get", querying products mongodb collection, though used "promise" array printing first, not getting result form "hh.get" here code in server side var promise = require('bluebird'), hh = require('http-https') mongoose = require('mongoose'), collection = mongoose.model('collection'); function getinvalidimgurl(prodobj){ return hh.get(prodobj.imageurl,function(res){ if(res.statuscode == 404){ return { name:prodobj.name, imgurl:prodobj.imageurl } } }) } exports.samplefunc=function(){ collection.find({category:"electronics"}).exec(function(err,products){ if(err){ console.log(err) }else{ var imgarr=[]; //eg:products=[{name:"mobile",imageurl:"ht

jquery - Change calculation on switch -

so i'm trying make grafic work, i'm kind of new in whole thing have few things can't work. the idea simple. when drag on first input[range] calculation made. answer it's after "round slider". when switch "no" formula changing, calculation it's made values both "r&d spend" , "business losses". so...if select value=5m @ "r&d spend" calculation is: 750,000. if select value=5m @ "r&d spend", select "no" , select value=5m @ "business losses" calculation is: 2,250,000. but in stage, if switch switch button 'yes' second input[range] dissapears(which good), calculation it's still second one, not first one, value first input. you can see fiddle here: https://jsfiddle.net/1x60sp0a/4/ $('#js--checkbox').change(function(e) { if ($('#js--checkbox').is(':checked')) { $('#slider2').slidedown(); } else { $('#slider2&

sql server - SQL injection with parameterised procedures -

need bit of sql injection issue: the following version of parameterised stored procedure. excluding how called application, there anyway prevent @v_string being treated dynamic sql? i think water tight - there's no execute or concatenated sql, still inserting semicolon allows additional data returned. i know there multiple levels consider question on, want know if there simple solution missing here majority of injection fixes involve dynamic queries. create table dbo.employee (empid int,empname varchar(60)) declare @v_id int, @v_string varchar(60) begin set @v_string='test'''; waitfor delay '0:0:5' -- if @v_id null begin set @v_id = (select empid abc.employee empname=@v_string); end print @v_id end is there anyway prevent @v_string being treated dynamic sql? i not expect @v_string treated dynamic sq

ios - .bundle in iPhone application -

can .bundle file have complete ios application within bundle? .bundle made target , used in different xcode project in same workspace. possible? nib files available in bundle loaded in xcode project. please let me know possibility. yes, possible because bundles 1 way of packaging executable codes. detailed information provided here: https://developer.apple.com/library/content/documentation/corefoundation/conceptual/cfbundles/bundletypes/bundletypes.html#//apple_ref/doc/uid/10000123i-ch101-sw1

selenium webdriver - How to close firefox browser in selenim 3.0.1 -

firefox : 50.0.1, geckodriver :13, selenium 3.01, ide: eclipse, programming language : java using below code : system.setproperty("webdriver.gecko.driver","c:\\geckodriver.exe); webdriver driver = new firefoxdriver(); driver.get("https://www.youtube.com/"); driver.close(); or driver.quit() in driver.close() browser not closed in driver.quite() browser closed , firefox crashed. getting error: "plugin container firefox has stopped working." please let me know solution steps can try: uninstall plugins in firefox browser. use 64-bit version of geckodriver 64-bit firefox, similarly, 32-bit geckodriver 32-bit firefox. i have tried code in same environment, , driver.quit worked me. driver.close still not closing browser.

html - How can I reduce the space between the texts? -

Image
i use anki program , reduce space between 'meaning', 'example', 'meaning2' , 'example2'. image here shows mean and code: .card { font-family: arial; font-size: 20px; text-align: center; color: black; background-color: white; } the space between rows, because have defined height of 300px in cell contains image. since it's table, next cell inherit height of 300px. to avoid that, need make image-cell span 2 rows. adding rowspan="2" image-cell, , remove empty cell on second row. then should consider making image 300px in height instead of image-cell. else end unwanted result. here have made illustration of code: as can se, when image-cell, has height of 300px cell next it, have it, because cells in same row cannot have multiple heights. that's why there space below text in second cell. and here, if use rowspan : now image-cell have "merged" cell below it, becomes 1 s

Python Pandas: Selecting Value from row when two values in that row match a value farther up the column -

title little convoluted, help. want retrieve value of values when variablea == variableb == variableb of current row. example, first row, result 54 because time conditions met in row 3. however, if variablea == variableb in current row, result 0. example data: values variablea variableb 0 134 1 3 1 12 2 6 2 43 1 2 3 54 3 3 4 16 2 7 5 37 6 6 desired result: values variablea variableb result 0 134 1 3 54 1 12 2 6 37 2 43 1 2 16 3 54 3 3 0 4 16 2 7 nan 5 37 6 6 0 not taking consideration 0 result when variablea , variableb match in current row, attempt: vars = df[['variablea', 'variableb']].values doublematch = (vars[:, none] == vars[none, :] ==

python - Django REST Framework and HTML pages -

i'm working on project uses django on server side , have rest(ish) api going. one thing i'm wondering about. considered ok practice deliver django html templates via api endpoints? example, going www.rooturl.com, api endpoint called , html delivered. then, when user clicks on, faq, request made www.rooturl.com/faq , html template delivered again? or should faq items delivered json? or maybe give both alternatives through content negotiation? @ point html content delivered? i couldn't find satisfying answer google-fu. i don't see point of using django html templates in api endpoint since whole point of using rest api have server side , client side independent 1 another. yes, faq items should delivered json , displayed want on client side.

embed - Google analytics not showing anything and no error -

i trying use google analytics data in web page. added code describing here . but not showing anything. added console code after inside gapi.analytics.ready(function() { that not showing. client id using demo 1 created testing purpose. what may wrong thing doing? please help. new analytics data. that loks incomplete code me, when set tracking code should have script this. <!-- google analytics --> <script> (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function() {(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o),m=s.getelementsbytagname(o)[0];a.async=1;a.src=gm.parentnode.insertbefore(a,m)})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'ua-xxxxx-y', 'auto'); ga('send', 'pageview'); </script> <!-- end google analytics --> then copy paste footer of website. note code abov

html - max-height 100% overflowing parent -

Image
i have list-group using bootstrap, lot of items in it. applied following css rules id of list-group div. #my-listgroup { margin-top: 20px; border-radius: 6px; overflow-y: scroll; max-height: 100%; max-width: 100%; width: auto; height: auto; } now div wrapped in couple of other divs, shown below. how make listgroup not overflow #body-content-menu div has following css rules, while still allowing responsive. #body-content-menu { border-radius: 10px; height: 100%; background-color: #b21e15; padding-bottom: 20px; } firstly must have jquery link in page(maybe bootstrap add page). need set id div class="row" example id="row , id div class="col-lg-12" example id="col" . now: var realheight = $('#col').height() - $('#row').height(); $('#my-listgroup').css('height', realheight + 'px'); <script src="https://code.jquery.com/jquery-2.2.4

php - tuleap alm after upgrade not able to login -

the tuleap running on centos os upgraded after not able login tuleap when check logs in httpd/error.log says [tue feb 07 14:56:38 2017] [error] [client 192.168.1.1] php warning: session_start(): open(/var/tmp/tuleap_cache/sess_u9c6qfrtm6715t9qmjs2idrbq4, o_rdwr) failed: permission denied (13) in /usr/share/tuleap/src/common/include/loaderscheduler.php on line 45 [tue feb 07 14:56:38 2017] [error] [client 192.168.1.1] php notice: db error ==> select * session id = 0 , time + 15811200 > 1486459598 @@ /usr/share/tuleap/src/common/dao/include/dataaccessobject.class.php @ line 96 in /usr/share/tuleap/src/common/dao/include/dataaccessobject.class.php on line 156 [tue feb 07 14:56:38 2017] [error] [client 192.168.1.1] php fatal error: call member function getrow() on non-object in /usr/share/tuleap/src/common/dao/include/dataaccessobject.class.php on line 110 [tue feb 07 14:56:38 2017] [error] [client 192.168.1.1] php warning: unknown: open(/var/tmp/tuleap_cache/sess_u9c6qfr

asp.net mvc - C# string contains daterange which should splitted into 2 dates -

i trying solve problem. have string filled date range in following format "dd.mm.yyyy - dd.mm.yyyy". var datest = shippeddaterange.split(new char[] { '-' }, stringsplitoptions.removeemptyentries); var startdate = datetime.parse(datest[0]); var enddate = datetime.parse(datest[1]); now want split 2 variables, can use lambda query works fine. 2 new variables should named startdate , enddate . data.container = db.container .where(a => a.shippeddate >= startdate && a.shippeddate <= enddate) .tolist(); if compile app, gives me error, array value out of index range you need defensive coding. don't assume goldilocks situation in rude awakening. if input bad, there stands chance wont end 2 items. public partialviewresult searchdata(shippeddaterange) { data = new contentviewmodel(); using (var db = new plsdb()) { var datest = shippeddaterange.split(new char[] { '-' }, stringsplitoptions.removeemptyentries

javascript - spread properties with multiple changes: one-liner ecma immutability -

i changed const newcities = {...newstate.cities}; newcities[action.payload.id] = action.payload; newstate.cities = newcities; to one-liner newstate.cities = {...newstate.cities, [action.payload.id]: action.payload}; but how change this const newcities = {...newstate.cities}; action.payload.foreach(city=> newcities[city.id] = city); newstate.cities = newcities; to one-liner? ~= newstate.cities = {...newstate.cities, action.payload.map(city=> [city.id]: city)}; final solution: newstate.cities = {...newstate.cities, ...action.payload.reduce((o,a)=> ({...o,[a.id]:a}),{})}; previously forgot initialize reduce array =) old approaches: may way? newstate.cities = {...newstate.cities, ...action.payload.map(city=> ({[city.id]: city}) )}; updated: newstate.cities = {...newstate.cities, ...action.payload.reduce(city=> ({[city.id]:city}) )}; update (complete ugliness): newstate.cities = {...newstate.cities, ...action.payload.map((o)=>

mouseevent - Dragging a window in Javafx -

i tried many other links still not getting success in dragging undecorated window in javafx.this code: >main fxmlloader loader = new fxmlloader(getclass().getresource("videofxml.fxml")); stage.setscene(new scene( loader.load())); stage.initstyle(stagestyle.undecorated); videofxmlcontroller controller = loader.getcontroller(); controller.registerstage(stage); stage.show(); controller code: public class videofxmlcontroller implements initializable { int = 0 , j = 0; @fxml private anchorpane basepane; @fxml private mediaview mediaview; @fxml private button btnext; @fxml public pane dragnode; public void registerstage(stage stage) { effectutilities.makedraggable(stage, dragnode); } public void btnexit(actionevent event){ if(event.getsource() == btnext){ system.exit(1); } } @override public void initialize(url url, resourcebundle rb) { try { playvideo(); } catch (malformedurlexceptio

ios - CoreBluetooth - Generic Access (1800) for a Peripherial implemented on iPhone? -

i'm implemening peripherial role in ios app , able succesfully configure custom service being advertised , can accessed. now looks cannot change generic acccess profile values, device name - adding cbmutableservice configured "1800" in scan list still see "generic phone" value. is there way change it? your service isn't own peripheral. it's part of shared peripheral whole device (phone). don't directly control gap, provide services. that said, setting advertisement name of peripheral while you're in control straightforward. pass cbadvertisementdatalocalnamekey in startadvertising dictionary: [self.peripheralmanager startadvertising:@{ cbadvertisementdataserviceuuidskey : @[[cbuuid uuidwithstring:my_service_uuid]], cbadvertisementdatalocalnamekey : @"mydevice" }]; note things can control local name , service uuids. can't set things manufacturer data, transmit power, etc.

google earth - KML Show direction of movement on line -

Image
in google earth kml generate i'm trying indicate direction of movement along linepath arrow. such, each data point on line made palace mark, in specified arrow icon in style, , added heading element it. style section each place mark looks this: <style> <iconstyle> <icon> <href>...<href> </icon> <heading>[appropriate heading point]</heading> </iconstyle> </style> and works great when viewing path top-down perspective: as can see, arrows point along path in direction of movement, desired. however, if try view path more oblique angle, i.e. looking along path or across path rather down @ path, things change: now instead of pointing along path, arrows pointing angled downwards. correct, icons need rotated several degrees counter-clockwise. using same kml in both views, viewing angle in google earth has changed. how can fix this? if view icons looking straight

Why is there no arbitrary-sized binary integer type in Rust? -

rust has binary literals, binary formatter, , host of integer types, no explicit binary numeric type. 'almost-binary' integers it's true expected implementation of unsigned integer big/little-endian binary number in general purpose machines. however, that's far removed syntax of high-level language. example, if have eight-bit binary number 0000 0101 want treat syntactically primitive numeric type, have 2 problems: (1) character representation of number, , (2) type declaration number. if decide stick u8 , have add layer of string operations (in rust) or layer of vector operations ( in matlab , example) numbers displayed or declared literally, , have ensure binary representation converted equivalent in u8 . in situation, there's no way make direct statement 0000 0101 + 0000 0111 without machinery bubbling syntactic level, , that's binary types sizes happen line integer types. a 'true' binary type an example be, say, hypothetical type b3 , 3-b

r - Expand grid of all possible combinations within groups -

i facing following problem. have list of m&a transactions, each transactions includes data on (1) acquirer, (2) vendor, (3) target. data structured in way relationship can n:n:n , looks similar following: dealid acquirer target vendor 1 firma firmb firmc 1 firmd firme 2 ..................... so problem rows within deal have no meaning per se, e.g., firmd co-acquirer firmb. i need create possible acquirer-target-vendor combinations within each dealid . have managed expand grids expand.grid function or via merge . however, not know how expand grid of possible combinations within groups. you dplyr , expand tidyr . df <- read.table(text="dealid acquirer target vendor 1 firma firmb firmc 1 firmd na firme 2 firma na firmc 2 firmd na firme 2 firmg firmf firme",header=true,stringsasfactors=false) library(dplyr);library(tidyr) df%>% group_by(dealid)%>% expand(ac

Onkey function in Python Turtle not working for my input -

previously in program, used inputs in console player enter guesses want use onkey() function in python 3.6.1 turtle. want detect if player presses key , make string saying "guess='a'". want this: import turtle canvas=turtle.screen() t=turtle.pen() guess=0 def a(): guess='a' canvas.onkey(a,'a') canvas.listen() obviously defined function each letter of alphabet. after this, when pressing 'a' , putting 'print(guess)', not printing 'a'. the short answer forgot global statement in a() function it's reference guess local, not global. here's example implementation: import turtle def a(): global guess guess += 'a' def b(): global guess guess += 'b' def question(): print(guess) guess = '' canvas = turtle.screen() canvas.onkey(a, 'a') canvas.onkey(b, 'b') canvas.onkey(question, '?') canvas.listen() canvas.mainloop() you can

npm - Read and List all exports of an angular module -

the initial situation follows: in node_moduls folder of project there module called @example components want use in application. amount of components varies therefore it´s necessary state dynamically components included inside module. example.module.ts file looks this: import { ngmodule } '@angular/core'; import { ngbmodule } '@ng-bootstrap/ng-bootstrap'; import { firstmodule } 'example_path'; import { secondmodule } 'example_path'; import { thirdmodule } 'example_path'; import { fourthmodule } 'example_path'; const modules = [ firstmodule, secondmodule, thirdmodule, fourthmodule ]; @ngmodule({ imports: [ngbmodule.forroot(), ...modules], exports: [ngbmodule, ...modules], providers: [exampleservice] }) export class examplemodule { } the modules array contains components included. module gets imported app following app.module.ts import { browsermodule } '@angular/platform-browser'; import { ngmodule }

mysqli - Close connection in php using database class -

i have created database class in php, , want oop style not procedural style. here code when try close me error. function causing problem. class mysqldatabase { private $connection; public $message; /** * mysqldatabase constructor. */ public function __construct() { $this->open_connection(); } //object oriented style public function open_connection() { // constant comes form config $this->connection = new mysqli(db_server, db_user, db_pass, db_name); /* * "official" oo way it, */ if ($this->connection->connect_error) { die('connect error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); } else { $this->message = "success... " . $this->connection->host_info; } } public function close_connection(){ if (isset($this->connection)) { mysqli_cl

android - Cache image on react native -

is there library or maybe default react native components cache image url? i've tried react-native-cache-image there lot of issues react-native-fs , react-native-sqlite-storage , new react native dont know how fix them properly. there's prefetch() method built in image component.

spring - Unable to embedded tomcat war file using command prompt -

i have started add embedded tomcat in our spring web application. working fine in eclipse. trying start application using command prompt,it giving following exception no main manifest attribute ,in order-spring-mvc-web-1.0-snapshot.war in pom.xml file follows <dependency> <groupid>org.apache.tomcat.embed</groupid> <artifactid>tomcat-embed-core</artifactid> <version>${tomcat.version}</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.apache.tomcat.embed</groupid> <artifactid>tomcat-embed-logging-juli</artifactid> <version>${tomcat.version}</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.apache.tomcat.embed</groupid> <artifactid>tomcat-embed-jasper</artifactid> <version>${tomcat.version}</version> <scope>pro

blockchain - OCI Runtime Error when trying to submit an invoke/query to Hyperledger -

i'm trying this hyperledger fabric boilerplate provide running , when try submit query or invoke requests hfc this: 08:07:52.277 [dockercontroller] start -> erro 01c start-could not start container api error (500): {"message":"invalid header field value \"oci runtime error: container_linux.go:247: starting container process caused \\\"process_linux.go:245: running exec setns process init caused \\\\\\\"exit status 17\\\\\\\"\\\"\\n\""} 08:07:52.278 [chaincode] launch -> erro 01d launchandwaitforregister failed error starting container: api error (500): {"message":"invalid header field value \"oci runtime error: container_linux.go:247: starting container process caused \\\"process_linux.go:245: running exec setns process init caused \\\\\\\"exit status 17\\\\\\\"\\\"\\n\""} can explain me oci runtime , oci error 17 means? i'm running ubuntu 14.04, docker 1.12.2, fa

amazon web services - Shippable + AWS ECR : Push image - no basic auth credentials -

in shippable, configure integration aws ecr aws_access_key_id , aws_secret_access_key copied iam user created in aws policy amazonec2containerregistryfullaccess. when run build, error is, post https://623575552266.dkr.ecr.ap-southeast-1.amazonaws.com/v2/creditcard_server_dockerimg_rep/blobs/uploads/: no basic auth credentials any idea? regards hammer moving "docker push" post_ci push in yml file helps solve issue, command running inside of container former. push image ecr

javascript - How to prevent google analytics from getting traffic from localhost? -

i have issue. use google analytics in small project, , develop on localhost. of course call site again , again on local machine, pullutes analytics stats. can do? thats quit simple. you have possibility filter in analytics, option jungle in analytics bit confusing in opinion. you can in javascript: if (window.location.hostname != 'localhost' && window.location.hostname != '127.0.0.1') { //put analytics here }

javascript - Injecting style tag + angular component timing -

i have following piece of code: //load theme await theme.load('light'); $state.go('viewer'); theme.load loads sass file, compiles it, , injects style tag this: let themestyles = document.head.queryselector('style#theme'); if(!themestyles) { themestyles = document.createelement('style'); themestyles.setattribute('id', 'theme'); document.head.appendchild(themestyles); } themestyles.textcontent = await importer.import('sass/themes/'+theme+'.scss'); here's template viewer state: <map></map> <top-left-menu></top-left-menu> <loader></loader> and here's map component: .component('map', { controller: ['$element', mapcontroller] }); function mapcontroller($element, map) { this.$oninit = () => { console.log(document.head.queryselector('style#theme').textcontent); console.log($element[0].getboundingclientre

html - Why is my input box being forced onto another line? -

Image
i'm trying put input box next labels (reps sets , weight) keeps on being forced onto next line... how can force them onto same line? i've used inline-block in input css formatting , tried putting inline-block in label css still stays on next line. how can fix this? * { -webkit-box-sizing:border-box; -moz-box-sizing:border-box; -ms-box-sizing:border-box; -o-box-sizing:border-box; box-sizing:border-box; } html { width: 100%; height:100%; overflow:scroll; background: url("gym.jpg") no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } body { width: 100%; height:100%; font-family: 'open sans', sans-serif; } .login { position: absolute; top: 43%; /* form 45% top */ left: 50%; /* form 50% across screen*/ margin: -150px 0 0 -150px; /* position of form on screen */ width:300px; /* width of form */ height:

python - How to indent this line for pep8 compatibility -

how can indent line inside loop compatible pep8? for ii in range(len(file_time)): file_time[ii] = datetime.strptime(str(file_date[ii]) + " " + str(file_time[ii]),'%y/%m/%d %h:%m:%s.%f').replace(microsecond=0) i've tried 2 of options pep8 documentation offers: # aligned opening delimiter. foo = long_function_name(var_one, var_two, var_three, var_four) # hanging indents should add level. foo = long_function_name( var_one, var_two, var_three, var_four) but still same error: script.py:36:9:e122 continuation line missing indentation or outdented the hanging indent should work fine: for ii in range(len(file_time)): file_time[ii] = datetime.strptime( str(file_date[ii]) + " " + str(file_time[ii]), '%y/%m/%d %h:%m:%s.%f').replace(microsecond=0) you can improve on avoiding using str() conversions (you have strings, surely), , using zip() , list comprehension: file_time

How to cancel a cloudKit operation due to timeout in Swift? -

i looking how cancel cloudkit operation due given timeout setting? case use ckmodifyrecordsoperation upload changes icloud, if failed, save failed records local storage. something, operation take long time... so, want set timeout 60 seconds on operation, if timeout, cancel operation. use sleep func, though not in main thread, makes every added operation run @ least 60s. know not right solution. code below: let uploadoperation = ckmodifyrecordsoperation(recordstosave: recordstosave, recordidstodelete: recordidstodelete) uploadoperation.modifyrecordscompletionblock = { (savedrecords, deletedrecordids, error) in if let error = error { ... cloudkitmanager.persistentfailedrecords(savefailed, deletefailed) } } cloudkitmanager.privatedb.add(uploadoperation) sleep(60) if uploadoperation.isexecuting { uploadoperation.cancel() } i did search timeout on operation, answer focus on nsurlsession, no answer cloudkit operation. , tried own property "ti

jquery - how to return a string[] in autocomplete error System.String[] -

my script in head var productnames; $(document).ready(function () { $("#inputsuccess2").autocomplete({ source: function (request, response) { var texttyped = $("#inputsuccess2").val(); $.ajax({ url: "@url.content("~/products/fetchname")", datatype: "json", data: "search=" + texttyped, type: "get", contenttype: "application/json; charset=utf-8", success: function (data) { var msg = assessments_jqueryautocomplete.autocomplete(request.term).value; //(ajaxpro functions) response(msg.d); response($.map(data, function (item) { return { //value: '' + item }

android - How to create custom methods to swipe my view up and down, Espresso - ViewActions -

i want create custom methods swipe view , down, example 25% down/up, or other cases. tried override methods this: public static viewaction swipedown(){ return new generalswipeaction(swipe.fast, generallocation.center, generallocation.top_center, press.finger); } but it's top center , need shorter ones. wanted use new coordinatesprovider() : public static viewaction swipedown(){ return new generalswipeaction(swipe.fast, new coordinatesprovider() { @override public float[] calculatecoordinates(view view) { return new float[0]; } }, generallocation.top_center, press.finger); } ...and might answer, don't know how calculate coordinates. robotium has drag() function pretty similar swipe[direction] functions in espresso, uses defined coordinates. * @param fromx x coordinate of initial touch, in screen coordinates * @param tox x coordinate of drag destination, in screen coordina

ios - Async task don't change external variable. Swift 3 -

i can't save data url, because function in infinit loop. how fix it? code: func getregion2(){ let method = "region/" var url = serviceurl+method var myarray: [string]() while(url != nil){ alamofire.request(url).validate().responsejson { response in switch response.result { case .success(let data): let nexturl = json(data)["next"].stringvalue url = nexturl myarray = myarray + myarray print(nexturl) case .failure(let error): print("request failed error: \(error)") } } } print(myarray) } if run without "while", works fine. one possible solution combine recursive function , dispatch group (not tested): func getregion2(){ let method = "region/" var url = serviceurl+method var myarray: [string] = [] let group = dispatchgroup() f

php - Read value from database, echo -

very basic rookie struggling. echo doesnt show value, text. doing wrong? connect.php: <?php $connection = mysqli_connect('test.com.mysql', 'test_com_systems', 'systems'); if (!$connection){ die("database connection failed" . mysqli_error($connection)); } $select_db = mysqli_select_db($connection, 'swaut_com_systems'); if (!$select_db){ die("database selection failed" . mysqli_error($connection)); } ?> get.php: <?php require('connect.php'); $query2 = "select systemid user username=test"; $result2 = mysqli_query($connection, $query2); echo ( 'systemid: '.$result2); ?> assuming have connected database query incorrect. must wrap text values in quotes this <?php require('connect.php'); $query2 = "select systemid user username='test'"; $result2 = mysqli_query($connection, $query2); now mysqli_query s

Efficient SQL query with multiple selects -

i'm @ university , doing project have queries such as: select * recent_purchases customer_id in ( select customer_id customers name '%john%' ) i'm not sure if idiomatic way of doing things or if i'm missing "correct" way of doing - feels bit clunky. don't understand joins yet. sorry if stupid question. use inner join instead of sub-select in where clause: select * recent_purchases rp inner join customers c on c.customer_id = rp.customer_id c.name '%john%'

C++ alias template (typedef) with concepts? -

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4553.pdf gcc6: -fconcepts template<typename t> concept bool string = requires(t s) { { s.clear() } -> void; // etc. }; void print(const string& message); //void print(str message); // want str = const string& void test() { std::string str; print(str); } is there way declare str const string& ?

angular - Angular2-router: How to only change a parameter of a route? -

i want have following routes in application: export const routes: routes = [ { path: ':universityid', component: universitycomponent, children: [ { path: 'info', component: universityinfocomponent }, { path: 'courses/:status', component: coursesbystatuscomponent } ] } ] being on /1/info or /1/courses/open url, how change :universityid universitycomponent ? simple router.navigate(['../', 2], {relativeto: currentroute }) won't because redirects /2 , losing other information. using '../2/courses/open not option - can on child route @ moment. best come is: const urltree = this.router.parseurl(this.router.url); urltree.root.children['primary'].segments[0].path = '2'; this.router.navigatebyurl(urltree); but it's kind of ugly here code go along comment above using tuples: replicate pattern twice... shows how integrate these classes project. so:

ASP.NET MVC AJAX call return Error Message in parallel with Partial View -

the scenario in asp.net mvc (4,5) maxing ajax call returns partial view. based on different situations may need return error message - display user example.. my current approach this. in js: $.ajax({ url: url, type: "post", data:{ id: id}, success: function (response) { $("#container").html(response); }, error: function (er) { if (er.status == "405") {// someth } else if (er.status == "406") {// someth else } } }); in controller: public actionresult servermethod(int id) { if (id = 0) return new httpstatuscoderesult(405); if (id = 1) return new httpstatuscoderesult(406); //otherwise.. return partialview("view", model); } i aware hack , not proper solution.. there better way of doing this? you return jsonresult in fail cases. add properties want json. something this: public actionresult

how to know on which sim the incoming call is in my android app, in android studio. -

as can incoming call number in onreceive method using telephonymanager, there way number of receiving sim here? want both callers number , receivers number in app when call received . possible? see below, work me. public class incomingcallinterceptor extends broadcastreceiver { @override public void onreceive(context context, intent intent) { string callingsim = ""; bundle bundle = intent.getextras(); callingsim =string.valueof(bundle.getint("simid", -1)); if(callingsim == "0"){ // incoming call sim1 } else if(callingsim =="1"){ // incoming call sim2 } } }

Calabash console Android - query get all ids on screen -

in calabash console ios there command: ids the command displays element ids on current screen. for android can use command query("*") which displays views on screen, can manually through , find ids. but android equivalent command displaying ids? android calabash equivalent command: query("*",:id)

node.js - How to prevent multiple reaction by Google Cloud VM instances for one event from Firebase database? -

the problem: dosomething() function, invoked twice (by each running vm instance). how can react each event 1 vm instance? node.js script @ google cloud platform: function listenfornotificationrequests() { var requests = ref.child('some_node'); requests.on('child_added', function(requestsnapshot) { var request = requestsnapshot.val(); dosomething( request.type, function() { requestsnapshot.ref.remove(); }); }, function(error) { console.error(error); }); }; firebase-queue solves problem, @frank's comment pointed. multiple queue workers can initialized on multiple machines , firebase-queue ensure 1 worker processing single queue task @ time.

Script to shutdown Linux Hostwhen Virtualbox Guest Windows is shutdown? -

i'm wondering if it's possible auto shutdown linux host when windows guest in virtualbox shutdown. i'm guessing sort of script this? host: linux mint guest: windows 7 , windows 10. when user presses shutdown in windows if linux shutdown automatically shortly after guest has safely shutdown. you can use scrpit in cron, runs every 5 minutes or so. that: #!/bin/bash vm_name='your_vm' vboxmanage showvminfo $vm_name | grep -qe 'state: +powered off' && shutdown -h note, shutdown time, when vm not running.

ms word - Insert OOXML comment with track changes -

in word add-in inserting comments replacing selected text ooxml contains comment. with "track changes" turned on word registers 3 actions: delete+insert+comment. inserts paragraph break unsure if related. is there way have register comment action when inserting comment using word functionality? using rangeobject.insertooxml tried insert @ beginning , @ end of string without luck since 2 ooxml inserts not seem relate (which makes sense): word.run(function (context) { var range = context.document.getselection(); var prebody = '<?xml version="1.0" encoding="utf-8"?><pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlpackage"><pkg:part pkg:name="/_rels/.rels" pkg:contenttype="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="512"><pkg:xmldata><relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships&quo

Render html in springfox-swagger-ui -

i updated application running springfox-swagger2 , springfox-swagger-ui 2.5.0 use version 2.6.0. application's api documentation uses <li> , <b> , <br> tags, rendered correctly 2.5.0, version 2.6.0 <li> , <br> tags ignored swagger-ui. what have make springfox render html tags again? the tags used @ following positions: apiinfobuilder().description("here") @apioperation(notes="here") @apiresponse(message="here")

STS request with certificate authentication in SoapUI -

i have requestsecuritytoken request certificate signature , timestamp soapui security token use in other requests, have problem implement correctly. here correct request, different application, same certificate: <o:security s:mustunderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <u:timestamp u:id="_0"> <u:created>2016-10-24t14:35:54.851z</u:created> <u:expires>2016-10-24t14:40:54.851z</u:expires> </u:timestamp> <o:binarysecuritytoken u:id="uuid-e5fff67c-e3ce-4c63-86da-9661adfd6e0c-2" valuetype="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#x509v3" encodingtype="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#base64binary">...miifgtccbgmgawibagikoepzb(shortened)...</o:binarysecuritytoken> <signature xmlns=&quo