Posts

Showing posts from September, 2015

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...

html - passing form input to a script -

i trying input html form pass script. pretty new @ this, form asks enter name (first & last) when hit submit, trying have return, name is.... here form page <doctype html> <html> <body> <p>please enter name below.</p> <form method="post" action="/cgi-bin/test2.cgi"> first:<br> <input type="text" name="firstname"> <br> last:<br> <input type="text" name="lastname"><br> <br> <input type="submit" value="submit"><br> </form> </body> </html> and script #!/bin/sh echo content-type: text/plain echo echo name $firstnmae $lastname echo

c++ - Explicitly delete never-use copy constructor give compile error -

i implementing sizetag method take size value , keep l-value reference. things work fine , in code intent use t&& constructor. however, if explicitly delete copy constructor compiler give error: #include <cstdint> #include <type_traits> #include <utility> template <typename t = std::uint64_t> class sizetag { public: using size_type = std::uint64_t; using type = std::conditional_t<std::is_lvalue_reference<t>::value, const size_type&, size_type>; inline const type& get() const { return _size; } sizetag(t&& sz) : _size(std::forward<t>(sz)) { } sizetag& operator = (const sizetag&) = delete; sizetag(const sizetag&) = delete; // no error if line removed private: type _size; }; template <typename t> sizetag<t> make_size_tag(t&& t) { return std::forward<t>(t); } int main() { int = 9; make_size_tag(a); } why happening? copy con...

java - How to add a list of TextBox widgets to a Panel widget declared using UiBinder (GWT)? -

