Posts

objective c - constraints cause an ambiguousLayout -

i have nswindow instance have setupui method. -(void) setupui { nsview* subview = [[nsview alloc] initwithframe:nszerorect]; subview.wantslayer = yes; subview.layer.backgroundcolor = [[nscolor greencolor] cgcolor]; [self.contentview addsubview:subview]; [self.contentview settranslatesautoresizingmaskintoconstraints:no]; [self.contentview addconstraint:[nslayoutconstraint constraintwithitem:self.contentview attribute:nslayoutattributeleading relatedby:nslayoutrelationequal toitem:subview attribute:nslayoutattributeleading multiplier:1 constant:0]]; [self.contentview addconstraint:[nslayoutconstraint constraintwithitem:self.contentview attribute:nslayoutattributetop relatedby:nslayoutrelationequal ...

Matlab/Octave: how to write n-dimensional zero padding algorithm without eval -

i write "syntactical sugar" octave or matlab zero-padding function, user sends n-dimensional object , vector of <= n entries. vector contains new, equal or larger dimensions object, , object zero-padded match these dimensions. dimensions not specified left alone. 1 expected use is, given example 5d block x of 3d medical image volumes, can call y = simplepad(x, [128 128 128]); and pad first 3 dimensions power of 2 wavelet analysis (in fact use separate function nextpwr2 find these dimensions) while leaving others. i have racked brains on how write method avoiding dreaded eval, cannot far find way. can suggest solution? here more or less have: function y = simplepad(x, pad) szx = size(x); n_pad = numel(pad); szy = [pad szx(n_pad+1:end)]; y = zeros(szy); indices_string = '('; n = 1:numel(szx) indices_string = [indices_string, '1:', num2str(szx(n))]; if n < numel(szx) indices_string = [indices_string, ',']; else ...

xml - XSLT Conditional Count -

new site. hoping can me figure out why code not working. used other posts on subject site close, can't see error. xslt: <!-- keyset based on subject (part number) --> <xsl:key name="key_partnumber" match="subject" use="."/> <xsl:template match="/"> <bom> <!-- each unique subject (part number) --> <xsl:for-each select="//markup/subject[generate-id() = generate-id(key('key_partnumber', .)[1])]"> <part> <xsl:attribute name="part_number"> <xsl:value-of select="."/> </xsl:attribute> <xsl:attribute name="count"> <xsl:value-of select="count(//markup[subject=.])"/> </xsl:attribute> </part> </xsl:for-each> </bom> </xsl:template> </xsl:stylesheet>...

ember.js - EmberJS access Ember.Object in Ember.Controller -

my purpose separate lot of boilerplate code in object, know how access object in controller. the code looks this. import ember 'ember'; "use strict"; var panel = ember.object.extend({ }); const person = ember.object.extend({ init() { this.set('shoppinglist', ['eggs', 'cheese']); } }); export default ember.controller.extend({ width: 0, height: 0, panel: null, you can create object person class , assign controller properties. arrays , objects defined directly on ember.object shared across instances of object. when new instance created, init() method invoked automatically. ideal place implement setup required on new instances. reference const panel = ember.object.extend({ }); const person = ember.object.extend({ init() { this._super(...arguments); this.set('shoppinglist', ['eggs', 'cheese']); } }); export default ember.controller.extend({ ...

PHP Session Not working and not giving any error -

in login.php have <?php require_once('connection.php'); $loginerr = ""; if(isset($_post['login'])) { $email = mysqli_real_escape_string($conn,$_post['email']); $pass = mysqli_real_escape_string($conn,$_post['password']); $sel_user = "select * register email='$email' , password='$pass'"; $run_user = mysqli_query($conn, $sel_user); $check_user = mysqli_num_rows($run_user); if($check_user>0){ $_session['email'] = $email; header('location: '.'index.php'); } else { $loginerr = "email or password not correct, try again!"; } } ?> basically if username , password matches creates session "email" , redirects index page. in navbar common pages index , other. have <ul class="nav navbar-nav navbar-right"> <?php if(!isset($_session['email'])) { ?> <li><a href="login">login</a>...

android - Get system time in millisecond using Buttons while recording video -

i recording video using camera2api button start recording.now when recording starts, need system time in milliseconds if press specific button(other start rec button ) . if not system time, @ least record time of video being recorded. the time should stored if press specific button. have tried using system.currenttimemillis() , systemclock.elapsedtime() , once recording starts , press specific button record time without stopping recorded ,it doesn't store time details , shows 0. below code using store time: case r.id.video: { if (misrecordingvideo) { stoprecordingvideo(); } else { starttsrecordingvideo(); starttime = system.currenttimemillis(); log.d(tag, "onclick:time "+starttime); switch (view.getid()){ case r.id.stop:{ stoptime= systemclock.elapsedrealtime()-starttime; log.d(tag, ...

jquery - How to place indicators in seperate columns and left and right controls in bottom of in bootstrap carousel -

Image
please consider code: <div class="container"> <div id="mycarousel" class="carousel slide" data-ride="carousel"> <!-- indicators --> <ol class="carousel-indicators"> <li data-target="#mycarousel" data-slide-to="0" class="active"></li> <li data-target="#mycarousel" data-slide-to="1"></li> <li data-target="#mycarousel" data-slide-to="2"></li> <li data-target="#mycarousel" data-slide-to="3"></li> </ol> <div class="carousel-inner" role="listbox"> <div class="item active"> <div class="row"> <div class="col-md-2"> <a href="#" class=...