Posts

Showing posts from September, 2013

R won't let me open saved file, says "no such file or directory" -

i started using r couple of weeks ago, i'm new student in research group uses program. my supervisor gave me file ending .idx open in r , work on. able open yesterday, took me 45 minutes! thought i'd figured out how yesterday, again today r telling me file doesn't exist. yesterday used list.files , file.exists , file magically seemed exist. please can tell me how reopen saved files r on console? r won't let me open saved file, says “no such file or directory” it sounds don't have working directory set directory contains file in question. try typing getwd() @ r command prompt , see path returns. chances are, it's not path file is. in case, can either move file r's current working directory, or can type setwd("/path/to/the/file") @ r command prompt set path (obviously, /path/to/the/file should replaced path directory containing file).

php - Laravel 5.5 package phpunit tests can't change namespace -

it's taken bit of troubleshooting figure out what's going on. given what's happening, feel might case of "you're doing wrong." i'm developing package laravel 5.5. pull package application , run units tests. put methods , properties in testcase.php (the base class) reduce redundancy. change namespace minimize chance of conflicts. when that, world explodes. when enter $ phpunit or vendor/bin/phpunit terminal looks it's something, goes clean command prompt $ . having said that, if put namespace tests\* right world. what expected way test package? let me know what, if anything, more helpful in describing issue.

