Posts

Featured post

how to run a query SQL in node.js mysql -

i have syntax problem in module, fail sql query. i initialize module database in file.js, responds console.log 'connected database', sends data module in database.newdata(data), when enters in runquery nothing happens, no errors or result, nothing! i in runquery if query ok , if this, think happens there error in logic of node, idea connect database , use runquery run query pass. file.js var db = require('./modules/database'); var database = new db(); database.newdata(data); database.js var mysql = require('mysql'), queries = require('./queries'), connection; var db = function(){ var db_config = { host: 'localhost', user: 'diegoug', password: 'qwertyuiop', database: 'test' }; connection = mysql.createconnection(db_config); connection.connect(function(err) { if(err) { console.log('error when connecting database:', err);

Forcing .NET framework 3.5 in Microsoft Visual C# 2012 -

Image
because of compatibility reasons, need compile project under .net 3.5. microsoft visual c# 2012 not offer option. i'm getting compiler error: the type 'system.action' defined in assembly not referenced. must add reference assembly 'system.core, version= 3.5.0.0 for code: powertrader.powerstartedcallback = delegate { emergencymode(false); }; powertrader.powerstoppedcallback = delegate { emergencymode(true); }; this available selection in ide: what should do? portable class libraries .net 4+ only. not support .net 3.5. you have create normal class library project instead.

windows - Input validation Javascript -

in windows 8 javascript app i'm trying validate user's input , keep results on screen after user presses apply using following: <form> <input id="test" type="number" min="1" max="10" /> <button id="button" type="button">apply</button> </form> but when click apply validation doesn't work. works if replace type="button" type="submit" . problem submit refreshes page , results disappear. can do? here example of i'm trying do: jsfiddle update: i changed code this: <buton id="button" type="submit" onsubmit="dotest(); return false;">apply</button> but still refreshes page. form validation not fire until onsubmit event fires, behavior designed. one thing set have "onsubmit" event, change button submit type, in onsubmit function call event.stoppropigation stop page doing full postback.

python 2.7 - Trying to extract from the deep node with scrapy, results are bad -

Image
as beginner i'm having hard time, i'm here ask help. i'm trying extract prices html page, nested deeply: second price location: from scrapy.spider import spider scrapy.selector import selector mymarket.items import mymarketitem class myspider(spider): name = "mymarket" allowed_domains = ["url"] start_urls = [ "http://url" ] def parse(self, response): sel = selector(response) titles = sel.xpath('//table[@class="tab_product_list"]//tr') items = [] t in titles: item = mymarketitem() item["price"] = t.xpath('//tr//span[2]/text()').extract() items.append(item) return items i'm trying export scraped prices csv. export being populated this: and want them sorted in .csv: etc. can point out faulty part of xpath or how can make prices sorted "properly" ? it

ios - Saving pictures to parse -

my project save data parse , while can pick image library cannot open camera. found tutorial not compatible code. link tutorial here: tutorial . using .storyboard , tutorial .xib, not know if change anything. my .m file here: #import "newrecipeviewcontroller.h" #import <mobilecoreservices/utcoretypes.h> #import <parse/parse.h> #import "mbprogresshud.h" @interface newrecipeviewcontroller () - (ibaction)save:(id)sender; - (ibaction)cancel:(id)sender; @property (weak, nonatomic) iboutlet uiimageview *recipeimageview; @property (weak, nonatomic) iboutlet uitextfield *nametextfield; @property (weak, nonatomic) iboutlet uitextfield *preptimetextfield; @property (weak, nonatomic) iboutlet uitextfield *ingredientstextfield; @end @implementation newrecipeviewcontroller - (id)initwithstyle:(uitableviewstyle)style { self = [super initwithstyle:style]; if (self) { // custom initialization } return self; } - (void)viewdidload {

javascript - Send Custom HTTP Body with AJAX POST request -

how send custom http body post ajax request in plain javascript (not jquery)? trying send json file in body. can set custom header fields can't find how set http body. below code function calculateorder() { document.getelementbyid("finalize").style.display = "inline"; url1 = "https://ethor-prod.apigee.net/v1/stores/"; url2 = "/orders/calculate?apikey=wsgbv9pe8ajhdoi17vvtux1nlaceuxg7"; url = url1 + store_id + url2; var xmlhttp; xmlhttp = new xmlhttprequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) { alert(xmlhttp.responsetext); } } xmlhttp.open("post", url, true); xmlhttp.setrequestheader("content-type", "application/json"); xmlhttp.send(json.stringify(calculate)); } when used same headers , json file rested (a osx http client) works perfectly add par

codenameone - EDT violation on Codename One -

with code: protected void second_buttonaction(component c, actionevent event) { connectionrequest cn = new connectionrequest(); cn.seturl(theurladdress); cn.setpost(false); cn.addargument("name", "this"); networkmanager.getinstance().addtoqueueandwait(cn); cn.getresponsedata(); } i keep getting following: edt violation detected! com.codename1.impl.javase.javaseport$edtviolation: edt violation stack! @ com.codename1.impl.javase.javaseport.checkedt(javaseport.java:344) edt violation detected! edt violation detected! edt violation detected! @ com.codename1.impl.javase.javaseport.isnativeinputsupported(javaseport.java:2459) @ com.codename1.ui.display.isnativeinputsupported(display.java:2306) @ com.codename1.ui.textarea.settext(textarea.java:406) @ com.codename1.ui.textarea.<init>(textarea.java:328) @ com.codename1.ui.textarea.<init>(textarea.java:257) @ com.codename1.ui.dialog.show(dialog.java:771) @ com.codename1.ui.dialog.show(di