Posts

Showing posts from February, 2013

javascript - Best way to pass route params between callbacks in expressjs -

i've tried search similar problem on here suprisingly couldn't find 1 posted already. i use expressjs v4 framework , i'm constructing routes this: 'use strict'; let express = require('express'); let router = express.router(); let users = require('./modules/users'); router.post('/',users.add); router.put('/edit/:id',users.edit); as can see above, i'm requiring let users = require('./modules/users') now users module looks (let's say) this: 'use strict'; let usersdbmodule = require('...'); let users = { 'add': (req, res, next) => { let callback = (err, record) => { //...do users.function1(record) } usersdbmodule.save(req, callback); }, 'function1': (record) => { users.function2() }, 'function2': () => { //...do next() function } } you can notice, router first

android - How to test complex RxJava Observables -

i using rxjava in android project , i'm starting unit testing code. i have following observable method i'm going test private observable<boolean> changemystring (@nonnull string teststring) { return oneclass .dosth1(teststring) .subscribeon(schedulers.io()) .observeon(androidschedulers.mainthread()) .flatmap(teststring2 -> observable.create( subscriber -> { manager.setteststring2(teststring2); anotherclass .dosth2(teststring2) .subscribe( teststring3 -> { manager.setteststring3(teststring3); subscriber.onnext(success); }, subscriber::onerror, subscriber::oncompleted ); } )); oneclass.java dosth1(string teststring) private observable<object>

makefile - Make: Dependency on newest file in directory -

for small project, have following workflow: compile code , generate ./data , ./images run code, write many files ./data generate images data files, place them in ./images generate video images i have written makefile, can run code, , compile before, if necessary. don't know how implement dependencies of steps 3 , 4, , make targets manually. so, there way check if e.g. newest file in ./data newer newest file in ./images ? it's not necessary on file-by-file basis, , total number of data / image files not known. typically date of directory date last file added/modified, use timestamp on directory dependencies. images : data // generate images alternatively, if there mapping between files in 2 directories, like: images/%.img: data/%.dat // generate image... which prevent reprocessing data that's been handled.

memory management - What is the cause of SIGABRT error in my C code and how to overcome this? -

the error occurs when try input large data. after reading lot of resources found causes of error follows- 1. touching memory location not allowed to. 2. using free() on memory have not reserved or double free() pointer. 3. initializing invalid index (such creating arrays negative index) found 1 cause may have caused error in code- link - https://discuss.codechef.com/questions/59703/prime-number-generation-sigabrt-problem-c which says- "may limit on n quite large! can atmost make array of 10^8 size online judges. in heap memory ie. outside main function. making array of size of 10^7 in main function can lead runtime errors. try not use more of order 10^8 elements array.. :) in question attempting upper limit 10^9 can make array of size. thats why sigabrt error means exceeded memory limit." then modified declaration , input part this- int main(void) { int test_cases; scanf("%i",&test_cases); (int i=0; i<test_cases; i++) {

Two scicharts bound to the same SeriesSource, not updating -

i'm using scichart v3.1 , have requirement display 2 charts on same window (in different tabs), both displaying same data. i'm plotting data "real time" (adding new point every second), i'm finding new values don't appear on charts added bound series. i've found can charts refresh recreating visiblerange bound charts' y axis, isn't ideal. things work fine if there 1 chart on window, issue seems point using 2 charts. thoughts? appreciate i'm on older version curious if known issue, , whether there workaround. in scichart v3, seriessource api binds observablecollection of ichartseriesviewmodel . each ichartseriesviewmodel contains both dataseries , baserenderableseries (which framework element). hence, chart has wpf frameworkelements on 2 charts (two visual parents) - big no-no wpf terms. this known issue in scichart v3 , , result scichart team re-wrote api in version 4 of scichart. the new mvvm api: seriesbinding , separates

javascript - How to call 'onchange' event of asp.net listbox after its codebehind function is called -

i have listbox defined as: <asp:listbox id="lst_agenda" onchange="drawchart()" onselectedindexchanged="lst_agenda_selectedindexchanged" selectionmode="multiple" cssclass="txt12 mylistbox" autopostback="true" datatextfield="name" runat="server" width="100%" height="100%" /> after select items in this, lst_agenda_selectedindexchanged method of codebehind called calls other listboxes populated in cascading way. there function in javascript named drawchart generates chart based on values selected in these listboxes. hence want codebehind function should called before javascript function call on listbox changed event. happening opposite, javascript function drawchart gets called first without filling values in listboxes. i tried calling javascript function codebehind method directly using: scriptmanager.registerclientscriptblock(this, this.gettype(), "myscript"

In java Program I am getting yellow exclamation Mark and not showing output on console -

this image getting. please help. new @ programming take in matter. program output not showing on console. appreciated. program/console waiting input user.it take integer input. try giving input keyboard : 10

c# - Find active winform in solution explorer -

i started working on existing solution has large number of winforms. there quick way find design time form, in visual studio solution explorer, when application running? please note: debug/break me find modal forms (dialogs). interested in finding modeless winforms too. don't consider plowing through design time menus , events quick way.. you make debug menu item on main form , put in : string test = string.empty; foreach (form item in application.openforms) { test += item.gettype().tostring() + environment.newline; } messagebox.show(test); this give list of openforms markus g suggested without need of creating form this. also @ : https://msdn.microsoft.com/en-us/library/system.windows.forms.form.activeform(v=vs.110).aspx it explains how can identify active form, usual microsoft has made things bit complex having 2 methods, 1 mdi forms , 1 none mdi forms

Android applying theme by version -

i'm developing application starts listview. i'm in trouble setting of themes application. material design can applied android 5.0 , above. created values-21 folder , create styles.xml follow: <resources> <!-- inherit light material theme --> <style name="mycustomtheme" parent="android:theme.material.light"> <item name="android:colorprimary">@color/my_lightblue</item> </style> </resources> in android under 5.0 version theme not applied because not read values-21 folder. have create styles.xml in values standard folder? mandatory create new theme change te color of app bar (this objective). i'm bit confused... thank you from https://developer.android.com/training/material/compatibility.html you can configure app use material theme on devices support , revert older theme on devices running earlier versions of android: define theme inherits older theme (lik

Simplest way to plot 3d sphere by python? -

this simplest know: from visual import * ball1=sphere(pos=vector(x,y,z),radius=radius,color=color) which alternatives can suggest? see mayavi library 3d visualization , examples draw sphere. should work python 2.7. enjoy!

java - How to stop persistence from altering database, JPA -

i using camel , open jpa persistent provider, don't want alter statements run on prduction. snapshot of persistence.xml <persistence-unit name="camel-openjpa-oracle-alert" transaction-type="resource_local"> . . <provider> org.apache.openjpa.persistence.persistenceproviderimpl </provider> <properties> <property name="openjpa.jdbc.synchronizemappings" value="buildschema(foreignkeys=false)" /> </properties> . . </persistence-unit> what value have put openjpa.jdbc.synchronizemappings , alter command not executed. i searched unable find such value. it nice know little more doing , why need use synchronizemappings. fact use foreignkeys=true tells me want openjpa read schema , determine if have database fks defined (i.e. openjpa knows these fks can order sql honor parent/child fk constraints). valid use of synchmappings. however, using 'buil

controller - Yii2 file download using custom components -

in yii2 project using components in order download file path saved in database. i have setup download button in action column ['class' => 'yii\grid\actioncolumn', 'template'=>'{update}{pdf}{delete}', 'buttons'=>[ // display pdf icon. 'pdf' => function ($url, $model) { $id = []; foreach ($model->sdsrefs $mod) $id[] = $mod->file_id; return html::a('<span class="glyphicon glyphicon-download-alt"></span>', url::to(['product/download', 'id' => implode($id)]), [ ]); } ], 'options'=>[ 'style'=>'width:70p

c# - EasyNetQ Field Not Found 'RabbitMQ.Client.ConnectionFactory.AutomaticRecoveryEnabled' -

with easynetq v0.63.0.448, rabbitmqclient v4.0.2 , rabbitmq server 3.6.5 when try create bus so... bus = rabbithutch.createbus(new connectionconfiguration() { hosts = new[] { new hostconfiguration() { host = hostname, port = port } }, username = username, password = password, }, x => { }).advanced; i'm getting error: "field not found 'rabbitmq.client.connectionfactory.automaticrecoveryenabled'." is underlying incompatibility between easynetq , version of rabbit or there change in api somewhere need reflect? it looks version of easynetq compiled against version 3.6.0 of rabbitmq. in version 4 of rabbitmq, automaticrecoveryenabled , other fields in connectionfactory changed properties breaking change. until easynetq recompiled using version 4 of rabbitmq have use older version of rabbitmq - 3.6.5 seems work me.

java - Not able to connect to BOE RAS 4.0 Error- enterpriseLogonFailed at ReportSDKEnterpriseLogonException -

when trying run report application getting below error: error code:-2147217397 error code name:enterpriselogonfailed @ com.crystaldecisions.sdk.occa.report.lib.reportsdkenterpriselogonexception.throwreportsdkenterpriselogonexception not able connect boe ras 4.0 server local machine. have googled , did following: able ping machine (remote location). using administrator credentials login. checked credentials , able login in cmc. debug code , found: reportdocument clientdoc = new reportdocument(); clientdoc.open ("rassdk://" + reportname, openreportoptions._retrievenoreportdefinition); open() method throwing exception. after debugging, found guest user in boe disable. after enabling it, works. it's login guest user. thank input. hitesh

javascript - checking a safari browser for the ability to install an extension -

i'd web page offer browser extension safari users. web page offers extensions google chrome , firefox users. in chrome, javascript expression typeof chrome.webstore.install !== 'undefined' comes true if it's possible offer user chrome extension. in firefox, it's typeof installtrigger !== 'undefined' . is there similar expression return true if it's possible install safari extension? apple encouraging extension developers submit extensions safari extensions gallery . if distribute extension own site, install process users suboptimal, , there multiple "trust" dialogs users have consent to. as far i'm aware, can done own website safari is: 1. detect browser safari. although browser detection not 100% effective, , feature-based detection preferred, in case can follow effective feature-based detection of chrome , firefox simple, effective test safari (the key being check on navigator.vendor ): var issafari = /appl

.net - Where do I see log entries in Application Insights? -

Image
i got application insights , running asp.net application. then, installed microsoft.applicationinsights.nlogtarget package , added applicationinsightstarget nlog configuration. seems working fine. @ least can see outgoing requests dc.services.visualstudio.com:443 . now, on azure portal see log entries? application insights -> activity log page empty. update: issue thought regular nlog messages should appear in terms of event category, i.e. info, warn, etc. reality nlog messages went trace entries in application insights. kind of disappointing. i have tested microsoft.applicationinsights.nlogtarget on local , trace information in application insights. can information via click your application insigths -> overview -> search , following screenshot. for how use nlog in application insights, please read this article .

jquery - Putting a rss feed into a dynamic page asynchronously - wordpress -

on wordpress site have number of dynamic pages based around different people. ajax call data, generate html data included in javascript function, insert div on actual page. this, want show recent 3 articles specific person page has loaded for. i've found results telling me add functions.php: //this file needed able use wp_rss() function. include_once(abspath.wpinc.'/rss.php'); function readrss($atts) { extract(shortcode_atts(array( "feed" => 'http://', "num" => '1', ), $atts)); return wp_rss($feed, $num); } add_shortcode('rss', 'readrss'); so tried put in html: var rsser = '<h2>in news</h2>' + '[rss feed="http://website.com/tag/' + tagname + '/feed/" num="3"]'; $('#rsscon').html(rsser); however, doesn't seem working , i'm afraid might because it's happening asynchronously. "tagname" in

Python PYQT Tabs outside app window [why] -

tabs added before app.exec_() called , act other tabs u met, though if adding after app.exec_() call makes new tab 'detach' main app window. pic below :) why? how can make move inside window? import threading import time import sys pyqt5.qtwidgets import qapplication pyqt5.qtwidgets import qformlayout pyqt5.qtwidgets import qlineedit pyqt5.qtwidgets import qtabwidget pyqt5.qtwidgets import qtextedit pyqt5.qtwidgets import qwidget class atry(threading.thread): def __init__(self): super().__init__() def run(self): time.sleep(1) anothertextedit = qtextedit() anotherlineedit = qlineedit() anotherlayout = qformlayout() anotherlayout.addrow(anothertextedit) anotherlayout.addrow(anotherlineedit) anothertab = qwidget() anothertab.setlayout(anotherlayout) md.addtab(anothertab, "outside") app = qapplication(sys.argv) md = qtabwidget() atextedit = qtextedit() alineedit = qlineedi

How would I change language of days of week in php? -

i looking simple way change language of days of week. use simple code below call out current day monday, tuesday, need in french, , i've tried setting locale etc not working me. think arrays job, again, not work limited knowledge. <?php echo date('l'); ?> you should use strftime() function - http://php.net/manual/ru/function.strftime.php . date() not locale dependent.

javascript - Error: <svg> attribute height: Expected length, "NaN" -

i trying generate pie charts angular charts, when build app keep getting errors: error: attribute height: expected length, "nan" error: attribute transform: trailing garbage, "translate(60,nan)" i have tried didn't work here js code: this.authservice.getsurveydata().then(slist => { // standard: this.defaultsurveys = [ { title: "consent form", accepted: slist.data.consent.accepted, declined: slist.data.consent.declined, chartdata: { series: ["consent form"], data: [ { x: "accepted", y: [slist.data.consent.accepted] }, { x: "declined", y: [slist.data.consent.declined]

c# - ASP.NET Redirect user to current custom domain after Azure Active Directory Authentication -

i trying redirect users domain on tried access website before being redirected azure active directory login page. using openidconnect, , following bit of code defines uri on user needs redirected post-login : notifications = new openidconnectauthenticationnotifications { redirecttoidentityprovider = context => { string appbaseurl = "https://" + context.request.host + context.request.pathbase + context.request.uri.pathandquery; context.protocolmessage.redirecturi = "https://" + context.request.host + context.request.pathbase + context.request.uri.pathandquery; context.protocolmessage.postlogoutredirecturi = appbaseurl; return task.fromresult(0); }, //custom validation securitytokenvalidated = onvalidate, authenticationfailed = on

Socket.io and Node.js with mysql not returning results as expeted -

edit: i'm rephrasing question: socket.io not waiting callback , connection never accepted. please see edit 2/attempt 1 below this check authentication token against database. can spot wrong here? var checkauth = function(auth) { var rs = 0; var sql = 'select * clients pword=\''+auth+'\''; // copied debug session , got results: select * clients pword='d98e623c7a74a178703d17e1fd536b1488724acd41e71f178331c768c385bda2c82d2bcb60cbb4650be375ad4734c63fb694bd164c138f9abe0c51f37f9a7e33' var query = connection.query(sql); query .on('error', function(err) { console.log( err ); }) .on('result', function( row ) { rs = number(row.client_id); // never fires!!?!?! }) .on('end',function(){ }); if (rs == 0) { sql = 'select * users pword=\''+auth+'\''; query = connection.query(sql); query

html - Why doesn't flex item shrink past content size? -

i have 4 flexbox columns , works fine, when add text column , set big font size, making column wider should due flexbox setting. i tried use word-break: break-word , helped, still, when resize column small width, letters in text broken multiple lines (one letter per line) column not smaller width 1 letter size. try watch video: http://screencast-o-matic.com/watch/cdetln1tyt (at start, first column smallest, when resized window, widest column.i want respect flex settings always.. flex sizes 1 : 3 : 4 : 4) i know, setting font size , column padding smaller help... there other solution? i can not use overflow-x: hidden . jsfiddle: https://jsfiddle.net/78h8wv4o/3/ .container { display: flex; width: 100% } .col { min-height: 200px; padding: 30px; word-break: break-word } .col1 { flex: 1; background: orange; font-size: 80px } .col2 { flex: 3; background: yellow } .col3 { flex: 4; background: skyblue } .col4 { flex: 4;

Spring Boot : Disable AutoConfiguration of all modules -

in spring boot, there way prevent auto configuration of modules? looking @disableautoconfiguration instead of excluding specific configurations class names. auto-configuration enabled @enableautoconfiguration annotation. if don't want use auto-configuration, omit annotation. note @springbootapplication annotated @enableautoconfiguration you'll have avoid using too. typically, leave main application class annotated @componentscan , @configuration .

python - how to thread a function from an imported library -

i've been working on python program syntax of python still relatively new me. example, if have 2 python files contents below, what's proper way thread function? main.py - file being executed #!/usr/bin/env python #threading array threads = [] import threading import anotherfile af afcheck = af.init() #return true or false if afcheck == true: threads.append(threading.thread(target=af.listener)) try: thread in threads: thread.start() except (keyboardinterrupt, systemexit): print("closing shop"); thread in threads: thread.cancel() sys.exit() i going write dummy code anotherfile.py, seems pretty inconsequential. i've been able test point i've seen isn't executing listener , i'm not sure proper way call it. maybe need thread listener inside of anotherfile.py, thought simplicities sake, nice have them in 1 place since have multiple imports.

time - typo3 viewhelper is only called once -

i have made own viewhelper getting external images (thanks robert pflamm see typo3 fluid image external resource ). if use imageviewhelper working finde. but if use \typo3\cms\fluid\viewhelpers\uri\imageviewhelper image rendered once. same problem here typo3 ver. 7.6.2 - condition viewhelpers evaluated once . not know how solve it can please help? martin namespace mwxxx\mwxxx\viewhelpers; use typo3\cms\core\utility\generalutility; use typo3\cms\fluid\viewhelpers\uri\imageviewhelper; use typo3\cms\core\resource\fileinterface; use typo3\cms\extbase\domain\model\abstractfilefolder; class externalimageviewhelper extends \typo3\cms\fluid\viewhelpers\uri\imageviewhelper { const upload_directory = 'upload'; const temp_prefix = 'mwxx'; /** * resourcefactory * * @var \typo3\cms\core\resource\resourcefactory * @inject */ protected $resourcefactory = null; /** * resizes given image (if require

linux - Python alsaaudio and pjsip conflict -

i writing app in python uses pocketsphinx , pjsip use pocketsphinx keyword search wakeup app , pjsip phone problem when try call "call" function , after returning listen keyword , error message pjsip cannot open sound device: pjsua_aud.c ..opening sound device (speaker + mic) pcm@16000/1/20ms alsa_dev.c ...alsa lib pcm_hw.c:1557:(snd_pcm_hw_open) open '/dev/snd/pcmc0d0c' failed (-16): device or resource busy pjsua_aud.c ..unable open sound device: unknown error audio driver (pjmedia_eaud_syserr) [status=420002] operation=make_call(), error=unknown error audio driver (pjmedia_eaud_syserr) this error happens when try return keyword function uses alsaaudio so question how can open same audio device pjsip , alsaaudio?

ruby - how can a process be killed with all its childern -

i have situation 1 xterm runs xterm runs process. set kind of watchdog , kill windows in case of stuck process. i'm using ruby this. when first xterm opened it's pid, , later when sigterm sent it, first xterm window dies, not second. it can reproduced in irb: irb(main):002:0> cmd = "xterm -e xterm -e sleep 1000" => "xterm -e xterm -e sleep 1000" irb(main):003:0> pid = process.spawn(cmd) => 669 irb(main):004:0> process.kill(15, 669) => 1 this leaves second xterm window open. how can process chain killed? thanks using either ps xf or pstree , can dynamically see running processes hierarchy. i've used strace track behaviour of programs. turned checking contents of /proc/$pid/stat , /proc/$pid/status , give them information of process's parent is. probably, have processes parent pid equal pid got (or process's ppid).

java - Regex to strip Drive letter -

i trying check if there letter followed colon in string. if so, strip both. f:/users/mark/ => /users/mark/ this have far: if(pattern.matches("[a-za-z]:", path)) path = path.substring(2); does have better idea on how accomplish this? you can use: path = path.replaceall("^[a-za-z]:", "");

freemarker - Free Marker Template: Issue with height of table in free marker template. Table's height not getting reflected. -

in below email template when changing height of tables (i.e. id="dueamt1" , id="dueamt2" ,id="dueamt3") not getting reflected in email template how ever can see chagnes reflects when opening browser. please me understand why changes or not getting reflected in email ? <!doctype html> <html> <head> <meta charset="iso-8859-1"> <title>insert title here</title> </head> <body> <table width="100%" cellpadding="10" style="border-color: white;border-width: 0;border-bottom: 0px solid rgb(230,230,230);"> <tr> <td align="center" style="color: rgb(74,74,74);text-transform: uppercase;font-weight: bold;font-size: 14pt;">this bill compared previous months</td> </tr> <tr> <td> <table width="100%"

jquery - How to pass JavaScript function result to html when using onchange? -

i wonder how place user selected option somewhere in html text. user selection using javascript don't know how pass html. my current code looks this. html: <select id="profile" onchange="myfunction()"> <option>one</option> <option>two</option> <option>three</option> </select> javascript: function myfunction() { var user_selection = $( "#profile option:selected" ).text(); alert(user_selection); } you can use jquery create new element , add dom this: function myfunction() { var user_selection = $("#profile option:selected").text(); $('<div>' + user_selection + '</div>').insertafter('#profile'); } also note using on* event attributes considered outdated. should use unobtrusive event handlers. you're using jquery, here's how that: $('#profile').change(functi

php - success not being called jQuery AJAX -

the success not being called on completion of ajax request. response request 200 have no idea why won't return anything. if inspect in chromes developer tools says 'this request has no response data available'. have made query know fact succeed. my request: $.ajax({ url: 'search.php', datatype: 'json', data: { l_id: <?php echo $_get['l_id']; ?> }, success: function(data) { alert(data); console.log(data); $("#datatable td:nth-child(2)").each(function () { $(this).html(data); }); } }); my search.php: <?php require_once '../dbconni.php'; $list_id = $_get['l_id']; $matches = $db->query("select l_name wfp_lists l_id={$list_id}"); while($match = $matches->fetch_o

html - Why Bootstrap's select list is not working in google chrome's developer tool mobile view (responsive) option ? Is this BUG or anything else? -

i developing application, in application using select list bootstrap's class. problem when test using chrome's developer tool (f5) , switch small devices (for check responsive or not) not work expected! bs bug or chrome's bug? code: <div class="form-group"> <select class="form-control" name="access" id="access"> <option value="1" @view>view only</option> <option value="0" @full>full</option> </select> </div> snap shot: application snapshot i have same issue, it's chrome's bug, when try select 1 option list, background becomes black, , select changes place, tested in edge , works perfectly, english not good, hope you

symfony - Elasticsearch - Count distinct -

Image
i have basic index logs some logs visit of user1 user2 i managed count total of visits user has received, don't know how count total of distinct users user has received this giving me logs user { "post_filter":{ "bool":{ "must":[ { "term":{ "message":"visit" } }, { "term":{ "ctxt_user2":"733264" } } ] } }, "query":{ "match_all":{} } } actually, i'm using foselasticabundle symfony2 $filter->addmust((new term())->setterm('message', 'visit')); $filter->addmust((new term())->setterm('ctxt_user2', $this->search->getvisit())); i read pages in es doc aggregator, neve

java - How to give null value to a parameter when using @FileParameters of JUnitParams -

i try use fileparameters annotation of junitparamsrunner. cannot give null variable. code , test file below. @runwith(junitparamsrunner.class) public class passwordcheckerfileparameterizedtest { @test @fileparameters("src/test/resources/testscenarios.csv") public void checkpasswordisvalid_checkmultiplecase(string password,boolean expectedresult){ passwordchecker passwordchecker = new passwordchecker(); assertequals(expectedresult,passwordchecker.checkpasswordisvalid(password)); } } testscenarios.csv ,false sd1.,false ssfdsdfsdf234.,false sewerwer234.,false ssfdsdfsdsdfsdf.,false ssfdsdfsdsdfsdf3234,false ssfdsdfsdsdfsdf23.,true this not work default since fileparameters uses identitymapper map lines in file parameters , works if used @parameters({"aaa,bbb", "ccc,ddd"} syntax in cannot provide null value - writing null give string saying "null ". you can provide own mapper means of filepa

python - How to manage a Apache Spark context in Django? -

i have django application interacts cassandra database , want try using apache spark run operations on database. have experience django , cassandra i'm new apache spark. i know interact spark cluster first need create sparkcontext, this: from pyspark import sparkcontext, sparkconf conf = sparkconf().setappname(appname).setmaster(master) sc = sparkcontext(conf=conf) my question following: how should treat context? should instantiate when application starts , let live during it's execution or should start sparkcontext everytime before running operation in cluster , kill when operation finishes? thank in advance. for last days i've been working on this, since no 1 answered post approach. apparently creating sparkcontext generates bit of overhead, stopping context after every operation not idea. also, there no downfall, apparently, on letting context live while application runs. therefore, approach treating sparkcontext database connection, created s

How to stop Videoview from playing inside a viewPager when fragment is changed -

i want stop videoview playing inside viewpager when fragment change. problem in code when change or next fragment video still playing. here code main activity class private void setupviewpager(viewpager viewpager) { viewpageradapter adapter = new viewpageradapter(getsupportfragmentmanager()); adapter.addfragment(new fragmentstepone(), "1"); adapter.addfragment(new fragmentsteptwo(), "2"); viewpager.setadapter(adapter); } class viewpageradapter extends fragmentstatepageradapter { private final list<fragment> mfragmentlist = new arraylist<>(); private final list<string> mfragmenttitlelist = new arraylist<>(); public viewpageradapter(fragmentmanager manager) { super(manager); } @override public fragment getitem(int position) { return mfragmentlist.get(position); } @override public int getcount() { return mfragmentlist.size(); } public void addfragment(fragment fragment, string title) { mfragmentlist.add(fragment)

node.js - Re-render express server view -

i'm developing command line tool render pdf locally based on twig template. my problem express renders templates once , no matter if refresh template code doesn't re-rendered. i have option debug template code launching web server , serving contents via: app.get('/', function (req, res) { res.render(template + '/cv.twig', cvdata); }); now, i'm aware of fs.watch method: fs.watch('views/'+template, function (event, filename) { ... } but can't force express either drop cache or re-render template. i'd avoid command line tools nodemon or forever, since it's command line tool. you use gulp watch gulp twig . offers possibility stream file through pipes without restart, example: var gulp = require('gulp'), watch = require('gulp-watch'); gulp.task('stream', function () { // endless stream mode return watch('css/**/*.css', { ignoreinitial: false }) .pipe(gulp.d