html - Navbar menu dropdown not working (won't drop down when clicked) -

when on mobile or when resize browser navbar dropdown menu not dropping down when clicked. have put navbar code here elaborating issue. in advance help! <nav class="navbar navbar-default navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="mynavbar"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="collapse navbar-collapse" id="mynavbar"> <ul class="nav navbar-nav navbar-right"> <li><a href="#home">home</a></li> <li><a href="#about">about</a></li> <li>&

python - How to programmatically check eps file version? -

i want check programmatically (without opening adobe app) if eps file compatible illustrator version 8 or 10. preferably using python or bash script. portable esp files 7-bit ascii lines less 256 characters long. lines can terminated of following combinations of characters: cr, lf, cr lf, or lf cr. i don't know flavors of eps different versions of illustrator can read, first line of formatted file should contain looks this:      %!ps-adobe-3.0 epsf-3.0 according version 3.0 of encapsulated postscript file format specification in chapter 2 guidelines creating eps files . see chapter 3 titled guidelines importing eps files . so @ least partially answer question, read first line of file , check epsf version says is.

php - Symfony's DomCrawler does not find a specific tag -

i'm using domcrawler data google play page , works in 99% of cases, except stumbled upon page can not find specific div. check html code , there. code is $autoloader = require __dir__.'\vendor\autoload.php'; use symfony\component\domcrawler\crawler; $app_id = 'com.balintinfotech.sinhalesekeyboardfree'; $response = file_get_contents('https://play.google.com/store/apps/details?id='.$app_id); $crawler = new crawler($response); echo $crawler->filter('div[itemprop="datepublished"]')->text(); when run specific page php fatal error: uncaught invalidargumentexception: current node list empty. however, if use other id, desired result. page breaks domcrawler as correctly figured out, doesn't happen in english version, in spanish one. one difference spot comment user saying නියමයි ඈ . there seems bothering crawler there. if replace null characted ( \x00 ) empty string, correctly gets you're looking for: <?

Css Bootstrap 4 - how to have vertical tabs on wider screens and horizontal on smaller -

i trying make tabs vertical on wider screens , horizontal on smaller screens, not sure how can achieve that. have tried adding flex-md-column , flex-lg-column nav tabs: <ul class="nav nav-tabs flex-md-column flex-lg-column" id="mytab" role="tablist"> <li class="nav-item"> <a class="nav-link active" id="info-tab" data-toggle="tab" href="#info" role="tab" aria-controls="info" aria-expanded="true"><i class="ion-compose"></i> info</a> </li> <li class="nav-item"> <a class="nav-link" id="stats-tab" data-toggle="tab" href="#stats" role="tab" aria-controls="stats"><i class="ion-arrow-graph-up-right"></i> statistics</a> </li> <li class="nav-item"> <a class="nav-link&qu

c - First time creating Stack.One line is printing twice.Why? -

i have updated previous code said there 1 last problem. don't know why there line keeps on printing twice when run code. and line is: printf("\nenter values of x:"); and code is: #include <stdio.h> #include<stdlib.h> typedef struct node{ int a; struct node* next; }node; node* create(node* s) { s=null; printf("\n empty stack created\n"); return s; } node* insert(node* s,int x) { if (s==null) { s=malloc(sizeof(node)); s->a=x; s->next=null; } else { node* temp=malloc(sizeof(node)); temp->a=x; temp->next=s; s=temp; } return s; } node* print(node* s) { while(s!=null) { printf("%d",s->a); s=s->next; } return s; } node* delete(node* s) { node* s1; if(s==null) { printf("trying delete empty list"); } else { s1=s->next; printf("element deleted %d",s->a); s->next=null; free(s); } return s1; } node

php - Laravel Omnipay 2checkout "Bad request - parameter error" -

Image
i'm using laravel, omnipay integrate 2checkout , checkout controller code. <?php namespace app\http\controllers; use illuminate\http\request; use omnipay\omnipay; class checkoutcontroller extends controller { public function order(request $request) { $gateway = omnipay::create('twocheckoutplus_token'); $gateway->setaccountnumber('xxxxxx'); $gateway->settestmode(true); $gateway->setprivatekey('xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); $gateway->setcart( [ [ "name" => "demo item", "price" => "4.99", "type" => "product", "quantity" => "1", "recurrence" => "4 year", "startupfee" => "9.99" ] ] ); $formdata = [ 'firstname' => 'te

ios - Retrieving data from a web page to be used in UIPickerView (Swift) -

in swift, created uipickerview using storyboard, conforms datasource , delegate protocols. however, data want put each row courses appear on cornell page: https://classes.cornell.edu/browse/roster/fa17 if press each course link, url changes include /aas (etc.) , adds extension url, don't know how each course either. is there way extract course names page , place them each row picker? or simpler, there way extract elements website can put them array?

Unable to Edit new layout in Sharepoint 2013 Designer (64 bit) -

i created new layout in design manager. admin on site full control. in sp designer 2013 get: server error: file may not moved, deleted, renamed, or otherwise edited. i built working in sandbox editing display of web-parts, want mimic under main layout area. how around error edit document? can edit corresponding html document. thank you,

python - How to add up two randints -

every time show "wrong". when answer right. from random import randint rnd1 = [randint(0,9)] rnd2 = [randint(0,9)] print([rnd1] + [rnd2]) res = int(input("result:")) if res == rnd1 + rnd2: print("right") else: print("wrong")

r - Extract elements from a list given the positions in another list -

i have list of matrices follow. listmat <- list(a=matrix(1:9, ncol=3), b=matrix(10:18, ncol=3)) listmat $a [,1] [,2] [,3] [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 $b [,1] [,2] [,3] [1,] 10 13 16 [2,] 11 14 17 [3,] 12 15 18 i want extract 1st , 2nd column of matrix , 3rd column of b. these positions given in list. listposition <- list(a=c(1,2), b=c(1)) listposition $a [1] 1 2 $b [1] 1 is there way extract elements rather using following command listmat[["a"]][,1:2] listmat[["b"]][,1] we can use map extract corresponding matrix elements in list using index in listposition map(function(x, y) x[, y, drop = false], listmat, listposition)

Virtualbox host only network only show ipv6 address -

i have ubuntu vm on virtualbox host-only network. when run ifconfig notice vm's address have ipv6 address. wrong? need ipv4 address vm. here vm's interface my vbox version 5.1.26

How to enter data from json array file when multiple array present in json file using java -

i reading input data json file. json file structure `{ "testloginpage":[ { "username":"hellotest", "password":"password1234", }, ], "emailtest":[ { "fromemailaddress":"noreply@test.com", "testemailserver":"111.11.11.1", "testusername":"test", "testpassword":"test", }, { "fromemailaddress":"aaaa@test.com", "testemailserver":"22.22.22.2", "testusername":"aaaa", "testpassword":"aaaa",

sql - What is the benefit of embedding pg_advisory_lock inside SELECT vs explicitly using another statement? -

i cannot understand example https://www.postgresql.org/docs/9.1/static/explicit-locking.html where embed lock along select clause select pg_advisory_lock(id) foo id = 12345; -- ok what selecting foo ? understand better if like select pg_advisory_lock(123); //lock select * foo id = 12345; where explicitly locking block. can't seem find explanation on how use advisory lock anywhere explains differnece between both embedding , explicitly on own statement. doing select pg_advisory_lock(123); create lock on 123 , whether valid value or not. doing select pg_advisory_lock(id) foo id = 123; create lock if there entry id 123 in table foo. let's note line found in pg_locks doc : the actual meaning of keys user which tends imply select/from/where syntax associating lock existing row, while lone select syntax broader meaning, application-wide lock.

javascript - What is the best way to store JSON data within mobile hybrid app? -

there few options in market store json data within mobile app (indexeddb, websql, etc.). i'm looking best solution (which not deprecated , supported commonly used browsers) store json data , use within mobile app created presentation / demo / portfolio purposes. my static json file structure looks follows: { "products": [ .. several records ], "users": [ ... several records ], "factdata": [ ... few thousand records ] } the question is, technology / method should use store above json data , not worry support ? local storage provides simple, synchronous key/value pair storage, performs poorly large amounts of data , possibly lock ui. websql depracated can still use it. can store around 5mb of data. indexeddb not supported on ios. i probabaly go websql now, other ways of storing data in json. maybe create database , api , make authorized rest calls it

Grails Spring Security Core 3.2.0.M1 - secure annotations not working -

i have upgraded grails , spring security latest (3.3.0.rc1 , 3.2.0.m1 respectively) following of migration paths annotations no longer work. control follows through not authorised callback (grails.plugin.springsecurity.adh.errorpage). have own list of enum backed permissions use populate list of authorities being correctly loaded user object no longer work in annotations using hasrole expression follows; @secured(["hasanyrole('perm_view_reports'"]) other expressions working fine such following @secured("authentication.name == 'sys_admin'") @secured("hasrole('perm_view_reports')") i don't suppose has had similar experience latest spring security release grails. remember above has worked until upgraded don't see in migration path suggests there might problem system. thanking suggestions in advance. this came down "role_" prefix being mandatory again in new spring security 3.2.0.m1 release. can se

SVG Line Animation Reversed in Safari? -

i've built pretty simple spinning animations site, , great in chrome/firefox, reason, they're animating in reverse in safari. i've played around changing values of offsets, nothing seems working. there workaround @ all? .sq { width: 50vw; height: auto; padding: 2.2vw; } .path { stroke-dasharray: 250; stroke-dashoffset: 250; animation: line 3s ease forwards; } @keyframes line { { stroke-dashoffset: -250; } { stroke-dashoffset: 0; } } <div class="sq"> <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 81.32 81.32"> <defs> <style> .cls-1{fill:#202020;opacity:0.1;} .path{fill:none;stroke:#ef3f44;stroke-miterlimit:10;stroke-width:5px;} </style> </defs> <g id="94" data-name="94"> <g id="objects"> <circle cx="40.66" cy="40.66" r="27.17"

TensorFlow DataSet API causes graph size to explode -

i have bug data set training. i'm using data set api so: self._dataset = tf.contrib.data.dataset.from_tensor_slices((self._images_list, self._labels_list)) self._dataset = self._dataset.map(self.load_image) self._dataset = self._dataset.batch(batch_size) self._dataset = self._dataset.shuffle(buffer_size=shuffle_buffer_size) self._dataset = self._dataset.repeat() self._iterator = self._dataset.make_one_shot_iterator() if use training small amount of data well. if use data tensorflow crash error: valueerror: graphdef cannot larger 2gb. it seems tensorflow tries load data instead of loading data needs... not sure... any advice great! update... found solution/workaround according post: tensorflow dataset api doubles graph protobuff filesize i replaced make_one_shot_iterator() make_initializable_iterator() , of course called iterator initializer after creating session: init = tf.global_variables_initializer() sess.run(init) sess.run(train_data._iterator.initiali

'python -m django' gives conflicting messages in virtualenv -

i created virtualenv: virtualenv --python=/usr/local/bin/python2.7 workoutpy2.7 i'm working on workout diary web app, hence name. installed django nonrel in it: pip install git+https://github.com/django-nonrel/django@nonrel-1.5 and djangotoolbox django nonrel: pip install git+https://github.com/django-nonrel/djangotoolbox and mongodb engine: pip install git+https://github.com/django-nonrel/mongodb-engine i assumed django installed in virtualenv. typed: python -m django and got following output: /users/sahandzarrinkoub/documents/programming/web/django/workoutpy2.7/bin/python: no module named django.__main__; 'django' package , cannot directly executed what mean? record, same thing happens package install in way. have @ this: (workoutpy2.7) sahands-macbook-pro:workoutpy2.7 sahandzarrinkoub$ pip install pymongo requirement satisfied: pymongo in ./lib/python2.7/site-packages (workoutpy2.7) sahands-macbook-pro:workoutpy2.7 sahandzarrinkoub$ python

ruby - sass/scss not compiling in linux ubuntu terminal to css -

hello have problem compile scss file css file in directory in terminal ubuntu linux. sass --watch /media/f/web_work_projects/_sass/mystyle.scss:/media/f/web_work_projects/_css/mystyle.css sass watching changes. press ctrl-c stop. i, [2017-09-14t00:57:47.902622 #14277] info -- : celluloid 0.17.3 running in backported mode. [ http://git.io/vjf3j ] argumenterror: wrong number of arguments (2 1) use --trace backtrace.

html - Image behaving as if it was only a portion of original image -

sorry if bit confusing try explain. sum have image behave according small part of image. for example, imagine image of solar system, 1000px width , 1000px height. sun being part of image located 150 pixels top , 150 pixels left , having shape of square of 250 pixels. i sun part of image occupy full div : img { width: 100% } though if full image of solar system embedded in div. , not centered around sun. to achieve want have : img { position: absolute; width: 400%; top: pixel value; left: pixel value; } but headache when original div image resides not fixed. so wondering if existed allows set image top left value , bottom right value, , having rest of image overflow , adjust same way portion of image set boundaries. using background-image in css instead of <img /> tag make simple , responsive: .sun { width: 25%; height: 0px; padding-top: 25%; background-image: url(https://i.imgur.com/3lhaydt.png); background-size: 400%; /* 400% *

javascript - How to populate a modal form with ajax and spring MVC -

i have jsp see result saved @ data base in table on browser options edit, delete each row. want able click edit link, fetch data particular customer data base spring mvc , hibernate , show on edit modal user can see data , know edit. below code snippet, line edit customer detail link edit customer. not sure here go, wheather call ajax function , how ajax function like? , how ajax call modal? i saw solution( spring mvc populate modal form ) doesnt show how modal called populate values ajax. or there other way? please help, thanks. <c:foreach var="customer" items="${customers}" varstatus="status"> <tr> <td><c:out value="${status.count}" /></td> <td><a title="go company certificate detail">${customer.customername}</a></td>

Writing an array in a file in ruby -

this question has answer here: ruby combining array 1 string 2 answers how write array in ruby keeping elements of array in same line? e.g. a= ["tom", "jerry"] puts gives: tom jerry but need have: tom, jerry thank help! you can use join method on array this. a= ["tom", "jerry"] puts a.join(", ") interestingly, can multiply array string wish separate elements by: a= ["tom", "jerry"] puts * ", " both of above give same output: tom, jerry

javascript - Jasmine testing with $httpBackend for Angularjs controller -

i made angular project — simple music library application. allows display, edit or delete data albums. communication server made via api. now, project works pretty good, need write unit tests. problem is, can't find clear tutorial on how in case. let me provide code. albums.controller.js: 'use strict'; angular.module('albums').controller('albumscontroller', ['albumservice', '$location', function (albumservice, $location) { var vm = this; albumservice.getdata().then(function successcallback(data) { vm.albums = data; }, function errorcallback(data) { console.log('error!'); console.log(data); }); }]); albumservice.service.js: 'use strict'; angular.module('core').service('albumservice', function ($http) { this.getdata = function () { var promise = $http.get('/albums/list') .then(function successcallback(r) { re

unity3d - Unity Video script not playing sound -

im using plugin unity asset store , trying video playing sound - not. here script plays video -- using unityengine; using unityengine.video; namespace complete360tour { [addcomponentmenu("complete360tour/media/videomediareactor")] public class videomediareactor : monobehaviour, imediaswitchreactor<videomedianodedata> { //----------------------------------------------------------------------------------------- // inspector variables: //----------------------------------------------------------------------------------------- [header("assignment")] [serializefield] protected mediaview mediaview; [serializefield] protected videoplayer videoplayer; //----------------------------------------------------------------------------------------- // private fields: //----------------------------------------------------------------------------------------- private rende

node.js - hapijs - serve static files from directory handler with variable path name -

i'm trying in routes file using hapijs + inert plugin { method: 'get', path: '/l/{path*}', handler: { directory: { path: (req) => { const defaultdir = '/public'; return gethostinfo(req.headers.host).then((d) => { if (!d || !d.directory) return defaultdir; return d.directory; }).catch((e) => { return defaultdir; }); } } } }, path parameter expects string, array or function returns string or array...in case, function returns promise...so doesn't work. tried adding hapi-as-promised package modifies reply function support then method did't work. basically want serve static assets 1 directory or depending on host header value. well, thing have in mind hack. first, have make extension point make async stuff: server.ext({ type: `onprehandler`, method: (request, reply) => { const defaultdir = '/public';

jquery - Value of type “jQueryStatic<TElement extends Node>” is not callable -

issue: visual studio intellisense yells @ $ : value of type “jquerystatic<telement extends node>” not callable example code (all instances of $ , really): const emaildiv = $("<div>", { "class": "email-item" }); $(containerid).append(emaildiv); setup: visual studio 2017 asp.net core web application definitelytyped jquery 3.2.1 jquery 3.2.1 ts 2.3 resharper 2017.1.3 tsconfig.ts: { "compileroptions": { "lib": [ "es2015", "es2015.iterable", "dom" ], "noimplicitany": true, "noemitonerror": true, "removecomments": false, "sourcemap": true, "target": "es5" }, "files": [ // bunch of local files... ], "compileonsave": true } .csproj: <propertygroup> <targetframework>netcoreapp2.0</targetframework> <typescri

xamarin.forms - Show map pin on side of mapview when pin out of bounds -

we have requirement drop pins on map, , requirement show pin on side of mapview when out of bounds, , pin should move along border of mapview when panning show direction pin located. we have implemented kind of this, involves moving pin each time map moves simulated location based on current bounds of map, , not performant. anyone seen implementation of this, or suggest alternate options moving pin on pan event? using google maps control in xamarin.forms app.

local - What is the issue regarding this package? -

i want install file in zip format site. [ http://www.dgkl.de/pa106975_en_var100] the name of file reference limit estimator (program zip-file, version 20170609) but zip file includes programming files in r , excel file. wondering how can bring programming codes r. tried many ways none of them work. advice highly appreciated. manin error no such file , directory.

xamarin.forms - Get Children of VisualElement? -

is there simple, generic way children of xamarin.forms.visualelement object? i see there iviewcontainer<t>.children. seems bit crazy try casting visualelement iviewcontainer<whatever> , see if flies. , not every visualelement implements interface.

c++ - Initializing class variables in nested classes -

i'm new c++ classes, , have questions nested classes. what know classes in c++ set of variables , functions set 'private' default. when create class, object created. i understand basic concepts of constructors. i know can make 'classes' variable in 'class', known nested class , can't figure out how done exactly. if create nested class, create object itself, , objects class variables inside nested class? i'm having problems initializing class variables in nested class using constructors. for example class point { int xpos; int ypos; } let's created class containing 2 int variables. class rectangle { point upleft; point lowright; } then, created rectangle class having 2 'point class' variables. rectangle rec1; then, created object rec1 . how can initialize 2 xpos , 2ypos using constructors in rectangle class? you need add constructor, here simple example: class point { public: point(int x, i

python - Selecting rows in a dataframe where columns match and taking max -

so simplified version of full problem, more people if it's more generic. so i'm using pandas dataframe that's arbitrarily big (large enough not write bunch of simple conditionals). looks this: member group score 1 1 56 1 1 432 1 1 43 2 1 44 2 1 555 2 2 90 2 2 101 and list goes on quite while. goal compare score of rows have both same member , group row, , take not max of rows how of max , store in new data frame. example, finished data frame like: member group max max 1 1 432 376 2 1 555 511 2 2 101 11 i have no idea , have not found hint how compare rows without saying df['member'==1] , there many different values member , group me this. thank in advance! as far understand, want know max in each group , how max greater score in first row of group: df1 = df.groupby([&q

proper regex to tokenize sentence with leading dash -

here regex i'm using tokenizer: [^a-za-z\'-]+ however, if want apply sentence this: -this test. -yes, it's test self-consciousness result ['-this', 'is', 'a', 'test', '-yes', "it's", 'a', 'test', 'for', 'self-consciousness'] there leading - ahead of this , yes . there gonna way eliminate leading - ? maybe modification on regex i'm using? you'd need qualify dash in middle. since using negatives split up, have allow wrong dashes matched. (?:[^a-za-z'-]|(?<![a-za-z'])-|-(?![a-za-z']))+ https://regex101.com/r/ql7lwq/1 (?: [^a-za-z'-] # not of these | # or, (?<! # allow dash if not preceded 1 of others [a-za-z'] ) - | # or, - # allow dash if not followed 1 of others (?! [a-za-z'] ) )+

linux - Move Assignment operator c++ -

i cannot tell wrong move assignment operator, here function. don't think grabbing data correctly, because when run test random negative number , "you're program has stopped working) virtual linkedlist<t> &operator=(linkedlist<t> &&other) { cout << " [x] move *assignment* operator called. " << endl; // delete our own elements listnode<t> *temp1 = _front; while (temp1 != nullptr) { listnode<t> *n = temp1->getnext(); delete temp1; temp1 = n; } // grab other data ourselves listnode<t> *temp2 = other._front; while (temp2 != nullptr) { addelement(temp2->getvalue()); temp2 = temp2->getnext(); } // reset pointers nullptr other._front = nullptr; other._end = nullptr; other._size = 0; other._last_accessed_index = 0; other._last_accessed_node = nullptr; return *this; } test code-

ios - A duplicated segue processing with UIStoryBoardSegue between two UIViewControllers -

Image
this question has answer here: table view controller duplicate in ios swift 1 answer i have 2 screens. first based on uitableview instance. when tap cell, function tableview(_:didselectrowat:) triggers: func tableview(_ tableview: uitableview, didselectrowat indexpath: indexpath) { selectedemg = selectedemergencies[indexpath.row] performsegue(withidentifier: "showmoreinfoaboutemg", sender: self) } here storyboard: but in fact, segue "showmoreinfoaboutemg" duplicates , second screen. i can cut performsegue(withidentifier:sender:) , transition between screens work correctly. need transfer data uitableviewcell instance remote uiviewcontroller 's property. otherwise this: prepare(for:sender:) starts work earlier tableview(_:didselectrowat:) , remote view controller gets nil object cell. tips, guys? the d

supervisord - ImportError: No module named 'gunicorn' -

i use gunicorn +supervisor deploy django project in ubuntu server. weather.conf [group:weather_station] programs=site [program:site] directory=/home/user/project/weather_station command=/home/user/.local/bin/gunicorn -c /home/user/project/weather_station/gunicorn.conf.py -p gunicorn.pod weather_station.wsgi autostart=true autorestart=true stdout_logfile=/var/log/supervisor.log however,when execute /home/user/.local/bin/gunicorn -c /home/user/project/weather_station/gunicorn.conf.py -p gunicorn.pod weather_station.wsgi it can work but when use command sudo supervisorctl reload then error message in status file "/home/user/.local/bin/gunicorn", line 7, in gunicorn.app.wsgiapp import run importerror: no module named 'gunicorn' is there suggestion? thanks!!!

Loop In game of Rock, Paper, Scissors in C++ -

i'm doing game of rock paper scissors i'm not sure have loop correct let alone rest of code. continue expected ')' @ end of input , expected '(' @ end of input , ';' @ end of input , expected '}' @ end of input. teachers aren't if few pointers on how that'd great, thank you. heres have. #include <iostream> #include <string> using namespace std; int main() { char choice = 'n'; { { char playerone; char playertwo; cout << "player 1: enter r rock, p paper, or s scissors:" << e$ cin >> playerone; cout << "player 2: enter r rock, p paper, or s scissors:" << e$ cin >> playertwo; switch (playerone) { case 'r': case 'r': switch (playertwo) { case 'r': case 'r': cout << "tie" << endl; break; case 'p':

ios - Navigate to New View Controller after Animation is Completed in Swift 3.0 -

Image
i have (2) goals: example #1: navigate original view controller new secondviewcontroller after following animation completed in swift 3.0 (i.e. user not have press button , app moves secondviewcontroller after animation completed) example #2: navigate original view controller new secondviewcontroller after time delay of 5 seconds in swift 3.0 (i.e. user not have press button , app moves secondviewcontroller after timer reaches 5 seconds - no animation involved in second example, timer) here code example #1: import uikit class viewcontroller: uiviewcontroller { @iboutlet weak var imageview: uiimageview! override func viewdidload() { super.viewdidload() var imagesname = ["image_1","image_2","image_3","image_4","image_5","image_6","image_7","image_8","image_9","image_10","image_11","image_12","image_13","image_14","image_

mysql - Why shouldn't I use mysql_* functions in PHP? -

what technical reasons why 1 shouldn't use mysql_* functions? (e.g. mysql_query() , mysql_connect() or mysql_real_escape_string() )? why should use else if work on site? if don't work on site, why errors like warning: mysql_connect(): no such file or directory ? the mysql extension: is not under active development is officially deprecated of php 5.5 (released june 2013). has been removed entirely of php 7.0 (released december 2015) this means of 31 dec 2018 not exist in supported version of php. gets security updates. lacks oo interface doesn't support: non-blocking, asynchronous queries prepared statements or parameterized queries stored procedures multiple statements transactions the "new" password authentication method (on default in mysql 5.6; required in 5.7) all of functionality in mysql 5.1 since deprecated, using makes code less future proof. lack of support prepared statements particularly important provide

math - AppleScript to determine if a shape has been warped or scaled -

i'm making script determine if shape has been warped or scaled. starts making list of lengths of line in 1 shape, so. set noofsides text returned of (display dialog "enter number of sides:" default answer "") set sidevalues {} set repeatnumber 0 repeat noofsides times set repeatnumber repeatnumber + 1 set currentsidevalue text returned of (display dialog "enter length of line " & repeatnumber & ":" default answer "") set end of sidevalues currentsidevalue end repeat it same thing second, edited shape. gives me 2 lists different variables. determine if 2 shapes similar, each 'before' line divided each 'after' line has same. example, triangle: firstline1/secondline1 = firstline2/secondline2 = firstline3/secondline3 is there way without having following: try set primevariable1 first item of primesidevalues set primevariable2 second item of primesidevalues set primevariable3

vuejs2 - How do I call a getter from another getter in Vuex? -

consider simple vue blog. i'm using vuex datastore , need set 2 getters : getpost getter retrieving post id, listfeaturedposts returns first few characters of each featured post. datastore schema featured posts list references posts ids. these ids need resolved actual posts purposes of showing excerpts. store/state.js export const state = { featuredposts: [2, 0], posts: [ 'lorem et ipsum dolor sit amet', 'lorem et ipsum dolor sit amet', 'lorem et ipsum dolor sit amet', 'lorem et ipsum dolor sit amet', 'lorem et ipsum dolor sit amet', ] } store/getters.js export default getpost = (state) => (postid) => { return state.posts[postid] } export default listfeaturedposts = (state, getters) => () => { console.log(getters) // {} return state.featuredposts.map(postid => getters.getpost(postid).substring(0, excerpt_length); } store/index.js import vue 'vue' import vuex 'vuex

How do you write a program in python that creates pyramids based on user input? -

write program input height , outputs triangle of numbers given height: each line should contain positive integer n​ denoting height of 1 triangle inputting -1 should terminate value output blank line after every test case sample input: 3 2 4 -1 sample output: 1 12 123 1 12 1 12 123 1234 this code inp = [] while true: = int(input()) if == -1: break inp.append(i) def pyramid(n): return [list(range(1, i+1)) in range(1, n + 1)] result = [pyramid(i) in inp] in result: j in i: print(j) print('\n')

amazon web services - AWS S3 .NET SDK: DeleteObjectsRequest return OK, but objects not deleted -

i have following code delete objects in s3 "folder": deleteobjectsrequest req = new deleteobjectsrequest(); req.bucketname = "mybucket/my foder 1/my folder 2"; req.addkey("photo1.jpg", null); req.addkey("photo2.jpg", null); deleteobjectsresponse response = client.deleteobjects(req); response.httpstatuscode ok, , response.deletedobjects.count 2. however, actual objects still there. why? this bucket had versioning turned on suspended before created folder deleted. i worked out. should this: deleteobjectsrequest req = new deleteobjectsrequest(); req.bucketname = "mybucket"; req.addkey("my foder 1/my folder 2/photo1.jpg", null); req.addkey("my foder 1/my folder 2/photo2.jpg", null); req.addkey("my foder 1/my folder 2/", null); deleteobjectsresponse response = client.deleteobjects(req);

send data with Ajax to Spring Controller -

i have page jsp want send data using ajax controller . doesn t work .i got error in console : error 404 . my controller : @requestmapping(value="/sendemail",method=requestmethod.post) public void sendemail(){ } @requestmapping(value="/sendemail",method=requestmethod.get) public void sendemailget(){ } in page jsp : <div class="row col-xs-10 col-md-6 form-group"> <!-- <textarea rows="5" class="form-control"></textarea> --> <springform:textarea path="message" name="message" class="form-control" rows="5"/> </div> <div class="row"> <span class="col-xs-12 col-md-4"> <a class="btn btn-info navbar-btn navbar-right" id="sendemail">envoyer email</a> </span> </div>

android - NotificationCompat.Builder does not set Large and small icon -

this how setting icons. both icons not set. default android icon shown large icon. how solve this? notificationcompat.builder mbuilder = new notificationcompat.builder(context) .setlargeicon(bitmapfactory.decoderesource(context.getresources(), r.mipmap.ic_launcher)) .setsmallicon(r.drawable.ic_alarm_on_white_24dp) .setcontenttitle(context.getresources().getstring(r.string.app_name)) .setticker(mtitle) .setcontenttext(mtitle) .setcontentintent(mclick) .setautocancel(true) .setonlyalertonce(true); use notificatio.builder instead of notificationcompat.builder notification.builder nb = new notification.builder(context) .setcontenttitle("title") .setcontenttext("content") .setautocancel(true) .setlargeicon(largeicon) .setsmallicon(r.drawable.small_icon) .setticker(s.gettext()); notificationmanager nm =

python - Pandas, join row from target file based on condition -

i need merge row target dataframe source dataframe on fuzzy matching condition has been developed, let's call method fuzzytest . if fuzzy test returns true , want merge row target file source file when matched. so left join target company passes fuzzytest when compared source company. source dataframe source company 0 cool company 1 bigpharma 2 tod kompany 3 wallmart target dataframe target company 0 kool company 1 big farma 2 todd's company 3 c-mart 4 supermart 5 smallstore 6 shoprus hopefully after mapping through fuzzytest output be: source company target company 0 cool company kool company 1 bigpharma bi

python - How do I scrape an argument of a javascript function inside of a javascript html tag? -

i want scrape out arguments of dygraph function(the long line of dates mainly), points on graph. until now, scraping other kinds of tags gettable using findall function, however, looks need dig deeper that in problem. <script type="text/javascript"> g = new dygraph( // containing div document.getelementbyid('dailysubscribers'), // csv or path csv file. "date,daily subs\n" + "2016-07-31,1\n" + "2016-08-01,1\n" + "2016-08-02,0\n" + "2016-08-03,1\n" + "2016-08-04,0\n" + "2016-08-05,2\n" + "2016-08-06,10\n" + "2016-08-07,5\n" + "2016-08-08,1\n" + "2016-08-09,1\n" + "2016-08-10,2\n" + "2016-08-11,0\n" + "2016-08-12,0\n" + "2016-08-13,0\n" + "2016-08-14,0\n" + "2016-08-15,1\n" + "2016-08-16,1\n" + "2016-08-17,0\n" + "2016-08-18,0\n" + "2016-08-19,1\n"

email - Mail attachment in Perl -

im using perl code send attachment in mail, pipe delimited file, in body of mail. first line of pipe delimited file getting printed on body of mail. file name dj & content want print in body of mail is: absdcf|123werd_123|new|98760| qyebdhymjf|kei7653|age|376494-58| hfhytyrj|nfhry657|drop|dfghfy(953)| gfdhj|rt54t67t|drop|dddy28| but mail shows 1st line in body: absdcf|123werd_123|new|98760| please guide me!

regex - Find string to regular expression programmatically? -

given regular expression, is possible find string matches expression programmatically? if so, please mention algorithm that, assuming string exists. bonus question: give performance/complexity of algorithm, if able. ps: note not asking this: programmatically derive regular expression string . more asking reserve problem. assume define regular expressions this: r := <literal string> (rr) -- concatenation (r*) -- kleene star (r|r) -- choice then can define recursive function s(r) finds matching string: s(<literal string>) = <literal string> s(rs) = s(r) + s(s) s(r*) = "" s(r|s) = s(r) for example: s(a*(b|c)) = s(a*) + s(b|c) = "" + s(b) = "" + "b" = "b" . if have more complex notion of regular expression, can rewrite in terms of basic primitives , apply above. example, r+ = rr* , [abc] = (a|b|c) . note if you've got parsed regular expression (so know syntax tree),

sublimetext2 - Full file name in Sublime Text when there are a lot of files -

Image
i have opened lot of files in sublime text. difficult read file names. showing few letters of each file name. attaching screen shot better understanding. how can see full name of each file? wanted fit full name of each file on screen. don't want hover on file see full name. you edit packages/theme - default/default.sublime-theme , change tab_min_width higher value (and save , restart st or resize window see change) or use different theme has wider minimum tab width. however, i'd highly recommend upgrading st3 - there new setting added in build 3048 called enable_tab_scrolling keep tabs wider, , enable see them all.