Posts

Showing posts from April, 2015

machine learning - LSTM history length vs prediction error -

Image
i use lstm predict next step voltage value in voltage time series signal. have question: why using longer sequences (5 or 10 steps in time) train lstm not improve prediction , reduce prediction error ? (it degrades - see figures e.g. results sequence_length=5 better sequence_length=10) testplot('epochs: 10', 'ratio: 1', 'sequence_length: 10', 'mean error: ', '0.00116802704509') testplot('epochs: 10', 'ratio: 1', 'sequence_length: 5', 'mean error: ', '0.000495359163296' (predicted signal in green, real in red) import os import matplotlib.pyplot plt import numpy np import time import csv keras.layers.core import dense, activation, dropout keras.layers.recurrent import lstm keras.models import sequential np.random.seed(1234) def data_power_consumption(path_to_dataset, sequence_length=50, ratio=1.0): max_values = ratio * 2049280 ...

php - How to render json into a twig in Symfony2 -

the question how pass json twig render template. i've tried pass json jsonresponse object did not find way render template. tarifascontroller.php <?php /* * file part of symfony package. * * (c) fabien potencier <fabien@symfony.com> * * full copyright , license information, please view license * file distributed source code. */ namespace appbundle\controller\admin; use symfony\component\httpfoundation\request; use symfony\component\httpfoundation\response; use symfony\component\httpfoundation\jsonresponse; use symfony\bundle\frameworkbundle\controller\controller; use sensio\bundle\frameworkextrabundle\configuration\method; use sensio\bundle\frameworkextrabundle\configuration\route; use sensio\bundle\frameworkextrabundle\configuration\security; use appbundle\entity\tarifa; /** * * @route("/tarifas") */ class tarifascontroller extends controller { /** * @route("/", name="tarifa_index") */ public function ...

Wordpress Visual Composer custom button -

there way make custom button style in visual composer without using class? in button section can choose plenty of colors, none of them match theme design. how add new one? you need use chrome developer tools identify class button using can write custom css , override button styles effect buttons creating using visual composer , not best practice do. recommend use class , write custom styles

asp.net - one controller action does not respond to AllowAnonymous -

i've come across odd authentication behaviour in mvc application. controllers inherit basecontroller, decorated [authorize] attribute. then, in login page, decorate actions [allowanoymous]. so, example, freely available whether user logged in or not. [allowanonymous] public actionresult forgotpasswordconfirmation() { return view(); } if remove [allowanonymous] attribute controller action , try , navigate it, sent login page, , see url automatically has returnurl parameter appened querystring. however, have controller action same attribute: [allowanonymous] public async task<actionresult> verifycode(string provider, string returnurl, bool rememberme) { return view(new verifycodeviewmodel { provider = provider, returnurl = returnurl, rememberme = rememberme }); } my application absolutely not render view users aren't logged in, though it's decorated [allowanonymous]. can't life of figure out why. however, have noticed when try , navigate it, ...

Angularjs unit testing - ng-disabled not working when adding text to textarea -

i trying test angularjs component using karma, mocha, power-assert. have textarea , button in component, button disabled based on length of text in textarea. when run component in browser works perfectly. can't figure out how test functionality. here's bit of code. inquiryform.js function inquiryform($scope) { // plan add logic here } angular.module('myapp').component('inquiryform', { controller: inquiryform, controlleras: 'inquiryform', templateurl: 'inquiryform.html' }); inquiryform.html <div class="contact"> <div>thanks contacting us.</div> <form> <textarea ng-model="inquiryform.inquirytext" name=""></textarea> <input type="submit" value="send" ng-disabled="!inquiryform.inquirytext.length"> </form> </div> inquiryformtest.js describe('inquiry form ', () => { let $r...

python - Parsing a addition/subtraction/multiplication/division sign from a string -

i went through lesson of creating simple calculator using python, , i'm trying simplify it. issue follows: know possible parse string (number) float using "float()", i'm trying parse addition/subtraction/multiplication/division sign string float or integer or other format perform action. here's sample of i'm trying do: while true: user_input = input(""" quit - exit program add - addition sub - subtraction mul - multiplication div - division please choose function:""") actions = ("+-*/") user_input_1 = float(input("first number:")) user_input_2 = float(input("second number:")) operation = user_input_1 float(action) user_input_2 if user_input == "add": action = actions[0] answer = operation print (answer) if user_input "add" user_input_1 "5" user_input_2 "7" p...

Freemarker insert String into Javascript code -

i know how can insert string javascript code in example below: <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "restaurant", "name": "dave's steak house", "address": { "@type": "postaladdress", "streetaddress": "148 w 51st st", "addresslocality": "new york", "addressregion": "ny", "postalcode": "10019", "addresscountry": "us" } } </script> the problem when try insert string between js appears interpreted html code % , &20 etc. have tried ?html , escape , no escape , ?string , ?js_string, etc. that's string: { "@context": "http://schema.org", ...

resources - Generate 16 bit unique IDs in Android for startActivityForResult() -

i planning use generated resource ids startactivityforresult() codes, can use onactivityresult() in base classes , not have worry if derived class used same code. unfortunately seems codes restricted 16 bits, , resource ids 32 bits. there way generate unique 16 bit ids instead? actually there is. can use standard id android resource. mask id 0x0000ffff , use wherever want id startactivityforresult() or requestpermissions() , may use simple utility: public static int normalizeid(int id){ return id & 0x0000ffff; } why? firstly, lets point reason behind limitation 16 bit vlaue. it's fragment/activity. os enforces developers use 16 bit while id 32 bit(as integer number) because system masks id 0xffff shifts 16 (<<16) when call comes fragment. it's unique id marked fragment target id.on other side, id sent via activity stays it's, activity target id. when results come out, os knows send whether fragment or activity. lets have id id=0...

How to set a Java remote developer environment in Eclipse -

my friend , me want explore open source erp system . have installed on server , access ip address on firefox . we're accessing on tools putty (for doing changes restarting tomcat) , filezilla (for import export of data), pgadmin (for accessing psql db). want establish java eclipse developer environment on both our windows pcs working simultaneously. need access, change , commit source placed on server. every time commit, need deploy source code putty. 1) there better way of way of remote programming? if yes, tell me better way? 2) if not, how can set kind of environment in eclipse (create existing project?) you need configure jenkins deploy latest code remote server

Google maps API key error in any directory other than a certain -

this question has answer here: error: google maps api error: missingkeymaperror 5 answers i use mamp site in directory - localhost/mysite when have error in console: "google maps api error: missingkeymaperror " i go google api console, make new project, create new api key, insert key in site: <script src="https://maps.googleapis.com/maps/api/js?key=my-key" type="text/javascript"></script> but error not go away i tried bunch of options create different keys activate different service api, making keys browser error on map "oops, went wrong.." , "missing-key-map-error" not go away upd if move site directory localhost/mysite2/ then works expected without api key! where api checks directory of work , not? as per google recent announcement, http://googlegeodevelopers.blogspot...

JS working on local but not on live server WordPress? -

i developing theme , using custom js feature client. working fine on local server not showing @ on live server, can 1 guide me going wrong ? there server related things keep in mind or thing else have achieve ??? here how doing ? <?php //getting custom js code $custom_js = get_option(path."_custom_js"); if(!empty($custom_js)) { ?> <script> <?php echo $custom_js ; ?> </script> <?php } ?> am doing write thing ? if thing wrong let me know well, wanting want provide option custom js client. check path . remember absolute , relative path

javascript - Using a Custom Filter in AngularJs -

Image
i relatively new angularjs , came across problem when using orderby: in regards sorting objects, borrowed custom filter sort objects not understanding correct syntax use filter appropriately wont sort key in object want to: js: <tbody ng-repeat="(field, profile) in currentsample.dsprofile | orderbyobject:'profile[display-name]' track $index"> <tr ng-style="$index % 2 === 0 && {'background-color': '#ffffff'} || $index % 2 === 1 && {'background-color': '#f9f9f9'}"> <td style="width: 19%; margin: 2px; padding: 0px;" ng-style="profile['shown-in-details'] == true && {'background-color': 'gold'} || profile['shown-in-details'] == false && {'background-color': 'transparent'}"> <span c...

javascript - How to abort ajax request -

in below code if input search vale empty , search keyword same means if entered 'abc' got result again clicked need abort ajax request, had written in beforesend method browser throwing error "cannot read property 'abort' of undefined" ajax code: function makerequest() { var searchtext=''; var popuprequest = $.ajax({ url:"cnc/cncstorelocator", type:'get', cache:false, data: {searchcriteria : $('#cnc-searchcriteria').val()}, datatype: 'json', beforesend: function(){ if(searchtext == '' && searchtext == searchdata) { popuprequest.abort(); } }, success : function(cncstorelocatordata) { var store=null; (var = 0; < cncstorelocatordata.length; i++) { var loc = ...

asp.net mvc 5 - How can I add .htm at the end of URL in when using attribute routing in MVC 5 -

[route("{page?}/{category?}/{detail?}")] public actionresult index(string page, string category, string detail) { navigation _nav = nav.getitembyalias(module_code, page, "vn"); viewbag.template = _nav.template_code; viewbag.page = page; viewbag.category = category; viewbag.detail = detail; viewbag.lang = "vn"; if(_nav.template_code == "goldencity_news" && detail != null && detail != "") { viewbag.template = _nav.template_code + "_detail"; } return view(); } normally. local:port local:port/home local:port/page/category local:port/page/category/detail all above right but, when change (add .htm @ route config) [route("{page?}/{category?}/{detail?}.htm")] public actionresult index(string page, string category, string detail) { navigation _nav = nav.getitembyalias(m...

ios - Firebase Remote Config App Version condition -

Image
the firebase remote config app version condition seems ignored. i've made following setup play around current development version: xcode version setup: firebase remote config condition setup: firremoteconfig won't return right paramater values. its known bug - instead of version value fb use build value. possible workaround - put same value build. in case should "version: 1.1.8" , "build: 1.1.8". or use build value , keep value updated every app release.

Mutual Exclusion not happened in Ruby -

program: def inc(n) n + 1 end sum = 0 threads = (1..10).map thread.new 10_000.times sum = inc(sum) end end end threads.each(&:join) p sum output: $ ruby mutualexclusion.rb 100000 $ my expected output of above program less 100,000. because, above program create 10 threads , each of thread update shared variable 'sum' 10,000 times. during execution of program, mutual exclusion happen. because, mutual exclusion not handled here. expect less 100,000 output. gives 100,000 output. how happened ? handle mutual exclusion here ? , how experiment problem(me). the default interpreter ruby (mri) doesn't execute threads in parallel. mechanism that's preventing race condition introducing casually unexpected behavior global interpreter lock (gil). you can learn more this, including similar demonstration, here: http://www.jstorimer.com/blogs/workingwithcode/8085491-nobody-understands-the-gil

ios - iPad HTML5 Video tag list and scrolling issue -

i building cross platform application based on phonegap. testing app on ipad, using angularjs. i have created list of media files using ng-repeat below: <div ng-repeat="media in mediaarray" style="width:200px; height:200px;"> <img ng-src="{{media.imgsrc}}" ng-hide="media.isvideo" style="width:200px; height:200px;" > <video id="video{{media.id}" ng-show="media.isvideo" postersrc="test.png" poster-src <!-- directive poster source fix --> controls style="width:200px; height:200px;" > <source type="video/mp4" videosrc="{{media.videourl}}" video-src <!-- directive video source fix --> > browser not support html5 video. ...

javascript - How to change marker postion on Google Map API -

Image
i using google map on site , here google map code: <script src='https://maps.googleapis.com/maps/api/js?v=3.exp'></script> <div style='overflow:hidden;height:440px;width:700px;'> <div id='gmap_canvas' style='height:440px;width:700px;'></div> <style> #gmap_canvas img { max-width: none!important; background: none!important } </style> </div> <script type='text/javascript'> function init_map() { var myoptions = { zoom: 10, center: new google.maps.latlng(51.5073509, -0.12775829999998223), maptypeid: google.maps.maptypeid.roadmap }; map = new google.maps.map(document.getelementbyid('gmap_canvas'), myoptions); marker = new google.maps.marker({ map: map, position: new google.maps.latlng(51.5073509, -0.12775829999998223) }); in...

web services - Java-Missing WS-Addressing header: "{http://www.w3.org/2005/08/addressing}Action" -

i try client web service in java 7. it: warning: required header representing message addressing property not present, problem header:{ http://www.w3.org/2005/08/addressing }action com.sun.xml.internal.ws.addressing.model.missingaddressingheaderexception: missing ws-addressing header: "{ http://www.w3.org/2005/08/addressing }action" how can solve error? thanks lot. --web service security looks following parts in soapui-- <wsse:security soapenv:mustunderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsse:usernametoken wsu:id="usernametoken-1"> <wsse:username>gelistirici</wsse:username> <wsse:password type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#passwordtext...

html - Bootstrap Grid and column offset -

Image
i've following html: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/> <div class="container"> <div class="row"> <div class="col-sm-5"> .col-sm-5 </div> <div class="col-sm-5 col-sm-offset-2"> .col-sm-5 .col-sm-offset-2 </div> </div> </div> which result following: according bootstrap docs should fit row. there somethin wrong, can't figure out. when take 11-columns account fits (notice col-sm-4 on last div instead of col-sm-5): <div class="container"> <div class="row"> <div class="col-sm-5"> .col-sm-5 </div> <div class="col-sm-4 col-sm-offset-2"> .col-sm-5 .col-sm-offset-2 </div> </di...

javascript - Want to implement countdown timer in php -

i have use following code countdown timer in php page.it's works fine, problem not take time database. if insert 20 (datatype time) table , run php code takes 13hr , time changes depending on system time. have failed understand logic of takes. please help...! thanks. $t1=mysql_query("select * mst_test test_id='$tid'"); $t2=mysql_fetch_row($t1); $_session['targetdate']=$t2[4]; $targetdate = $_session['targetdate']; } else { // no session variable, red mysql $result=mysql_query("select * mst_test test_id='$tid'"); $time=mysql_fetch_row($result); $dateformat = "d f y -- g:i a"; $targetdate = $time['time']; $_session['targetdate'] = $targetdate; } $actualdate = time(); $secondsdiff = $targetdate - $actualdate; $remainingday = floor($secondsdiff/60/60/24); $remaininghour = floor(($secondsdiff-($remainingday*60*60*24))/60/60); $remainingminutes = floo...

wordpress - Get featured images from custom taxonomy terms -

oke, first of downloaded this plugin . enables me give custom taxonomy terms image. works great. way theme setup , way plugin wants work, isn't me. i want images show in place should. that's why used terms (categories). because can use code: <?php //list terms in given taxonomy $taxonomy = 'our_team'; $tax_terms = get_terms($taxonomy); ?> <ul> <?php foreach ($tax_terms $tax_term) { echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf( __( "view posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name.'</a></li>'; } ?> </ul> that shows names of team members when activated them (checked box) in post, , not in other places. now able use similar code featured images. plugin uses code thumbnails. print apply_filters( 'taxonomy-images-list-the-terms', '', array( ...

angular - Latest angular2 form -

i have angular2 version debounce input control, template below. <input type="text" [ngformcontrol]="compinput" placeholder="demo input" /> in component.ts import {component} "angular2/core"; import {control} "angular2/common"; @component({ ... ) export class demo{ private compinput = new control(); constructor(){ this.compinput.valuechanges.subscribe(() => {}); } } these code works until upgrade angular2 version latest. seems form usage has changed. i changed [ngformcontrol] ngcontrol , control formcontrol "@angular/forms", doesn't work. does know wrong new usage , how fix? here's simple example using ngmodel import {component, input, output, hostlistener, eventemitter, changedetectionstrategy} '@angular/core'; import {observable} 'rxjs/observable'; import {subject} 'rxjs/subject'; @component({ moduleid: module.id, selector: 'user-searc...

java - android : Is it possible to inherit from MainActivity class? -

i started learning java , android development week ago , have couple of basic things i'd want know. the functioning of app has 10 buttons , each of them disabled after has been clicked once. if total of 5 buttons have been clicked, buttons must disabled. didn't use button array, want know why doesn't work. (all necessary imports have been made) the mainactivity class goes this: public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); starttext(); } class1 c1object = new class1(); textview textobj; button button1,button2,button3,button4 /* other 6 buttons*/ ; public void starttext(){ textobj = (textview)findviewbyid(r.id.textview); textobj.settext("no button has been clicked"); } public void click1(view view) { button1 = (button)findviewbyid(r.id.button1); c1object.disablebutton(butt...

android - Parsing data in deep link -

in application, using deep linking. here flow of application, on registration user gets email web http://test.abc.com/testing?email=ywtzlmtuaxqxmta4qgdtywlslmnvbq== but on web side there deep uri along details abc://testing/email/ywtzlmtuaxqxmta4qgdtywlslmnvbq==/id/20 if scheme data returning test.abc.com is possible details of deep uri, in ios there default method returning full url. is there way in android well? yes can full deep link url. you can in target activity intent data : uri data = this.getintent().getdata(); if (data != null && data.ishierarchical()) { string uri = this.getintent().getdatastring(); log.i("yourapp", "deep link clicked : " + uri); }

shell - How fault tolerant cron job is? -

i using cron job schedule shell script after every 2 minutes containing pig , hive scripts. want know how fault tolerant cron job is, suppose if network goes down or file getting corrupted when job running, cron job gonna ? going restart shell script again or happen. not getting info on over internet. b great if guys help. thanks oozie uses dag , checks data availability when multiple scripts launched share it. oozie allows work easier dependencies pig , hive jobs. integrated yarn less afraid of blowing cluster. if data corrupted cron nothing, wait next execution cycle. might fill que easy cron might lead jobs being executed longer.

json to split in elements in javascript -

{ "name": "chris", "age": "rip", "musketeers": ["athos", "aramis", "porthos", "d'artagnan"], "stooges": [ { "name": "moe" }, { "name": "larry" }, { "name": "curly" } ], "details": { "first": "michael", "last": "jackson" } } output should be: name :chris age :rip musketeers: athos,aramis,porthos,d'artagnan stooges: name:moe name:larry name:curly details: first :michael last:jackson json valid js object. can name: var name=data.name; , musketeers var musketeers = data.musketeers; (var = 0; < musketeers.length; i++) { console.log(musketeers[i]); }

iOS: I get many `UIImage` from network, how can I know their `aspect ratio`? -

how can aspect ratio image comes server? edit:if many image in network, how can them using async function ? , in block aspect ratio ? once download image, create uiimage instance using downloaded data through size property, able determine height , width of actual image downloaded : let image = uiimage(data: <imagedownloadeddata>) let imgwidth = image.size.width let imgheight = image.size.height

ruby on rails 4 - ActionController::UrlGenerationError in Devise::Sessions#new -

i use nav bar (using devise on rails; included in dashboard.html.erb) works fine when logged in; when wanting use in pages , including in application.html.erb, error: actioncontroller::urlgenerationerror in devise::sessions#new additional info: " no route matches {:action=>"index", :controller=>"devise/users"} " this route.rb: rails.application.routes.draw root 'dashboard#index' devise_for :users resources :users how should implement in rails following dry? (am new rails) this navigation bar: <nav class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar">...

angularjs - How to pass a array into webapi function? -

i want pass array webapi. here function getting checkbox selected items in albumnamearray . $scope.delete = function () { debugger $scope.albumnamearray = []; angular.foreach($scope.inboxlist, function (cu) { if (cu.selected) $scope.albumnamearray.push(cu.inboxmailid); }) } now want send albumnamearray webapi function. have modified delete function not working, wrong in code? $scope.delete = function () { debugger $scope.albumnamearray = []; angular.foreach($scope.inboxlist, function (cu) { if (cu.selected) $scope.albumnamearray.push(cu.inboxmailid); }).$http({ url: "mailroute/deleteselecetedemail", datatype: 'json', method: 'post', data: albumnamearray, headers: { "content-type": "application/json" } }).success(function (response) { debugger if (response !=...

single sign on - Kentor AuthService - Redirect to IDP from Browser URL -

in our asp.net project, using ' kentor.authservices ' saml2 authentication service. testing purpose, using 'kentor.authservices.stubidp'. currently gave anchor tag in page href as: href=@url.content("~/authservices/signin?idp=" + entityid) this works fine , once click anchor tag, gets redirected identity provider: http://localhost:17009//samplepath/authservices/signin?idp=http://stubidp.kentor.se/metadata but need achieve without using anchor tag,where directly enter our site url address in browser, should automatically redirect identity provider. when using httpmodule, use forms authentication setup in web.config cause unauthenticated requests redirected sign in sequence. <authentication mode="forms"> <forms loginurl="~/authservices/signin"></forms> </authentication>

mysql - ODBC call failed - Random date overflow errors after moving from 32-bit ODBC 5.1 to 64-bit 5.3 -

background: legacy code running in ms access 2003. sqls run currentdb in access. currently running on windows 7 32-bit machine. connecting mysql server 5.5 through odbc 5.1 driver. problem: trying migrate windows server 2012 64 bit. odbc 5.3 unicode driver (32 bit). don't want use time rewriting there lot of code, , in not distant future removed. issue: several sql statements fail when running on new servers. worked on old servers. all failed sqls have now() in statement. error description says odbc call failed. while more detailed description says date overflow - "[mysql][odbc 5.3(w) driver][mysqlid-5.5.28-log]date overflow". happens randomly, , when happens , access stops 1 can choose continue , sql work. fails less 1% of times runs (of thousands). the dates in sql in clause: "and fielda > now()", fielda datetime column. recordset sql. error during insert same, integer subtracted now() before compared datetime. i don't und...

javascript - Ordering of compiled TypeScript files with Gulp -

i'm having build pipeline based on gulp. use typescript write angular 1.x code. in general follow such process: write code compile javascript use gulp-inject inject files index.html , use in development environment: a. read files b. apply gulp-narutal-sort have stable ordering of input files next step c. apply gulp-angular-filesort have ordering of files everything worked ok, i've introduced inheritance of clases in typescript. index html has wrong order of dependencies: right.leg.js (has rightleg class declared, child of leg ) left.leg.js (has leftleg class declared, child of leg ) leg.js (definition of leg class) and got errors child classes: right.leg.js:5 uncaught typeerror: cannot read property 'prototype' of undefined that caused ordering of files. question: how resolve kind of file sorting problem? maybe there kind of plugin gulp?

angular - How to parse json on angular2? -

i`ve parsed code, [ {"nodename":"192.124.105.55", "servicelist":[ { "id":"ec9471ec001c10b9fa286e1f52e39c5dc9485a7c2cfbf55145c26242bb98ec4d", "name":"nginx", "status":"online", "servicecontrolled":true }, { "id":"f4ca9e0badc6b23e3e36444bd7ee4a9efcd39de8e0bb4cdecb25b5a02ef86ba5", "name":"memcached", "status":"offline", "servicecontrolled":true }, { "id":"0a4bf3b5bb5f47ece9284052389ae02f6c9dba989ca34086a30e049ee3d8eb47", "name":"celery", "status":"offline", "servicecontrolled":true } ], "storagelist": [ { "mountpoint":"/", ...

haskell - Is there a way to split an InputStream? -

i wonder if there way "split"/"duplicate" system.io.streams.inputstream io-streams package forwarded 2 processing stages? duplicate :: inputstream -> io (inputstream a, inputstream a) i can see doesn't work demand driven nature of streams, canonical solution if need several things processed? build pipeline "writes side"? like: input >>= countevents countioref >>= logevents loggerref >>= output i go arrow route , store in tuples, going dirty , knowledge there no arrow interface io-streams : input >>= (countevents *** logevents) >>= output any recommendations? you can number of ways, since countevents , logevents both folds on stream, repeated applications of outputfoldm simplest. aren't looking way split stream way link folds. outputfoldm turns stream new stream associated result of applying repeated fold operation it, writing result 'to side' say. >>> let logger = i...

javascript - toExponential() on Infinity number -

i'm trying first 7-8 numbers after digit on number infinity . i.e. console.log((4^3)/(3^3)); result in infinity while real result 2.370370370... . want number in 2.370370370e+-60 form. i tried make result.toexponential(8); no effects far. tips/answers appreciated. in javascript, exponentiation made math.pow function. there no inline operator ^ (as in python ** ). you should instead compute math.pow(4, 3) / math.pow(3, 3) a part that, you computing (4 xor 3) / (3 xor 3) , evaluates 7 / 0, infinity .

php - How to rewrite the my URL like sub domain by using .htaccess -

hi website http://techiesbadi.tk/ here rewrite url test.techiesbadi.tk http://techiesbadi.tk/index.php?sitename=test i used .htaccess code options +followsymlinks rewriteengine on rewritebase / rewriterule ^([aa-zz])$ index.php?sitename=$1 rewritecond %{http_host} ^(^.*)\.techiesbadi.tk rewriterule (.*) index.php?sitename=%1 but problem when redirect test.techiesbadi.tk gives webpage not available dns_probe_finished_nxdomain is there mistake in code please me. you can see website http://techiesbadi.tk/ here implemented mechanism sub domain creation. thanks in advance. i don't see good reason this, it's possible wildcard dns. currently in dns setup you'd have like: techiesbadi.tk. 14273 in 31.220.16.205 if add this: *.techiesbadi.tk. 14273 in 31.220.16.205 hence, requests subdomain of site still route. can parse subdomain within apache's rules, php, whatever.

python - Taking the difference between two dates using pandas? -

i trying take time difference between 2 dates using pandas , having trouble. the format dates in follows: 2016/07/06 03:10:39 using pandas.to_datetime can these datetime64 type cannot figure out way take difference of these types. here basis of code: df2.end = to_datetime(df1.end) df2.start = to_datetime(df1.start) if print these objects dataframe here get: series([], name: end, dtype: datetime64[ns]) series([], name: start, dtype: datetime64[ns]) end: 0 2016-07-06 04:39:16 1 2016-07-06 04:13:30 2 2016-07-06 03:51:30 start 0 2016-07-06 05:01:14 1 2016-07-06 04:39:06 2 2016-07-06 04:13:27 i have tried following: df2.difference = df2.end-df2.start and following error: typeerror: ufunc subtract cannot use operands types dtype('<m8[ns]') , dtype('o') that's work perfectly: >>> import pandas >>> x = pandas.to_datetime("2016/07/06 03:10:39") >>> y = pandas.to_datetime(...

node.js - Mongoose is not recreating the index collection is dropped -

i know should removeall documents instead of dropping collection. why mongoose not recreate index after collection dropped? i have schema in 1 of fields has unique:true set. index created when start server. if drop collection, , new records come, collection recreated , records inserted. but, index unique field not created again. why so? how ask recreate index? it has nothing unique . if drop index in mongodb, have restart node. when application starts up, mongoose automatically calls ensureindex each defined index in schema. mongoose call ensureindex each index sequentially, , emit 'index' event on model when ensureindex calls succeeded or when there error. while nice development, recommended behavior disabled in production since index creation can cause significant performance impact. nevertheless, in development mode, can recreate indexes in method (for example method tied route or event) with: (mongodb > 3.0) db.collection.createin...

No Gradle "build" task despite build.gradle applying plugin com.android.application -

somehow don't have build task: $ ./gradlew tasks --all :tasks ------------------------------------------------------------ tasks runnable root project ------------------------------------------------------------ build setup tasks ----------------- init - initializes new gradle build. [incubating] [wrapper] wrapper - generates gradle wrapper files. [incubating] tasks ---------- components - displays components produced root project 'apps-android-commons'. [incubating] dependencies - displays dependencies declared in root project 'apps-android-commons'. dependencyinsight - displays insight specific dependency in root project 'apps-android-commons'. - displays message. model - displays configuration model of root project 'apps-android-commons'. [incubating] projects - displays sub-projects of root project 'apps-android-commons'. properties - displays properties of root project 'apps-android-commons'. tasks - displays tasks runn...

javascript - jQuery fadeIn() between if and else -

i want fade between different images loaded when different things happen. created if, else rules , thought can tell jquery fadein() fade in every new image. it's not working , don't know why. think it's super little code thing can't figure out. hope guys can me! here code far: if(count == 1){ $('.star').html('<img src="' + stern1 + '">').delay(1000).fadein('slow'); } else if (count == 2){ $('.star').html('<img src="' + stern2 + '">').delay(1000).fadein('slow'); } else if(count == 3){ $('.star').html('<img src="' + stern3 + '">').delay(1000).fadein('slow'); } else if(count == 4){ $('.star').html('<img src="' + stern4 + '">').delay(1000).fadein('slow'); } else if(count == 5) { $('.star').html('<img src="' + stern5 + '"...

xaml - Xamarin C# Double Binding Source -

is possible have 2 sources of binding? element such cellview? i searched , tried several possibilities had in mind without able want do. seems simple however.. let says have page (i put simple code, bit long, not hard): mainpage.cs public partial class courseshistory : contentpage { // course it's element "data template" listview private class course { public string date { get; set; } public string destination { get; set; } private string _price; public string price { { return this._price; } set { this._price = "€" + value; } } } // fontattribute it's other element not set itemssource, used cell fontfamily ask, fontsize etc private class fontattributes { public string moon_family_alien_bold { get; set; } .... public fontattributes() { .... } } public fon...