Posts

node.js - Node appendFile not appending data chunk to file on filesystem -

i have program trying values request using curl , store them in file , serve stored content back. decision store or append contents in file based on query parameter appendflag when run program getting in console " true " , " appending " suggests indeed reads flag goes if part somehow appendfile function not working. var http = require('http'); var url = require('url'); var querystring = require('querystring'); var fs = require('fs'); http.createserver(function(request,response){ var str = request.url.split('?')[1]; var query = querystring.parse(str); var writestream = fs.createwritestream(query['filename']); console.log("query - "); console.log(query["appendflag"]); request.on('data',function(chunk){ if(query["appendflag"]=="true"){ console.log("appending"); fs.appendfile(query['filename'],c...

css - Where need to set display block and where not -

Image
my question need set display:block; element? use in header section , footer question have box inside images , text there need set display block header,section,footer{display:block;} set ul class elements? posible no set display block .box{display:block;} here brief detail inline & block elements.... inline elements: respect left & right margins , padding, not top & bottom cannot have width , height set allow other elements sit left , right. block elements: respect of those force line break after block element inline-block elements: allow other elements sit left , right respect top & bottom margins , padding respect height , width examples of block elements: <p>, <div>, <form>, <header>, <nav>, <ul>, <li>, , <h1>. examples of inline elements: <a>, <span>, <b>, <em>, <i>, <cite>, <mark>, , <code>. see article on ...

c# - Admob WP8 System.UnauthorizedAccessException -

i developing wp8 app using vs2012. wish add admob banner ads, unfortunately raising exception causing app freeze. catch admob exception, had disable 'just code' vs2012 setting, , after executing following code, 'system.unauthorizedaccessexception: access denied' @ last line. _adcontrol = new adview { format = adformats.smartbanner, adunitid = "ca-app-pub-31231-fake-fake-fake" }; _adcontrol.verticalalignment = verticalalignment.top; _adcontrol.failedtoreceivead += adcontrolonerroroccurred; adrequest adrequest = new adrequest(); gamepage.layoutgrid.children.add(_adcontrol); _adcontrol.loadad(adrequest); if enable 'id_cap_identity_device' , 'id_cap_identity_user', google docs state not required, start receiving 'system.exception' instead of 'system.unauthorizedaccessexception'. can not figure out how can fixed, if possible.

sql - How to calculate the longest winning streak with daterange -

i have table in sql server consists of data like userid amount startdate enddate game result ------------------------------------------------------------------------------- 68838 51.00 2014-05-29 15:41:41.167 2014-05-29 15:41:41.167 1 w 68838 51.00 2014-05-29 15:42:30.757 2014-05-29 15:42:30.757 1 w 68838 -0.50 2014-05-31 16:57:31.033 2014-05-31 16:57:31.033 1 l 68838 -0.50 2014-05-31 17:05:31.023 2014-05-31 17:05:31.023 1 l 68838 -0.50 2014-05-31 17:22:03.857 2014-05-31 17:22:03.857 1 l 68838 0.42 2014-05-31 17:26:32.570 2014-05-31 17:26:32.570 1 w 68838 0.42 2014-05-31 17:34:45.330 2014-05-31 17:34:45.330 1 w 68838 0.42 2014-05-31 17:38:44.107 2014-05-31 17:38:44.107 1 w 68838 0.42 2014-05-31 17:42:12.790 2014-05-31 17:42:12.790 1 w 434278 0.42 2014-05-31 16:57:31.033 2014-05-31 16:57:31.033 1 w 434278 0.42 2014-05-31 17:05:31.023 2014-05-31 17:05:31.023 1 w 434278 0.42 2014-05-31...

Php and strings inside code -

i have 1 code , when execute code let other thing , example : <?php if ($ending=="ok") { $insert_end="ok"; } if ($insert_end=="ok") { print "ok"; } ?> but if go url , put example : http://www.domain.com/index.php?insert_end=ok execute code , don´t want possible because if people know can execute code , it´s possible no let execute code when put in url thank´s regards disable register_globals in php.ini file. should not used reason.

jquery - Page load actions in angular -

i jquery background working on angular application currently. want include code did on page load in jquery store arrays in sessionobject. e.g. $(document).ready(function(e) { storage.prototype.setobj = function(key, obj) { return this.setitem(key, json.stringify(obj)) } storage.prototype.getobj = function(key) { return json.parse(this.getitem(key)) } }); how can same in angular application. in advance. you can using init function. in html file add following code - <div ng-app="myapp"> <div ng-controller="myctrl" ng-init="init()"> </div> </div> then in main.js file, following - var app=angular.module("myapp",[]) app.controller("myctrl",function($scope){ $scope.init(function () { // add code here }) })

javascript - Refresh textfield after submitting -

i have code submits database without refresing, problem when sent, variables still remains in textfield <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> <script> $(document).ready(function(){ $("form").on('submit',function(event){ event.preventdefault(); data = $(this).serialize(); $.ajax({ type: "post", url: "insert.asp", data: data }).done(function( msg ) { }); }); }); </script> i thinking if there's way variables disappear textfiled after been sent database , bring alert fades automatically when data saved. i think you'll want add desired behavior in callback following ajax request. you're using "done" callback, in understanding execute whenever ajax call completes, regardless of success or failure. if that's desire, add textfield clearing , alert code within callback, otherwise ...