i use uibinder define page element in sinple gwt application. "login.ui.xml" defined belows. <ui:uibinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:gwt='urn:import:com.google.gwt.user.client.ui'> <gwt:htmlpanel> <div align="center"> <gwt:verticalpanel ui:field="mymeasuresboxespanel"> </gwt:verticalpanel> </div> </gwt:htmlpanel> the login class defined as: public class login extends composite { private static loginuibinder uibinder = gwt.create(loginuibinder.class); /* * @uitemplate not mandatory allows multiple xml templates used * same widget. default file loaded <class-name>.ui.xml */ @uitemplate("login.ui.xml") interface loginuibinder extends uibinder<widget, login> { } @uifield verticalpanel mymeasuresboxespanel; public login() { this.mymeasuresboxespanel.getelement()...

swift2 - mac osx app - swift window & viewcontroller fullscreen/resize -

i trying work out how windowcontroller , viewcontroller can talk each other when user clicks on windowcontroller fullscreen or manually resizes screen. i have uploaded full code github, noob @ swift , not sure parts of script need. but here part of code // // viewcontroller.swift // slither.io // // created russell harrower on 1/06/2016. // copyright © 2016 russell harrower. rights reserved. // import cocoa import webkit class viewcontroller: nsviewcontroller { @iboutlet weak var webview:wkwebview! override func viewwillappear() { super.viewwillappear() preferredcontentsize = view.fittingsize } override func viewdidload() { super.viewdidload() //let webviewconfiguration: wkwebviewconfiguration = wkwebviewconfiguration() let webview: wkwebview = wkwebview(frame:self.view.frame) let urlstring = nsurl(string:"http://slither.io") let requestobj = nsurlrequest(url: urlstring!) webv...

xamarin.ios - Xamarin PCL HttpClient throws WebException: Error: ConnectFailure -

we're using mono httpclient send , receive data our app. works except when httpclient throws following exception: [webexception: error: connectfailure (interrupted)] @ system.net.httpwebrequest.endgetresponse (iasyncresult asyncresult) <0x1004d0c80 + 0x00180> in <filename unknown> @ system.threading.tasks.taskfactory`1[tresult].fromasynccorelogic (iasyncresult iar, system.func`2 endfunction, system.action`1 endaction, system.threading.tasks.task`1 promise, boolean requiressynchronization) <0x1001dbe80 + 0x0005b> in <filename unknown> --- end of stack trace previous location exception thrown --- @ system.runtime.exceptionservices.exceptiondispatchinfo.throw () <0x10017d2b0 + 0x00028> in <filename unknown> @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess (system.threading.tasks.task task) <0x10017c7b0 + 0x000d3> in <filename unknown> @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernoti...

.net - How to select nodes from xml file when it`s full of ampersands? -

i have full xml document ampersands , having problems loading it. tried replacing ampersands, error < symbol. here conversion code: dim xmlfile string dim str streamreader = new streamreader("doc.xml") xmlfile = str.readtoend() xmlfile = xmlfile.replace("&amp;", "&") xmlfile = xmlfile.replace("&quot;", chr(34)) xmlfile = xmlfile.replace("&apos;", "'") xmlfile = xmlfile.replace("&lt;", "<") xmlfile = xmlfile.replace("&gt;", ">") dim xmldoc new xmldocument xmldoc.loadxml(xmlfile) from here getting error... if try load xml file straight without ampersands conversion, doesn`t select node if know position dim names xmlnodelist = xmldoc.selectnodes("/team/name[@id=grizzlie]/member") each name in names msgbox(name.outerxml) but see no message afte...

r - Pedigree construction with hermaphrodite? -

i trying construct pedigree founders both male , female ( hermaphrodites). therefore, have offspring in pedigree same individual both dam , sire. i have been trying use " kinship2 " package , " pedigree " function in r, " sex " argument (which mandatory), accept either " male ", " female ", " unknown ", or " terminated ." have tried " unknown " option, leaving out dams, etc, accept values offspring have both parents , both parents different sexes. have fix or can suggest other r based packages pedigree construction include hermaphrodites? in advance!

c# - Plnvoke Struct Field that is a char** impossible? Have to use unsafe code -

we have unsafe c# code leveraging c dll setups huge struct. think they're insane , want change use pinvoke instead has pointer char pointer messing me up. e.g. native code: struct{ ... char** args; int argcount; ... } nativestruct; if weren't marshalling struct , passing arguments native method use: [dllimport("nativelibrary.dll")] nativemethod(ref string args, int argcount); but this: struct{ string args; int argcount; } just marshals in char* not char**. you're not allowed use ref/out on struct field member, no unmanagedtype seems applicable. seems impossible short of using unsafe code, it?

scala - Stop processing large text files in Apache Spark after certain amount of errors -

i'm new spark. i'm working in 1.6.1. let's imagine have large file, i'm reading rdd[string] thru textfile. want validate each line in function. because file huge, want stop processing when reached amount of errors, let's 1000 lines. val rdd = sparkcontext.textfile(filename) rdd.map(line => myvalidator.validate(line)) here validate function: def validate(line:string) : (string, string) = { // 1st in tuple resulted line, 2nd ,say, validation error. } how calculate errors inside 'validate'?. executed in parallel on multiple nodes? broadcasts? accumulators? you can achieve behavior using spark's laziness "splitting" result of parsing success , failures, calling take(n) on failures, , using success data if there less n failures. to achieve more conveniently, i'd suggest changing signature of validate return type can distinguish success failure, e.g. scala.util.try : def validate(line:strin...

java - Any class I imported cannot resolved to a type in my jsp file with 500 error -

Image
this class want use in jsp: package com.entity; public class days { private int d; public int getd() { return d; } public void setd(int d) { this.d = d; } public days() { super(); } public days(int d) { super(); this.d = d; } } this jsp code <%@page import="org.eclipse.jdt.internal.compiler.ast.foreachstatement"%> <%@ page language="java" contenttype="text/html; charset=utf-8" pageencoding="utf-8" %> <%@ page import="java.io.*, com.entity.days,com.factory.*, net.sf.jasperreports.engine.*, net.sf.jasperreports.engine.util.*, java.util.*,java.sql.*, net.sf.jasperreports.engine.export.*"%> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head> <title></title> <%@ include file=...

ios - Force UITableView to load cells before it is displayed -

i need force uitableview load cells based on datasource , resulting uitableview height before displayed on ui. have other logic implemented based on height. rows have dynamic height , content inside cells autolayouted. why coudln't calculate manually (or don't know how). crucial in case height before uitableview displayed. please advise. now, requirement find height of cells filled data by this, can find height of cells before displaying them on tableview yes, can using below code: /****/ - (cgfloat)heightforbasiccellatindexpath:(nsindexpath *)indexpath { nsstring *cellidentifier= @"identifier"; static dispatch_once_t oncetoken; static uitableviewcell *cell = nil; dispatch_once(&oncetoken, ^{ cell = [self.tableview dequeuereusablecellwithidentifier:cellidentifier]; }); /**set data , values on cell*/ cgfloat height = [self calculateheightforconfiguredsizingcell:cell]; // nslog(@"height @ indexp...

How do I share common code between Rust projects without publishing to crates.io? -

there may not answer question, have code share between 2 different rust projects without publishing crate crates.io. the code proprietary , don't want put out wild. but it's proprietary code , don't want put out wild. you don't have publish crate. specifically, create crate ( cargo new shared_stuff ) specify path common crate(s) in dependent project's cargo.toml : [dependency.shared_stuff] path = "path/to/shared/crate" the cargo documentation has entire section on types of dependencies: specifying dependencies crates.io specifying dependencies git repositories specifying path dependencies i believe cargo allow fetch private git repository (such on github or privately hosted service, such gitlab), haven't tried personally. based on searching, need have authenticated or otherwise configured git not require interactive password entry. it's theoretically possible create own crate registry. i've not attempte...

asp.net mvc - Mvc 5 - 2 model in view -

i started mvc , i'm trying learn how create order , order details project. i have inventory contains items in there facing problems trying pull data out inventory through order details. how combine 2 together? @model inventorytest.models.inventory.order , @model ienumerable< inventorytest.models.inventory.inventories> in view code? i apologies messy structure of code i'm still learning hope advice me on problem i'm facing. inventory model: public int inventoryid { get; set; } public string itemno { get; set; } public string item { get; set; } public int quantity { get; set; } order model: public int orderid { get; set; } public datetime date { get; set; } public int employeeid { get; set; } public int departmentid { get; set; } public ienumerable<selectlistitem> getemployee() { var query = db.employees.select(c => new selectlistitem { value = c.employeeid.tostring(), text = c.displayname, }); return query.a...

jquery - AJAX call terminates abruptly sometimes with empty status code and response and response header in ios -

problem - building hybrid app using apache cordova.we initiate ajax call during app launch.out of 200 times 3/4 times , call fails , gets terminated without error status code or response or response header.while debugging in mac can see in console, ajax call initiated,but failed "- " status code in console.along that,from logs can see never reached server. os affected :ios 9 , above versions alone. jquery version - 1.10.2 apache cordova js file version ios -3.8.0 android -5.1.0 issue ios though. any appreciated.any other details requested please ask.will update post accordingly. update 1 - can't change jquery version , cordova version higher versions,client not agreeing regression testing scope , time take once version update made along change in plugin versions itself. update 2- updated cordova min js version using.issue still there ios though. try adding plugin https://github.com/wymsee/cordova-http . check if plugin supported cordova 4. and try...

java - Using strings.xml items on a listview array -

i'm coding android app android studio. i'm displaying listview gets content string array. want use strings.xml items in array of listview, can't. please me. i'm doing first item of array: public final string palanca= (getresources().getstring(r.string.palanca)); private string [] formls = {palanca,"@string/umr","@string/new1","@string/new2","@string/new3"}; thank you! create string array resource in strings.xml. <string-array name="colors"> <item>red</item> <item>green</item> <item>blue</item> </string-array> use string array java other string resource. private string[] colors = getresources().getstringarray(r.array.colors);

postgresql - Slow query due to planer invalid stats - even after analyze -

i have 2 tables: create table sf.dir_current ( id bigint primary key, volume_id integer not null, path varchar not null ); create index dir_volid_path_indx on dir_current (volume_id, path); create table sf.event ( id bigint, -- no primary key here! volume_id integer not null, parent_path varchar not null, type bigint, depth integer ); table dir contains ~50 millions of rows , in rows volume_id = 1. table events contains ~20k rows. i execute following query (in plsql function - vol_id, min_id, max_id , on function params): select dir.id parent_id, event event_row sf.event event left outer join sf.dir_current dir on dir.volume_id = vol_id , parent_path = dir.path event.volume_id = vol_id , event.id between min_id , max_id , (depth_filter null or event.depth = depth_filter) , (type_filter null or event.type = type_filter) order event.depth; everything works fine when ro...

asp.net core - hostfile.json webroot property not serving static files -

going nuts :-) i've installed latest asp.net core (rc2). i'd able create *.sln , multiple *.csproj : 1 server side development, , 1 client side development. the reason keeping them separate can have option of giving the clientside *.csproj external developers better ui skills work on without needing know server side code. work on client side html/js using visual studio code or other light weight ide, , not requiring visual studio involved. in client *.csproj , i'd serve static files (html/js/css) angular project from root directory , not wwwroot directory, gulpfile.js relative paths, etc identical how 1 set angular project without visual studio. as understand it, rules now: * use webroot setting in hosting.json if hosting.json file exists. * otherwise, use wwwroot. * if that's missing, use root. * see: https://github.com/aspnet/hosting/issues/450 first, checked had set static page routing. created wwwroot/index.html page. tada! works. now, rename...

ruby on rails - Active Record, count of grandchild association record -

let's i've got: class town < activerecord::base has_many :citizens end class citizen < activerecord::base belongs_to :town has_many :cars end class car < activerecord::base belongs_to :citizen end using activerecord, simplest way can count of cars in town? in models can define through association. class town < activerecord::base has_many :citizens has_many :cars , :through => :citizens end and query this. @town.cars.count or town.find("town id").cars.count

java - how do I update new image on JFrame ? (I tried everything but it didn't work) -

so source code, i'm trying make stick man moving first, tried make head moving. works, problem past movement , reccentt movement stick goes ooooooooooo when it's supposed go o i tried repaint() validate() updateui() still didn't work any idea? package jamestestpackage; import java.awt.*; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.awt.event.keyevent; import java.awt.event.keylistener; import javax.swing.*; public class stickmanui extends jpanel implements actionlistener, keylistener{ timer t = new timer(1,this); int x=180; int x_vel = 0; int y_vel = 0; public stickmanui(){ t.start(); addkeylistener(this); setfocusable(true); } public void paintcomponent(graphics g) { graphics2d g2 = (graphics2d) g; g2.setstroke(new basicstroke(5)); g2.drawline(200, 50, 200, 100); // body g2.drawline(200, 100, 220, 150); // right leg g2.drawline(200, 100, 180, 150); // left...

javascript - How to set the selected index of a dropdown in reactjs? -

i have 2 dropdowns, second controlled first. when selecting value in first dropdown, sets new list of options second dropdown. the problem have selected index of second dropdown being remembered, , don't see clear way set selected index. if javascript, i'd set selected index. being react, i'm not sure should do. render() { let renderworkitemtypes = (workitemtype: tfs_workitemtracking_contracts.workitemtype) => { return <option value={workitemtype.name}>{workitemtype.name}</option>; }; return <select onchange={this.props.workitemtypechanged}>{this.props.workitemtypes.map(renderworkitemtypes) }</select>; } i advice using props value of <select> described react : <select value="b"> <option value="a">apple</option> <option value="b">banana</option> <option value="c">cranberry</option> </select...

javascript - How to reverse the direction of applying texture in the object CylinderGeometry? -

how reverse direction of applying texture in object cylindergeometry? var obj = new three.mesh( new three.cylindergeometry(20, 15, 1, 20), new three.meshlambertmaterial({color: 0x000000}) //the material later changed correct ); thank in advance :) this function works: var inverttextureoncylindergeometry = function(obj) { var facevertexes = obj.geometry.facevertexuvs[0]; var facevertexeslength = facevertexes.length; var divisiont = 1 / (facevertexeslength * 0.25); facevertexes.map(function(face, index) { if (index < 0.5*facevertexeslength) { var thisindexdivision = [ math.floor(index/2) * divisiont, math.ceil((index+divisiont)/2) * divisiont ]; if (index % 2) { face[0].set(1, thisindexdivision[0]); face[1].set(1, thisindexdivision[1]...

regex - to trim a any substring inside bracket in the string -

i have string in python : line=r"x:\folder\code\mod\accsc1c1.c 351: error -> warning 550 symbol xxx (line 34) not accessed" and want trim line remove (line 34). different case line number varies line may like: x:\accsc1c1.c 333: error -> warning 4' (line 536) not accessed x:\accsddc1.c 633: error -> warning 8' (line 111) not accessed so output should come like: x:\accsc1c1.c 333: error -> warning 4' not accessed x:\accsddc1.c 633: error -> warning 8' not accessed i used wildcard '*' not working eliminating brackets () showing errors , using re module. thanks try this: import re line=r"x:\folder\code\mod\accsc1c1.c 351: error -> warning 550 symbol xxx (line 34) not accessed" re.sub("\(line \d+\)", '', line) 'x:\folder\code\mod\accsc1c1.c 351: error -> warning 550 symbol xxx not accessed' from documentation sub : re.sub(pattern, repl, string, c...

concurrency - Using MPI, how can I synchronize the end of inter-dependent processes? -

ok, title sounds confusing concept not bad. basically, have 2 processes running (let's call them process 0 , process 1). both run function @ same time. while function running, need data each other. process 0 requests data process 1 , vice versa. since rely on each other, don't want 1 process finish before other. if process 0 finishes work, should continue checking requests process 1 (otherwise process 1 won't able finish). after both processes have finished work, should proceed. i'm having trouble implementing this. right now, have each process send other processes notification when finishes (so process 1 sends notification process 2 when work done). have loop supposed continue until receives notification other processes. should loop exit , process continue. however, isn't working. processes keep going before others have finished. feel there's simpler way i'm not thinking of. i'm complete newbie mpi, hope i've explained properly....

facebook - Do I need to put fb:amins & fb:app id meta tags to every page of my website or puting them on one page would be enogh? -

i want insights website,i'm talking these meta tags thanks. you have put tags on every page. please note might want use <meta property="fb:page_id" content="395450240451647" /> as having problems getting work app_id the app id specified within "fb:app_id" meta tag invalid