Posts

http - Synchronous Blocks in Node.js -

i want know if it's possible have synchronous blocks in node.js application. i'm total newbie node, couldn't find answers behavior i'm looking specifically. my actual application little more involved, want support request , post request. post request append item array stored on server , sort array. request return array. obviously, multiple gets , posts happening simultaneously, need correctness guarantee. here's simple example of code theoretically like: var arr = []; app.get(/*url 1*/, function (req, res) { res.json(arr); }); app.post(/*url 2*/, function (req, res) { var itemtoadd = req.body.item; arr.push(itemtoadd); arr.sort(); res.status(200); }); what i'm worried request returning array before sorted after item appended or, worse, returning array as it's being sorted. in language java use readwritelock. i've read node's asynchrony, doesn't appear arr accessed in way preserves behavior, i'd love proven wr...

javascript - How to post text variable in angular to mysql trough php -

so have little bit tricky or rather odd situation. i have php , mysql database, frontend using angular.js so creating service, sends data, via post request php. so working when sending input values via name html attribute. but problem appears when trying send hardcoded text variable loop. i know it's hardcoded way doing don't know how differently. so here php <?php $conn = mysqli_connect('localhost','nemkeang','nemkic23','interventure'); if(!$conn) { die("connection failed: " . mysqli_connect_error()); } $text = $_post['first_name']; $text2 = $_post['last_name']; $text3 = $_post['date']; $text4 = $_post['author']; $text5 = $_post['note']; $text6 = $_post['skill']; $target = "/assets"; $target = $target . basename( $_files['cv_file_name']['name']); //this gets other information form $file_name= $_files['cv_file_name']['name...

django - ImportError :No module named pandas -

i trying deploy app amazon web service ebs , when open it, keeps prompting me error. importerror @ /safeplace/location/ no module named pandas request method: request url: http://usafe2.epnjkefarc.us-west- 2.elasticbeanstalk.com/safeplace/location/?lat=-37.877010&lng=145.044267 django version: 1.10.6 exception type: importerror exception value: no module named pandas exception location: /opt/python/current/app/api/views.py in <module>, line 15 python executable: /opt/python/run/venv/bin/python python version: 2.7.12 python path: ['/opt/python/run/venv/lib64/python2.7/site-packages', '/opt/python/run/venv/lib/python2.7/site-packages', '/opt/python/current/app', '', '/opt/python/run/baselinenv/local/lib64/python2.7/site-packages', '/opt/python/run/baselinenv/local/lib/python2.7/site-packages', '/opt/python/run/baselinenv/lib64/python2.7', '/opt/python/run/baselinenv/l...

java - unable to insert a row of data into a mysql table using and android application -

im making project in android studio uni can insert , receive data sql database hosted on godaddy. have been trying many tutorials little progress. project in current state capable of connecting , can query database existing inputs; unable perform insert action. believe issue lies java code rather php scripts. tutorial using is: http://easyway2in.blogspot.co.uk/2015/07/android-mysql-database-connect.html#comment-form appreciated. backgroundtask.java within backgroundtask.java file, method called register believe issue. import android.app.alertdialog; import android.content.context; import android.os.asynctask; import android.widget.toast; import java.io.bufferedreader; import java.io.bufferedwriter; import java.io.ioexception; import java.io.inputstream; import java.io.inputstreamreader; import java.io.outputstream; import java.io.outputstreamwriter; import java.net.httpurlconnection; import java.net.malformedurlexception; import java.net.url; import java.net.urlencoder; p...

node.js - Mongoose: Running Scheduled Job Query by Date -

i want create scheduled job patients in hospital. patients informed every month reg_date . i'm using new date().getdate() inside scheduled jobs run @ 8.00 in morning send sms patients. meanwhile, had been using string format date save reg_date in mongodb. here snippets of mongodb docs : { customer: "john", reg_date: "2017-02-17t16:39:26.969z" } i've ben surfing solutions turns out nothing, decided post myself. here trying : customer.find({"reg_date.getdate()" : new date(2017, 03, 17).getdate()}) .then(function(data) { (var key in data.length) { sendthesms(key[data]); }; }); e.g: doing "i want every patient register @ 17th day of month , send them sms". any appreciated. :d for type of bit complex query need use aggregation method instead regular find method. $project project fields, here creating new temporary field day date of reg_date . query using new field day , resul...

angularjs - Angular error, in npm build [$injector:nomod] Module 'testApp' is not available -

studying , practicing npm build, im trying compile script using npm run build , got error [$injector:nomod] module 'testapp' not available! either misspelled module name or forgot load it. if registering module ensure specify dependencies second argument. any advice. app.js import angular 'angular'; import 'angular-ui-router'; import './services/router.js'; angular.module('testapp', [ 'ui-router' ]); ----------------------------- roter.js 'use strict'; angular .module('testapp') .config([ '$urlrouterprovider', '$stateprovider', '$locationprovider', function($urlrouterprovider, $stateprovider, $locationprovider) { $locationprovider.html5mode(false).hashprefix(''); $urlrouterprovider.otherwise('/'); $stateprovider .state('home', { url: '/', templateurl: 'components/views/homepage.html', ...

How to delete files on the directory via MS SQL Server -

i trying delete file directory inside windows using following query, exec xp_cmdshell 'del "c:\root\sfd_devtracker\'+@deletefile + '"'; when execute command gives following error, incorrect syntax near '+'. in @deletefile variable have filename have delete. have done wrong here? xp_cmdshell requires literal string passed parameter. cannot construct value on fly. try this: declare @cmd nvarchar(max) = 'xp_cmdshell ''del "c:\root\sfd_devtracker\' + @deletefile + '"'''; exec (@cmd)