Posts

Unable to set up Jinja2 with Django -

i've installed django 1.9.7, , have pythons 3.4.3 , 2.7.10 on ubuntu. these steps i've followed: made new project django-admin startproject testproject cd testproject/testproject made app within project django-admin startapp testapp made directory templates in app mkdir testapp/templates , added basic index.html template in there edited settings.py change template backend django.template.backends.jinja2.jinja2 , editing line 57 of default settings file, , add testproject.testapp installed_apps ; templates section therefore this: templates = [ { 'backend': 'django.template.backends.jinja2.jinja2', 'dirs': [], 'app_dirs': true, 'options': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth...

java - Error Expected int but given string -

i'm getting error. it's saying it's expecting int, i'm giving string. i'm not sure how fix this. int dnastrandlength, stranddna; scanner dnainfo = new scanner (system.in); system.out.println ("please enter dna strand!"); stranddna = dnainfo.next(); dnastrandlength = stranddna.length(); you have declare stranddna string . int dnastrandlength; string stranddna; scanner dnainfo = new scanner (system.in); system.out.println ("please enter dna strand!"); stranddna = dnainfo.next(); dnastrandlength = stranddna.length(); if reading int have nextint() scanner.

azure service fabric - Targeting a stateless replica on the same node when communicating over the ServiceProxy client -

Image
i have deployed 2 stateless , singlepartion microservices service fabric cluster, hosted on azure. want hook communication between these services this: my masterdata web api service should prefer communicate masterdata serviceproxy service replica/instance on same node when calling method via serviceproxy client. if there's no replica/instance available on same node, connect node. code looks this: var serviceclient = serviceproxy.create<imasterdataserviceproxy>(new uri("fabric:/sfapp/masterdataserviceproxy")); var result = await serviceclient.getmasterdata(); but communication this: the serviceproxy connects randomly chosen replica/instance (due targetreplicaselector.default ). i'm missing communication options " targetreplicaselector.prefersamenode ". there way handle manually? here's explanation: how can reach specific replica of stateless service if still want it, either use http listeners on localhost or use sta...

php - Class 'DOMPDF' not found after downloading via Composer -

i used composer download latest (v0.7). copied entire downloaded 'vendor' directory web server, error: class dompdf not found if change use namespaces error 'fatal error call undefined function dompdf()' several hours trying desperately find missing. never had problems using composer before, (it takes care of dependencies), not in case! ideas appreciated. sample code: <?php require "../vendor/autoload.php"; $dompdf =\dompdf(); // used new dompdf(); $dompdf->loadhtml($html); $dompdf->render(); $dompdf->stream("sample.pdf", array("attachment"=>0)); ?> solved myself.. in case interested example given on github page missing critical line i added: use dompdf\dompdf; , fixed it. require "../vendor/autoload.php"; use dompdf\dompdf; $dompdf =\dompdf(); // used new dompdf(); $dompdf->loadhtml($html); $dompdf->render(); $dompdf->stream("sample.pdf", array("attachment...

linux - How to turn command output to a live status update? -

i curious if there's tool or easy way continually execute command in given intervals, , reprint output same place on screen. the example prompted me think 'dropbox-cli status'. manually executed: $> dropbox-cli status syncing (6,762 files remaining) indexing 3,481 files... $> dropbox-cli status syncing (5,162 files remaining) indexing 2,681 files... i looking for: $> tracker --interval=1s "dropbox-cli status" syncing (6,743 files remaining) indexing 3,483 files the imaginary command 'tracker' block , 2 output lines continually reprinted on every second, rather creating appending log output. you can use watch watch -n1 dropbox-cli status specify time in seconds param -n .

Improve performance of a JavaScript function (with an array lookup) -

i'm trying complete code challenge have decode keystrokes of cell phone t9 input characters create text message. main function (reverse_t9) takes string of keys such "44 444" or "999337777" , need translate them corresponding texts ("hi", or "yes" respectively). i have logic down , can generate correct outputs, challenge telling me i'm exceeding time limit 4000ms. i've found couple spots improve performance, still can't under mark. think biggest time-waster "getletterfromdigits" function has iterate through array find corresponding mapping set of keystrokes. am missing other obvious performance problems? please let me know if need more info. function reverse_t9(keys) { var retval = ""; var maxkeystrokes = 3; var splitkeystrokes = splitkeystrokesbyspacesandkeys(keys); (i = 0, numsplits = splitkeystrokes.length; < numsplits; i++){ //console.log("this split:"); ...

html - flexbox vertical centering plus a sticky footer -

im using flexbox lot on page. im using on 6 images spaced apart works fine. this wrapped in container (pink background). want aligned vertically , horizontally of window. got working fine. untill added in flexbox sticky footer. cant them both working @ once. my main issue safari, getting sticky footer working in that. use flex: 1 0 auto; on .container class. if change value flex: 1; centers thte footer not work in safari can shed light on this. i've never used flexbox before https://codepen.io/gorelegacy/full/dxzbmk/ can bit more precisely? me it's working fine in codepen. or pink background (which shows black on large screen) problem? one advice, not solution: flexbox used define layout. see give body flex-direction: row, , give elements fixed height. instead of using .bottom { height: 40px; } i recommend using: flex: 0 0 40px; the results same, prevent little bugs or weird behaviour in future. same goes div class=top. regarding problem,...