Posts

node.js - Gulp is not updating my static generated pages with Assemble -

i have working modular gulpfile building static pages assemble. far good. when run watch job , change data in json file watcher running assemble again, building pages without new data. handlebars partials , other things working exept data files. when quit watch task , run whole assemble task again, data is updated, assemble task works think. this assemble task. module.exports = function(gulp, plugins, config, assemble, browsersync) { var error = require("./error.js"); var clean = require("./clean-html.js"); //var production = require("./distribution.js"); var app = assemble(); gulp.task('load', function() { app.partials(config.source.assemblesrc.partials); app.layouts(config.source.assemblesrc.layouts); app.data(config.source.assemblesrc.data); }); gulp.task('assemble', ['load'], function() { return app.src(config.source.assemblesrc.pages) .pipe(plugins.plumber({ errorhandler: error ...

asp.net - DotNet Core RC2 Project and Net461 dependency resolve issue -

here project.json main dotnet core web project "frameworks": { "netcoreapp1.0": { "imports": [ "dotnet5.6", "dnxcore50", "portable-net45+win8", "net461" ] } } if add following net461 class library project reference above one. won't build correctly. "frameworks": { "net461": { } } and throw error the dependency mscorlib not resolved. however, if create project using old template(no project.json), , add reference dotnet core project. works fine. i wonder how fix this? what you're doing creating library run on .net framework, , trying use application runs on .net core. won't work. if want run on .net core, project.json of application should contain: "frameworks": { "netcoreapp1.0": { "imports": [ "dotnet5.6", ...

java - how to simulate app with media recorder(video) on avd(emulator) -

Image
how simulate video media recorder on android virtual device. have tried run application capture videos guide:building camera app http://developer.android.com/guide/topics/media/camera.html#custom-camera i'm assuming have basic knowledge of android , eclipse. have create android virtual device in eclipse supports camera input. depending on needs, have enable front camera and/or camera. when start application sort of camera preview uses webcam of computer show live camera data.

javascript - create a countdown timer which is the best solution? -

so have read , doing example of countdown timer still didn't have clear idea how create count down timer. want countdown timer countdown 7 days when countdown end echo div top post in week. div stay there , timer restart again 7days , after 7 days echo new weekly top post. , again , again. before using js simple timer when refreshing broswer timer restart. , know there have local storage when user delete cookie timer restart again. want same every user. should do? can give me clear idea or step develop this? currently thinking way using sql compare starttime , endtime when reach endtime echo div , content , +7days end time , store current time start time , repeat , repeat < i have simple php script mysql , using jq make time running every second here countdown.php << cant using $today compare $end select out db create new $ending compare <?php include '../config.php'; date_default_timezone_set('asia/kuala_lumpur'); $today = date("y-m-d...

css - Attribute property binding for background-image url in Angular 2 -

i have been struggling figure out best way dynamically change background-image attribute in number of angular 2 components. in following example, attempting set background-image of div @input value using [ngstyle] directive: import {component, input} '@angular/core'; import { user } '../models'; // exporting type aliases enforce better type safety (https://github.com/ngrx/example-app) export type userinput = user; @component({ selector: 'profile-sidenav', styles: [ ` .profile-image { background-repeat: no-repeat; background-position: 50%; border-radius: 50%; width: 100px; height: 100px; } `], template: ` <div class="profile-image" [ngstyle]="{ 'background-image': url({{image}})"> <h3>{{ username }}</h3> ` }) export class profilesidenav { @input() user: userinput; blankimage: string = '../assets/.../camera.png'; // utilizing ...

angular - Angular2 with Typescript - Error loading angular2/platform/browser -

Image
i have spent way time on this, stuck , can't figure out how angular2 typescript run. keep getting 404 components: error loading http://localhost:5000/angular2/platform/browser "angular2/platform/browser" http://localhost:5000/appscripts/boot.js here folder structure: my index.html is: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>angular 2 asp.net core</title> <!-- 1. load libraries --> <script src="libs/es6-shim/es6-shim.min.js"></script> <script src="libs/zone.js/dist/zone.js"></script> <script src="libs/reflect-metadata/reflect.js"></script> <script src="libs/systemjs/dist/system.src.js"></script> <!-- 2. configure systemjs --> <script src="./appscripts/config.js"></script> <script> system.import('appscripts/boot') .then(null, console.error.b...

java - Removing RDF graph dead-ends using Jung -

i trying implement method removes dead-ends rdf graph iterator<string> iter = rdfgraph.getvertices().iterator(); while(iter.hasnext()){ string x = iter.next(); if(rdfgraph.outdegree(x)==0){ iter.remove(); } } whenever run java.lang.unsupportedoperationexception. how can fix code. the iterator's remove() method optional. javadoc mentions when it's not supported, throw unsupportedoperationexception : throws: unsupportedoperationexception - if remove operation not supported iterator based on discussion in adding node collection using jung2 , i'd assume getvertices() returns unmodifiable collection, in case iterator wouldn't support remove() . note javadoc getvertices() says method returns view of vertices. doesn't adding or removing collection adds or removes vertices graph, or adding or removing vertices collection possible. getvertices collection<v> getvertices(...

html - Two divs side by side inside wrapper -

i trying place 2 divs side side 20px margin between them. divs inside wrapper, width 800px. left div 250px , right div 550px, of course if add 20px margin between them, total width increasing on 800px. there way force right div width 550px - 20px margin? css .wrapper { max-width: 800px; height: 400px; background-color: green; margin: 0 auto; } .left { width: 250px; height: 300px; background-color: blue; float: left; margin-right: 20px; } .right { width: 550px; height: 300px; background-color: red; float: left; } html <body> <div class="wrapper"> <div class="left"> </div> <div class="right"> </div> </div> </body> i mean have decrease width manually or there better solutions? jsfiddle: https://jsfiddle.net/ytsvd77f/ yes can use calc(550px - 20px) width of right div. .wrapper { max-w...

shell - create main directory with folders inside and specific sub-folders -

in code below create main directory using the $date variable , create 5 folders in directory. can not seem figure out how create sub-folders in specific folders. thank :). date=`date +%-m-%-d-%y` mkdir -p /home/desktop/$date/{validation,file,test,count,base} structure example 6-1-2016 (`directory`) validation file test count base (`folders`) -1 -2 -1 -2 -3 -1 (`sub-folders within folder`) update: below create directory date followed 5 folders in directory, 1 sub-folder in validation. however, can seem create 1 sub-folder , not multiple. thank :). date=`date +%-m-%-d-%y` mkdir -p /home/desktop/$date/{validation/1,file,test,count,base} file structure 6-1-2016 (`directory`) validation file test count base (`folders`) - 1 (`sub-folders within folder`) in case else has similar question, works: date=`date +%-m-%-d-%y` mkdir -p /home/desktop/$date/{validation/{-1},file,test,co...

Make Vagrant _not_ bring up certain machines by default? -

i have vagrantfile defines multiple machines. 1 of these machines used daily development, other 1 exists solely occasional integration testing. is there way make vagrant never bring secondary machine default? when run vagrant up , i'd bring default machine defined as: config.vm.define "centos7", primary: true |centos7| and never bring secondary machine defined as: config.vm.define "centos6", primary: false |centos6| i know can run vagrant centos7 not bring other machine, i'd make life easier on consumers of project , not have them inadvertently start 2 vms simultaneously on machines, since second 1 irrelevant daily needs. you can define follow config.vm.define "centos6", autostart: false , primary: false |centos6| the autostart setting allows tell vagrant not start specific machines when you'll runn vagrant "centos7" automatically start, "centos6" not start. if want run test you'll force ...

php - easiest way to generate an unique and random key -

the question not 'how to' generate such key. there tons of answers. simple timestamp others not unique enough chars rand(). what thougth is, why not combine both? if take timestamp in seconds or milliseconds , add random chars (but no numbers) in between, wouldn't result random , unique string? the question not specific 1 programming language give code made in php: $token = (string) preg_replace('/(0)\.(\d+) (\d+)/', '$3$1$2', microtime()); $l = strlen($token); $c = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"; for($i = 0; $i < $l; $i++){ $token = substr_replace($token, $c[rand(0, 51)], rand(0, $l+$i), 0); } echo $token; i'm realy looking forward randomness-pro's answer! thanks ;) lenny i prefer generate guid. here code you. function getguid(){ if (function_exists('com_create_guid')){ return com_create_guid(); }else{ mt_srand((double)microtime()*1...

c# - Create a List to sort through -

i couldn't find on subject translated current issue hoping ideas on how solve following: i have 2 lists each hold following information lot of values: list 1: int row string text list 2: int column string text what want consolidate 2 lists 1 - don't know object use, though. closest know of .csv has header information "row","column" , "text". don't want write .csv , have load program work further - want object/array. exist? after need able sort values, sort "row" first, "column". final product can this: row column text 0 0 test1 0 1 test2 1 0 test3 ... your appreciated (yes i'm beginner in c#). list<myclass> list1 = new list<myclass>(); list<myclass> list2 = new list<myclass>(); please note myclass class storing data. // merge 2 list list1.addrange(list2); and sorting, can list<my...

Loading and saving graphs in python -

i need create graph based on set of input files. since files loaded during separate iterations, need save graph , able add after re-loading graph information file . the obvious choice seems graphviz python api doesn't seem allow loading. pydot has parse_dot_data file , referenced in this answer documentation non-existing , there's no clear way 'append' graph. there's networkx seem have ability load although it's in documentation found. lastly there's graph-tool overkill , requires more libraries , tool need simple job. i'm sure must solved problem , i'm reluctant "reinvent wheel" , write database/persistence layer accomplish this. how can make simple graph in python, save somewhere , load when needed? networkx provides abundant file formats reading , writing graphs. refer reading , writing graphs detailed description. instance, import networkx nx # create graph g = nx.florentine_families_graph() # save file ...

property placeholder - @Value in my spring controller does not work -

my controller has @value("${myprop}") private string myprop; @bean public static propertysourcesplaceholderconfigurer propertyconfigindev() { return new propertysourcesplaceholderconfigurer(); } @requestmapping(value = "myprop", method = requestmethod.get) public @responsebody string getmyprop(){ return "the prop is:" + myprop; } my applicationcontext.xml has <bean id="appconfigproperties" class="org.springframework.context.support.propertysourcesplaceholderconfigurer"> <property name="location" value="classpath:myapps-local.properties" /> </bean> i following exception: caused by: java.lang.illegalargumentexception: not resolve placeholder 'myprop' in string value "${myprop}" note: properties file myapps-local.properties in classpath , contains myprop=delightful any great.... in xml based configuration need use propertyplaceholderco...

objective c - iOS Audio Unit, output each stereo channel from stereo source to 3D Mixer -

apple's 3d mixer audio unit guide states: to use stereo source, may treat left , right channels 2 independent single-channel sources, , feed each side of stereo stream own input bus. https://developer.apple.com/library/ios/qa/qa1695/_index.html however, can not figure out how send each channel of stereo audio unit 3d mixer. how 1 this? bascially, you'll need like @interface audioengine () { avaudioengine *_engine; avaudioenvironmentnode *_environment; avaudiopcmbuffer *_ouputbuffer; nsmutablearray <avaudioplayernode*> *_playerarray; avaudioplayernode *_soundplayer; avaudiopcmbuffer *_soundbuffer; bool _multichanneloutputenabled ; load file , grab buffer. split stereo multichannel, need like outputlayouttag = kaudiochannellayouttag_audiounit_2; _multichanneloutputenabled = true; this '_mul...

c# - How to Draw Projectile Trajectory with Unity3d's built-in Physics Engine? -

i working on game fling projectile reacts physics forces. using built in unity physics in game, drawing trajectory of projectile before launched. so, i'm using linerenderer , simple physics class rolled compute positions: public class slingphysics { private vector3 halfgravity; private float forcemultiplier; public void init(vector3 gravity, float slingforce, float mass, float drag) { halfgravity = gravity / 2.0f; forcemultiplier = slingforce / mass / (1 + drag); } public vector3 getposition(vector3 start, vector3 direction, float timedelta) { vector3 pos = direction * (timedelta * forcemultiplier); pos.y += (halfgravity.y * timedelta * timedelta); return start + pos; } /// <summary> /// computes array of trajectory object positions time. /// </summary> /// <returns>number of positions filled buffer</returns> /// <param name="startpos">start...

html - Text overlapping responsive image border -

i made page fixed header, footer , middle section large image adjusts size of window. if there enough room, trying have image description, couple of buttons , small image on right side of large image. if not enough room, wanted these items drop below large image @ ones. able achieve creating table containing items , placing after large image in code. have 200px min-width set table doesn’t skinny. problem happens when table drops below. text in overlaps border of large image , avoid it. simplest solution add "br" tag in front of description text, don’t way looks when table displayed on right, doesn’t work me. perhaps there better way together. way, border on large image made using margin , padding, not actual border. tried doing border , had same issue. here jsfiddle of have far. please move side border make wider/skinnier see how page responds. help. html <!doctype html> <html lang="en"> <body> <div id="header">header...

java - Getting public file url from customobject -

i have custom object class file type field, after query class, not public url file in field. how can full public url of file field type customobject class loaded in listview? have image loading library means of picasso. try one https://api.quickblox.com/data/<class_name>/<record_id>/file?field_name=<field_name>&token=<qb_session_token> more info here http://quickblox.com/developers/custom_objects#download_file

How can I write a simple Python try block that only check if a function returned as true? -

pretty new python, trying use try/except block tests if output of function true or not. function takes simple input user , validates it. want this: try: if(test_function()): print('input test_function true.') except: print('input test_function false.') but can see, never hits except portion of code. how can accomplish this? this not try/except situation; simple if statement: if(test_function()): print('input test_function true.') else: print('input test_function false.') try/except code may raise exception, such as try: if(test_function()): print('input test_function true.') except: print('test_function tried illegal ... :-)')

php - Reloading multiple application servers on deploy -

i have setup there several application servers running php-fpm service , share glusterfs mount application code , other assets. in current deploy process, files updated directly on file server , many times reflect changes application service must reloaded. achieve that, deployment script needs every server , issue reload command autoscaling, number of servers not same @ every moment. overall, working on sketching couple of alternatives solution problem: first one, more artesanal , not perfect, proof of concept, cron job run every x minutes on application machines , file should contain unique info it's hostname or ip address. if matches, not take action if not, reload , write within file. on deployment procedure, script clear file , servers should reloaded in next cron run. second, using more sophisticated approach message queue or notification service running applications machine subscribe @ boot time , wait order reload. deploy script publish notification servers aware...