Posts

Showing posts from June, 2011

android - Update recycle view -

i have trouble recycleview. want update recycleview using diffutil. can't understand why not work. diffutil public class consumablediffcallback extends diffutil.callback { private list<consumablebytask> oldlistofconsumablebytask; private list<consumablebytask> newlistofconsumablebytask; @override public boolean areitemsthesame(int olditemposition, int newitemposition) { return oldlistofconsumablebytask.get(olditemposition).getquantity() != newlistofconsumablebytask.get(newitemposition).getquantity(); } @override public boolean arecontentsthesame(int olditemposition, int newitemposition) { return oldlistofconsumablebytask.get(olditemposition).equals(newlistofconsumablebytask.get(newitemposition)); }} my adapter holder public class consumeholder extends recyclerview.viewholder { private button addconsumebtn; public consumeholder(view itemview) { /** * add/change data , send server. * after close consumablesbytas

python 2.7 - pandas shape issues when applying function returning multiple new columns -

i need return multiple calculated columns each row of pandas dataframe. this error: valueerror: shape of passed values (4, 2), indices imply (4, 3) raised when apply function executed in following code snippet: import pandas pd my_df = pd.dataframe({ 'datetime_stuff': ['2012-01-20', '2012-02-16', '2012-06-19', '2012-12-15'], 'url': ['http://www.something', 'http://www.somethingelse', 'http://www.foo', 'http://www.bar' ], 'categories': [['foo', 'bar'], ['x', 'y', 'z'], ['xxx'], ['a123', 'a456']], }) my_df['datetime_stuff'] = pd.to_datetime(my_df['datetime_stuff']) my_df.sort_values(['datetime_stuff'], inplace=true) print(my_df.head()) def calculate_stuff(row): if row['url'].startswith('http'): categories = row['categories'] if type(row['categories']) ==

hash - .NET Core 2 Password Hashing -

i looking hash password in core 2. use bcrypt, however, struggling find core implementations. try nuget package: https://www.nuget.org/packages/bcrypt-core/ install-package bcrypt-core -version 2.0.0

python - SqueezeNet on Tensorflow using my own image data -

i learning squeezenets right now, here paper interested: https://arxiv.org/pdf/1602.07360.pdf i interested in implementing squeezenets scratch own image data opposed imagenet implementations online, using tensorflow. is there implementation can follow learn more? thank you.

javascript - How do I access different iframes? -

Image
this question has answer here: how pick element inside iframe using document.getelementbyid 2 answers i working website uses different iframes on same webpage. wondering how can access , manipulate iframe not focused in on. the website has body allows users type in, , want use method innerhtml (javascript) set value of text in box. however, i'm having trouble accessing iframe. here javascript trying use, wasn't working intended.. getelementbyid not function of getelementsbytagname("iframe") document.getelementsbytagname("iframe")[1].getelementbyid("tinymce").innerhtml="hello, world!" here 2 iframes working with: cannot inspect page , change iframe hand, not answer looking for. thank clearing things me! edit: suggested, try document.getelementsbytagname("iframe")[1].document.getelementbyid("ti

python - Issues with implementing TensorFlow's MNIST example without feed_dict using a queue -

i came across tensorflow's deep mnist experts , wanted adapt more efficient use on gpus. since feed_dict seems incredibly slow, implemented input pipeline using tf.train.shuffle_batch , fifoqueue feed data model. here's gist stock implementation of tensorflow guide , here's gist attempt @ optimized implementation. now in example on tensorflow page, accuracy pretty approaches 1 after few thousand iterations. in code, aside queue implementation same model, accuracy seems oscillate between ~0.05 , ~0.15. further, loss reaches 2.3 after couple hundred iterations , doesn't decrease farther that. another noteworthy point: when make comparison original batch created , batch used in subsequent iterations, appear equivalent. perhaps issue lies in queuing/dequeuing i'm not sure how fix it. if sees issues implementation pointers appreciated! found solution. turns out tf.train.shuffle_batch implicitly implements randomshufflequeue . loading results of tf

EF Core 2.0 Migrations Not Recognized by Package Manager Console -

i'm trying add migration .net core 2.0 web app through package manager console in visual studio 2017. receive error: "the entityframework package not installed on project ". however, entityframeworkcore 2.0 installed. i've tried: the enable-migrations command (although don't believe necessary anymore) the add-migration command "install-package microsoft.entityframeworkcore.sqlserver -version 2.0.0" through pmc re-installing entityframeworkcore 2.0 through nuget package manager is there other configuration needs done somewhere else? since ef core migrations work on .net core 1.1 project issue related .net core 2.0? cheers! the ef tools command-line interface (cli) provided in microsoft.entityframeworkcore.tools.dotnet. from https://docs.microsoft.com/en-us/aspnet/core/data/ef-mvc/migrations

pdf - Is there a way to get this "send to printer" Java method to work? -

public static void sendpdftoprinter(string epsilon) { fileinputstream psstream = null; try { psstream = new fileinputstream(epsilon); } catch (filenotfoundexception ffne) { ffne.printstacktrace(); } if (psstream == null) { return; } docflavor psinformat = docflavor.input_stream.autosense; doc mydoc = new simpledoc(psstream, psinformat, null); printrequestattributeset aset = new hashprintrequestattributeset(); printservice[] services = printservicelookup.lookupprintservices(psinformat, aset); // step necessary because have several printers configured printservice myprinter = null; (int = 0; < services.length; i++) { string svcname = services[i].tostring(); system.out.println("service found: "+ svcname); if (svcname.contains("series")) { myprinter = services[i]; system.out.println("my pr

python - Generating random matrices for VAR(p) in PyMC3 -

i trying build simple var(p) model using pymc3, i'm getting cryptic errors incompatible dimensions. suspect issue i'm not generating random matrices. here attempt @ var(1), welcome: # generate data y_full = numpy.zeros((2,100)) t = numpy.linspace(0,2*numpy.pi,100) y_full[0,:] = numpy.cos(5*t)+numpy.random.randn(100)*0.02 y_full[1,:] = numpy.sin(6*t)+numpy.random.randn(100)*0.01 y_obs = y_full[:,1:] y_lag = y_full[:,:-1] pymc3.model() model: beta= pymc3.mvnormal('beta',mu=numpy.ones((4)),cov=numpy.ones((4,4)),shape=(4)) mu = pymc3.deterministic('mu',beta.reshape((2,2)).dot(y_lag)) y = pymc3.mvnormal('y',mu=mu,cov=numpy.eye(2),observed=y_obs) the last line should be y = pm.mvnormal('y',mu=mu.t, cov=np.eye(2),observed=y_obs.t) mvnormal interprets last dimension mvnormal vectors. because behaviour of numpy indexing implies y_obs vector of length 2 containing vectors of length 100 ( y_lag[i].shape == (100,) )

visual studio code - What version of Nancy package can we use for asp.net core 2.0? -

not sure put question i'm interested in nancyfx asp.net core 2.0 have tried use both 2.0.0-pre1878 version , 2.0.0-clinteastwood without luck. has managed use these? there reference application me play with? try: <itemgroup> <packagereference include="microsoft.aspnetcore" version="2.0.0" /> <packagereference include="microsoft.aspnetcore.hosting" version="2.0.0" /> <packagereference include="microsoft.aspnetcore.owin" version="2.0.0" /> <packagereference include="nancy" version="2.0.0-clinteastwood" /> </itemgroup> (specifically notice need microsoft.aspnetcore.owin ) is there reference application me play with? yes. https://github.com/nancyfx/nancy/tree/master/samples/nancy.demo.hosting.kestrel minimal example: using system.io; using microsoft.aspnetcore.builder; using microsoft.aspnetcore.hosting; using microsoft.exten

javascript - Extract a dinamic variable from an Ajax created element out of a foreach loop and perform another jQuery/Ajax call -

in profile.php there main elements can comment clicking post button. comments display in foreach loop. each comment has id created dynamically $comment->id . when new comment made, displayed in page without need refresh through ajax function. each comment has delete button has id of comment itself. comment can deleted without need of refreshing page using jquery , ajax. problem when new comment has been created ajax , want delete new comment without refreshing page (because there no edit feature). event bind newly created element jquery i’m using .on method not working. problem newly created element ajax event bind, jquery function has outside foreach loop. when outside foreach loop can’t access variable $comment->id (dynamically created) serves 2 purposes, create dinamic #id delete <p> tag can targeted jquery, , pass data through ajax delete_comment.php comment can erased database. in posts here in forum learned can variables outside loop creating array, feeding

allocating memory for n dimensional array -

i have found many threads giving answers allocating memory 2d , 3d arrays 1 below allocate memory 2d array in function c is there way generalise n dimensional array.

Concurrent inference with tensorflow -

looking @ cuda backend tensorflow, looks computation synchronized on single cuda stream (which think makes sense). this suggests 1 concurrently run inference on 2 different tensorflow models, sharing same gpu. each have own cuda stream , execute independently. is in fact supported use case? in particular, i'm curious if (1) expected work , (2) if there performance concerns. obviously latency may little higher if 2 models sharing same compute resources, i'm curious if there assumptions in tensorflow cause more significant performance penalties. thanks!

Spark Structured Streaming Delta Output Mode -

as of spark 2.2.0, there 3 output modes available, append, update, complete. will delta output mode provided in future release? currently, possible delta output? (with pure sql environment, read blog saying flatmapgroupswithstate flatmapgroups can achieve statelessness, correct me if wrong, , requirement express pure sql.)

node.js - How to make post request from angular to node server -

when print contents of request on node server, can't see user data anywhere. here node server: var http = require('http'); http.createserver( function (request, response) { console.log(request); }).listen(8080); console.log('server running @ http://127.0.0.1:8080/'); and here angular2 code: import { component, oninit } '@angular/core'; import { httpclient } "@angular/common/http"; import { http, response, headers , requestoptions } "@angular/http"; import 'rxjs/add/operator/retry'; // able retry when error occurs import { observable } "rxjs/rx"; @component({ selector: 'app-root', templateurl: './app.component.html', styleurls: ['./app.component.css'] }) export class appcomponent implements oninit{ title = 'angular test'; user = { id : 1, name : "hello"}; constructor (private http: http) {} ngoninit(): void { let headers = new headers({ '

Android build.gradle : Running a custom task before dependencies are generated -

in android project, have dependency on jar file generated different project uses ant build system. in build.gradle, using ant.importbuild('otherprojectpath/build.xml') { anttargetname -> 'sc' + anttargetname } the ant target want call build. since appending 'sc' while importing, task names become scbuild. want when run gradlew assemble, first scbuild should run , copy generated jar file other project in project's libs folder , use jar while compiling. so have created gradle task this task buildoutputjar(dependson: ['scbuild']) { copy{ 'otherprojectpath/bin/output.jar' 'libs' } } and in build.gradle have added prebuild.dependson buildoutputjar my dependencies in build.gradle has line compile filetree(dir: 'libs', include: ['*.jar']) now when run gradlew assemble first time, ant task run in other project, jar created , copied in project's libs folder while compilin

bash - How to select text in a file until a certain string using grep, sed or awk? -

i have huge file (this sample) , select lines "ph_gufac1083" , after until reach 1 doesn't have code (in example ph_gufac1139 ) >uce_353_ph_gufac1083 |uce_353 tttagccatagaaatgcagaaataattagaagtgccattgtgtacagtgccttctggact gggctgaaggtgaaggagaaagtatcatactatccttgtcagctgcaagggtaattactg ctggctgaaattactcaacatttgtttataagctccccagagcatgctgtaaatagattg tctgttatagtccaatcacattaaaacgctgctccttgcaaactgctacctcctgttttc tgtaagctagacagagaaagcctgctgctcacttactgagcaccaagcactgaagagcta tgtttaatgtgattgttttcattagctcttctctgtctgatattacatttataatttgct gggcttgaagactggcatgttgcattgctttcatttactgtagtaagagtgaatagctct @ >uce_101_ph_gufac1083 |uce_101 ttgggctttatttccaccttaaaatctttacctggccgtgatctgttgttccattactgg agggcaaaaatgggaggaattgtctgggctaaattgcaattaggcagccctgagagaggc tggcaccagttaacttgggatattggagtgaaaaggcccgtaatcagccttcggtcatgt agaacaatgcataaaattaaattgacattaatgaataattgtgtaatgaaaatggaagag gagagttaattgcatgttacagtgagtgtaatgcctagataaccttgcatttaatgctat tcttagccctgctgccaagacttctacagagcctctctctgcaggaagt

typescript - Check all checkboxes within a FormArray - Angular 2 Reactive Form -

i have angular 2 reactive form list of checkboxes data bound. works fine, need add button check checkboxes. heres how formgroup configured: private buildform() { this.groupform = this._formbuilder.group({ bookid: this._formbuilder.control(null), startdate: this._formbuilder.control(null), grouptotal: this._formbuilder.control(null), chaptergrouping: this._formbuilder.control("all"), groupchapters: this.buildchapters() }); } private buildchapters() { const chapters = this.chapters.map(chapter => { return this._formbuilder.control(chapter.selected) }); return this._formbuilder.array(chapters); } heres html: <div class="form-group"> <label for="">select chapters</label> <div *ngfor="let chapter of formchapters.controls; let i=index" class="checkbox"> <label> <input type="checkbox" [formcontrol

ionic framework - ionic2 How to put an element outside of modal -

Image
i want add element outside of modal using ionic2 image below. the area surrounded blue border element want add. area surrounded red border custom modal have created. custom modal.html <ion-header> <ion-navbar class="select-header"> <ion-buttons left (click)="close()"> <button ion-button> <img class="close" src="assets/images/close.png"/> </button> </ion-buttons> <ion-title>{{title}}</ion-title> </ion-navbar> </ion-header> <ion-content class="region-selection"> <div class="select-all"> <img class="selection not-selected" src="assets/images/region/check_none.png"/> <span>{{title}}</span> </div> <div class="select-region"> <ion-row class="regions-row" *ngfor=&quo

session - java sshd multiple command -

if have actual solution problem appreciate it. far implementation have used close session 1 of channel "connected" ever means. need able script ssh interaction meaning need result of operation still alive channel i'm not looking command "cmd1;cmd2;cmd3" type .. the best example can think of if trying browse trough file system. if each command new session going going no since @ each new session go square one. in command line ssh session remain open when type operation why java implementation differ approach beyond me. next step if cant find answer use command shell java , interacting there instead of using java ssh libraries.. public void connect() { session session; try { session = createconnectedsession(); java.util.logging.logger.getlogger("test").log(level.info,"isconnected "+session.isconnected()); bytearrayoutputstream output = new bytearrayoutputstream(); channel channel = s

spring - Different validation process for JPA saving and form validation with same entity class -

i have user entity class mapped table in database. in class, there password field like: @data @entity @table(name = "users", schema = "...") public class userentity { ... @column(name = "password", nullable = false, length = 64) @notnull @size(min = 8, max = 64) private string password; ... } this class represents user in whole project source codes. but problem registration process: client passes password in registration form controller validates user password @valid service encodes password encrypt algorithm. service tries save user calling repository's save() then before saving database, validation occurs again user saved database there 2 validation process, form validation , entity validation. but should have different validation strategies. i've implemented 2 different validators related constraint annotations. what simple way make so? hibernate validation (ri bean validation) all

python - how to split and concat pandas dataframe -

i have datetime index dataframe of pandas this: b c a_1 b_1 2017-07-01 00:00:00 1 34 e 9 0 2017-07-01 00:05:00 2 34 e 92 2 2017-07-01 00:10:00 3 34 e 23 3 2017-07-01 00:15:00 4 34 e 2 5 2017-07-01 00:20:00 5 34 e 4 3 i want split , concat axis=0 , result this c req _1 2017-07-01 00:00:00 e 1 9 2017-07-01 00:05:00 e 2 92 2017-07-01 00:10:00 e 3 23 2017-07-01 00:15:00 e 4 2 2017-07-01 00:20:00 e 5 4 2017-07-01 00:00:00 e 34 0 2017-07-01 00:05:00 e 34 2 2017-07-01 00:10:00 e 34 3 2017-07-01 00:15:00 e 34 5 2017-07-01 00:20:00 e 34 3 so, have this: first, select df[['c','a','a_1']] , df[['c','b', 'b_1']] . map columns, , concat result. it's complicated,is there built-in method in pandas this? or faster method? because have thousands of columns concat final result. edit af

php - Best design method to access container functions -

i'm new slim3 , followed tutorial functions in container want access anywhere in code. here's index.php file initalise everything: <?php use \psr\http\message\serverrequestinterface request; use \psr\http\message\responseinterface response; // require loading vendor libraries installed composer require 'vendor/autoload.php'; $config['displayerrordetails'] = true; $config['addcontentlengthheader'] = false; $app = new \slim\app(["settings" => $config]); $container = $app->getcontainer(); // monolog initalisation. use write: $this->logger->addinfo("what want write here"); $container['logger'] = function($c) { $logger = new \monolog\logger('eq_logger'); $file_handler = new \monolog\handler\streamhandler("logs/app.log"); $logger->pushhandler($file_handler); return $logger; }; // database connections $container['dbteacher'] = function ($c) { $pdo = new pdo(

sql - Get "You can only create a user with a password in a contained database." error when login as sa -

just got simple query: create user [xxxxx] password='xxxxxx' but when login sa, error: you can create user password in contained database but when login windows credentials, runs fine. do need set on sa account? thanks!

android - Open SDK manager in Eclipse -

when want open sdk manager in eclipse, got error report: [ time - android sdk] warning when loading sdk: warning: ignoring add-on 'addon-google_apis-google-24': unable find base platform api level '24' i have add path of sdk path in system, how solve it?

codeigniter - invalid Invalid argument supplied for foreach() in controller -

i have problem invalid argument supplied foreach(); here controller: public function insertsebab(){ foreach($this->input->post('id_konsultasi') $se) { $data = array( 'id_konsultasi' =>$se, 'kd_sebab' => $this->input->post('kd_sebab') ); $konsultasi = $this->class_model->insertsebab($data); $json =$konsultasi; echo json_encode($json); } } where wrong code,how resolve it? try public function insertsebab() { if (is_array($this->input->post('id_konsultasi')) || is_object($this->input->post('id_konsultasi'))) { foreach ($this->input->post('id_konsultasi') $se) { $data = array( 'id_konsultasi' => $se, 'kd_sebab' => $this->input->post('kd_sebab') ); $konsultasi = $this-&

perl - CPAN command line not showing downloading error but not downloading the correct file -

i behind corporate proxy after configuring proxy able download files using browser. cpan command line throwing error starting file content, when deleting , cpan fetches same empty or blank file. pfb cpan error: c:\users\mohit>cpan app::cpanminus looks don't have c compiler , make utility installed. trying install dmake , mingw gcc compiler using perl package manager. may take a few minutes... ppm.bat install failed: can't find package provides mingw looks installation of dmake , mingw has failed. not able run makefile commands or compile c extension code. please check internet connection , proxy settings! loading internal null logger. install log::log4perl logging messages cpan: term::ansicolor loaded ok (v4.06) cpan: win32::console::ansi loaded ok (v1.10) cpan: storable loaded ok (v2.56_01) reading 'c:\perl64\cpan\sources\authors\01mailrc.txt.gz' cpan: compress::zlib loaded ok (v2.07) ...................................................................

jquery - Javascript alert cancel button not working in safari -

i'm trying set sequence of events when user click on radio button triggers form submit. in addition, want give user java warning asking them confirm selection click ok, redirect php page, or cancel , stay on current page , nothing. have, reason when user click cancel on alert in safari, form still submits. is radio onclick conflicting actual script? how add alert script? <form name="confirmform" id="confirmform" method="post" action="update_confirm.php"> <div id="confirmgroup"> <input type="radio" name="email_confirm" id="emailgroup1" value="verify" class="verify" onclick="return confirm('update email status?');" > <label class="emailgroup" for="emailgroup1">verify</label> <input type="radio" name="email_confirm" id="emailgroup2" value="good" class="good"

javascript - The sessions only store data for a second before being changed the last sessions value -

when click sort date created button, string date passed function sort() , alert 1 (see code) prints string date . string date stored in session in first if statement , alert 2 prints date . issue date being stored temporarily , alert 3 alerts service , no matter type. if change order of if statements, last if statement's string somehow stored in session. <?php session_start(); ?> <html> <head> <script> function sort(type){ alert('<?php echo $_session['sort']; ?>'); ///alert 1 if (type == 'date'){ <?php $_session['sort'] = 'date'; ?> alert('<?php echo $_session['sort']; ?>'); ///alert 2 } else if (type == 'cost'){ <?php $_session['sort'] = 'cost'; ?> alert('<?php echo $_session['sort']; ?>'); } else if (type == 'service'){ <?php $_session[

scala - Cast a map column of dataframe to struct column -

i have dataframe, , 1 of column's type map. map comes udf , existing columns of dataframe. question is there way transform column struct type ? way, i'm using scala 2.10, , column of map has more 50 fields. don't want use case class . ahead. since there not enough information how data looks , kind of output want, i'm writing answer based on understanding of question. val df = sqlcontext.sql(""" select map(1,"a" ,2,"b" ,3,"c" ,4,"d" ,5,"e" ,6,"f" , 7,"g" ,8,"h" ,9,"i" ,10,"j" ,11,"k" ,12,"l" ,13,"m" , 14,"n" ,15,"o" ,16,"p" ,17,"q" ,18,"r" ,19,"s" ,20,"t" , 21,"u" ,22,"v" ,23,"w" ,24,"x" ,25,"y" ,26,"z" )as mapcol """) you can write udf convert map seq type read st

Download a pdf file using Jquery -

i want download pdf file using jquery , code works correctly little irritating problem pdf file loads browser instead of giving saveas dialog, don't know how solve code that var timeout; $(document).on("click", "#downloadbtn", function(e){ cleartimeout(timeout); var textname = $('input[name=txtdatecheck]').val(); var optionselect = $('input[name=timeselected]').val(); settimeout(function() { $.ajax({ type: 'post', url: "checkurl.php", data: { checkurl: textname, optionid: optionselect}, datatype: 'text', success: function(response) { //alert(response); e.preventdefault(); //window.open(response.trim(), '_blank'); window.location.href = response.trim(); } }); }, 200); });

javascript - unable to read xml file within project folder using AJAX request -

iam trying read simple xml file placed xml file in project root folder still when im accessing xml file says 404 not found dont know why if nay 1 know please me. this content in newfile.xml <?xml version="1.0" encoding="utf-8"?> <catalog> <cd> <title>empire burlesque</title> <artist>bob dylan</artist> <country>usa</country> <company>columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>hide heart</title> <artist>bonnie tyler</artist> <country>uk</country> <company>cbs records</company> <price>9.90</price> <year>1988</year> </cd> </catalog> index.html <!doctype html> <html> <head> <meta charset="iso-8859-1"> <title>insert title here</title> </head> <body> <button onclick="loadxml()"

How to use @produces in JSON object spring boot -

is possible use @produces json objects in spring boot? or there way implement this: jsonobject j_session = new jsonobject(); j_session.put("session_id_j", session_jid); j_session.put("j_app", "j"); j_session.put("rest_id_j", rest_id); here simple example: restcontroller class: import java.util.arraylist; import java.util.list; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod; import org.springframework.web.bind.annotation.restcontroller; import com.websystique.springboot.model.user; @restcontroller @requestmapping("/api") public class restapicontroller { @requestmapping(value = "/user/", method = requestmethod.get, produces = { "application/json" }) public list<user> listallusers() { list<user> users = new arraylist<user>(); users.add(new user(1, "sam", 30, 70000));

c# - Regular Expression for exact match of either 4 integers or 2 doubles in a line -

i trying identify lines in file have either 4 integer or 2 double values. regular expression below: var match = new regex(@"^(?<values>(((\d+\s*){4})|(\d+\.\d+\s*){2}))$"); sample of lines in file getting parsed: element 1 2 8 24 2 1 1 0 1 129 2 2 0 0 30.200001 1000.0000 208 0 0 0 0 0 0 0 ..... ..... here, regular expression matches correctly above lines no 4 & 5. that's ok. but, it's matching line no 3 (0 1 129). that's problem me. kindly suggest: why regular expression matching line no 3. correct regular expression matches either 4 no. of integers or 2 no. of double values in line. i think you're looking for: ^(((\d+\s+){3}\d+)|(\d+\.\d*\s+\d+\.\d*))\s*$ tested here . explanations ^( ((\d+\s+){3}\d+) # 4 numbers separated @ least 1 space | (\d+\.\d*\s+\d+\.\d*) # 2 floats separated @ least 1 space )\s*$ # optional spaces @ end of line (e.g., line 4) the error in initial attempt lack of mandatory space

swift - iOS How to get Points to Pixel Conversion Ratio? -

this question has answer here: get device image scale (e.g. @1x, @2x , @3x) 1 answer accessing content scalefactor / multiplier? 2 answers some devices have 1x ratio, others have 2x, , newest ones have 3x. there way retrieve ratio count without hard coding it? sorry repeated question, apparently suck @ googling. found out answered posted this. > uiscreen.main.scale

ios - tableview didSelectRowAtIndexPath cannot detect any click -

Image
i create uitableview , connect datasource , delegate in storyboard , put uitableviewdelegate , uitableviewdatasource on class. , of course uinavigationcontrollerdelegate make push uiviewcontroller . i called self.tableview.datasource = self self.tableview.delegate = self on viewdidload . this didselectrowatindexppath: code: func tableview(_ tableview: uitableview, didselectrowat indexpath: indexpath) { //let cell = tableview.dequeuereusablecellwithidentifier(reusecontentfreeidentifier, forindexpath: indexpath) as! freetableviewcell print("didselectrowatindexpath eshops") let row = indexpath.row print("business row:\(hcpartner[row])") performsegue(withidentifier: "eshopsurl", sender: self) } when clicked cell row, not detect click , not show log of print("didselectrowatindexpath eshops") . why didselectrowatindexpath: not work? tried on swift 2, works. in swift 3 did not work. what wrong code? correct c

fetching parameters from a jenkins job in java code -

Image
i have parameterised jenkins job accessing plugin. inside plugin's code in java, require these parameters using have trigger job in jenkins. not able fetch these parameters , high priority issue now. ahve tried multiple solutions available on stackoverflow, eg., tried accessing environment variables didn't received param's value. e.g., parameter 'repos' , need value, have tried : system.getproperty("repos"); but returns null. also, tried : map<string, string> env = system.getenv(); (string envname : env.keyset()) { system.out.format("%s=%s%n", envname, env.get(envname)); } but prints jenkins' environment variables , not job's parameters. i referring value passed in text box beside param: "url" in below picture. please assist. to best of knowledge, jenkins parameters exposed environment variables. however, if use build system maven launches java sub-

jquery - desciption text after hovering a profile picture -

i want display text after hovering profile picture. have made 'title 'tag cannot show text in different paragraphs. there alternative ways this? here css code: .tooltip { display:none; position:absolute; border:1px solid #333; background-color:#161616; border-radius:5px; padding:10px; color:#fff; font-size:12px arial; } here html code: <table style="width:100%"> <tr> <td><a><img src="http://2017.igem.org/wiki/images/2/26/andrew.png" width="200" height="200" class="mastertooltip" title="name: ching yuet to; major/year: cell , molecular biology/3 "></a></td> <td><img src="http://2017.igem.org/wiki/images/d/de/venus.png" width="200" height="200"></td> <td><img src="http://2017.igem.org/wiki/images/8/84/cathy.png" width="200" height="200"></td> </tr

swift - UIAlertController - Order of actions -

this question has answer here: unable choose order of buttons in uialertcontroller 1 answer i wanna show alert window pressing on button. usual thing. i'm confused try show button "awesome" @ first, "cancel" button stay first. how can fix it? let alert = uialertcontroller(title: "hello world", message: "testing", preferredstyle: .alert) let action = uialertaction(title: "awesome", style: .default){(_) in print("awesome")} let cancel = uialertaction(title: "cancel", style: .cancel, handler: nil) alert.addtextfield(configurationhandler: nil) alert.addaction(action) alert.addaction(cancel) alert.actions.foreach( { (action) in print( action.title! ) } ) present(alert, animated: true, completion: nil) irregular order of buttons changing order not work default position of cancel butto

web scraping - How to restart the Python script automatically if it is frozen/stopped? -

i running python script in background web-scraping data tables infinity loop, if there internet connection problem or other little error freeze, program , script stopping. how can avoid error acceptable automation? (i don't want use cmd or task scheduler, want solve problem inside python script)

java - Arduino not sending integers properly -

i trying send integers 0 through 10 arduino uno android device. however, arduino not sending integers separately, rather sending cluster (sometimes 2 @ time). want able send integer every 5 milliseconds , not delay longer that. ideas? arduino code: #include <softwareserial.h> const int rx_pin = 8; const int tx_pin = 9; softwareserial bluetooth(rx_pin, tx_pin); char commandchar; void setup (){ bluetooth.begin (9600); serial.begin(9600); } void loop () { if(bluetooth.available()){ commandchar = bluetooth.read(); switch(commandchar){ case '*': for(int = 0; < 11; i++){ bluetooth.print(i); delay(5); } break; } } } android code: public void run() { initializeconnection(); byte[] buffer = new byte[256]; // buffer store stream int bytes; // bytes returned read() while (true) { try { if(mmsocket!=null) {

centos - WARNING: Module not found [ssl] -

i trying install geoserver on centos folling installation documentation in geoserver website, have got error "warning: module not found [ssl]" after line "geoserver data dir /usr/share/geoserver/data_dir", can problem me? this warning , not prevent operation. believe error common geoserver bundle comes jetty. if need configure https support, i'd recommend investigating tomcat or wildly.

ios - How do I display list of contributors of my shared CKRecord? -

Image
i shared record user or other user shared record me. present following controllers: because code: if let record = record { if #available(ios 10.0, *) { let share = ckshare(rootrecord: record) let controller = uicloudsharingcontroller(share: share, container: cloudassistant.shared.container) self.present(controller, animated: true) } } will present: how can achieve it?

c# - Is it possible to add Feature Service to IPageLayout and IMap? -

can load feature service or map service published in arc server ipagelayout , imap ? i'm new arcgis. can't understand ipagelayout , imap . please me can. public void addscalebar(ipagelayout pagelayout, imap map) { if (pagelayout == null || map == null) { return; } ienvelope envelope = new envelopeclass(); envelope.putcoords(0.2, 0.2, 1, 2); // specify location , size of scalebar iuid uid = new uidclass(); uid.value = "esricarto.alternatingscalebar"; // create surround. set geometry of mapsurroundframe give location // activate , add pagelayout's graphics container igraphicscontainer graphicscontainer = pagelayout igraphicscontainer; // dynamic cast iactiveview activeview = pagelayout iactiveview; // dynamic cast iframeelement frameelement = graphicscontainer.findframe(map); imapframe mapframe = frameelement imapframe; // dynamic cast

php - How to configure .env file avoid spam mail in Laravel 5.4 -

i working laravel 5.4. when sending mail local server mail going inbox folder working fine, configure file .env following :- mail_driver=smtp mail_host=smtp.gmail.com mail_port=587 mail_username=email mail_password=password mail_encryption=tls after shift live server , configure .env file following:-> mail_driver=sendmail mail_host=smtp.gmail.com mail_port=465 mail_username=null mail_password=null mail_encryption=ssl mail receive in spam folder.how avoid spam folder. here controller function function createschool(request $request){ $this->validator($request->all())->validate(); $user = $this->create($request->all()); if($user){ $mailinformation = $request->all(); if($mailinformation){ mail::to($request->user()) ->cc($mailinformation['email']) ->send(new schoolregistration($mailinformation)); } return re

android - Material.io provides wrong sizes? -

i've been using icons material.io android project. used 48dp resolution , put files in correct drawable folders, when ran "inspect code" got following warnings: mdpi: expected 32x32, 48x48 hdpi: expected 48x48, 72x72 xhdpi: expected 64x64, 96x96 xxhdpi: expected 96x96, 144x144 xxxhdpi: expected 128x128, 192x192 why material.io provide wrong sizes? (or why android studio produce warning if sizes correct?)

How to tokenize Java8 program using antlr -

currently using java8.g4 of java 8 repo: https://github.com/antlr/grammars-v4 however, wondering how can modify java8.g4 file to make sure if encounter multiple new lines tokenize 1 of them ? refer to: parsing newlines, eof end-of-statement marker antlr3 , can add new line parse tree (by adding newline: ('\r\n'|'\n'|'\r') .g4 file. however, if have multiple new lines, multiple lines parsed , added tree not want. hope can me out! thanks i guess mean whitespaces not kept in token list produced lexer, right? happens when whitespaces skipped in grammar. check e.g. ws: [ \t] -> skip; and change to ws: [ \t] -> channel(hidden); this way whitespaces kept on hidden channel , can read them via commontokenstream instance, not in way (just skip).

html - How to navigate to home page change screen size in Angular 4? -

Image
i'm building website angular 4 , asp.net. when enter website, can see home page fit mobile size (which want). then when navigate orders page, looks this: orders page but when navigate home page again orders page, changes screen , not fit mobile @ all. code: app.component.html <app-nav_mobile></app-nav_mobile> <app-header></app-header> <app-navbar></app-navbar> <router-outlet> </router-outlet> <app-footer></app-footer> nav_mobile.component.html <div id="preloader" class="signature-dierk"> <div id="status"></div> </div> <!-- end : preloader --> <!-- mobile navigation : starts --> <nav class="mobile-nav signature-dierk"> <ul class="slimmenu"> <li><a [routerlink]="['/home']">home page</a></li> <li><a [routerlink]="