Posts

javascript - Need an example of Streaming mySql module with Node & Express -

can provide example of streaming large data sets 'mysql' module, node , express? there documentation, don't understand how query data in smaller segments because don't see examples. appreciated. query works, takes long time because table huge. query works, want request return lets 1,000 rows @ time can start populating data. link streaming queries documentation here. here code: const mysql = require('mysql'); const express = require('express'); const app = express(); const connection = mysql.createconnection({ host: 'us-cdbr-azure-east-a.cloudapp.net', database: 'eagertobp', user: ******, password: *******, port: '3306' }); connection.connect(function(err) { if(err) { console.log('error') } else { console.log('connected'); } }); app.get('/', function(req,resp) { connection.query("select * submissionanalytics"); console.log('test'); connection ....

android - appending values each time when calling JNI method -

i using jni fetch signature of apk , getting well. when calling method java first time getting exact value. calling again getting appended values exact value (eg 1234456123456). pfb code using char* getsignaturemd5(jnienv* env, jobject obj) { char* sign = loadsignature(env, obj); md5_ctx context = { 0 }; md5init(&context); md5update(&context, (unsigned char*)sign, strlen(sign)); unsigned char dest[16] = { 0 }; md5final(dest, &context); int i; static char destination[32]={0}; (i = 0; < 16; i++) { sprintf(destination, "%s%02x", destination, dest[i]); } return destination; } gettoken jni method jniexport jstring jnicall java_com_sign_signaturecapturesbi_myadapter_gettoken(jnienv *env, jobject obj) { char* signvalue = getsignaturemd5(env, obj); __android_log_print(android_log_verbose, "myapp", "signvalue %s...

c++ - Initializing a static const for a template specialization -

i have created class template static const element. intent each specialization of template have own version / value of static element. here sample code: template < typename t > class c { public: static const std::string name; t something; void printname() { std::cout << name << std::endl; } }; class c1 : public c< int >{}; class c2 : public c< char >{}; template<> const std::string c< int >::name{ "my int" }; // compiles template<> const std::string c< char >::name{ "my char" }; // compiles //template<> const std::string c1::name{ "my int" }; // doesn't compile //template<> const std::string c2::name{ "my char" }; // doesn't compile //const std::string c1::name{ "my int" }; // doesn't compile //const std::string c2::name{ "my char" }; // doesn't compile int main() { c1 c1; c2 c2; c1.printname(); ...

c# - Leave open socket with ssl stream -

i'm using ssl stream , make https soap request each action need. can leave channel open, , not send certificate each time, , wait hand shake? this code i'm using: static void runclient(string hostname, int port, x509certificate2collection certificates) { // create tcp/ip client socket. // machinename host running server application. tcpclient client = new tcpclient(hostname, port); console.writeline("client connected."); // create ssl stream close client's stream. sslstream sslstream = new sslstream( client.getstream(), false, validateservercertificate); // server name must match name on server certificate. try { sslstream.authenticateasclient(hostname, certificates, sslprotocols.default, true); displaysecuritylevel(sslstream); displaysecurityservices(sslstream); displaycertificateinformation(sslstream); displaystreamproperties(sslstream); } catch...

ios - how to use my location(latitude,longitude) of CLLocation at viewdidload() -

func locationmanager(manager: cllocationmanager, didupdatelocations locations: [cllocation]) { let userlocation: cllocation = locations[0] let center = cllocationcoordinate2d(latitude: userlocation.coordinate.latitude, longitude: userlocation.coordinate.longitude) mylat = userlocation.coordinate.latitude mylong = userlocation.coordinate.longitude let region = mkcoordinateregion(center: center, span: mkcoordinatespan(latitudedelta: 0.04, longitudedelta: 0.04)) totalmap.setregion(region, animated: true) } first.. i'm sorry english writning... i used mylat , mylong in func .. want add user location global variable , use user location in viewdidload .. actually need user location(lat,long) , many other location, , use comparing opration 2 location, , need of location .. help me the cllocationmanager works asynchronously. can use in viewdidload() not might think. you can register callback this: var onloc...

printing html entities using lxml in python -

i'm trying make div element below string html entities. since string contains html entities, & reserved char in html entity being escaped &amp; in output. html entities displayed plain text. how can avoid html entities rendered properly? s = 'actress adamari l&#243;pez , amgen launch spanish-language chemotherapy: myths or facts&#8482; website , resources' div = etree.element("div") div.text = s lxml.html.tostring(div) output: <div>actress adamari l&amp;#243;pez , amgen launch spanish-language chemotherapy: myths or facts&amp;#8482; website , resources</div> you can specify encoding while calling tostring() : >>> lxml.html import fromstring, tostring >>> s = 'actress adamari l&#243;pez , amgen launch spanish-language chemotherapy: myths or facts&#8482; website , resources' >>> div = fromstring(s) >>> print tostring(div, encoding='unicode') <p...

excel formula: sum elements in column a where column b has an even number -

Image
i'm trying come excel formula sum elements in column corresponding element in column b number. i've tried various permutations of sumif() without luck far. specifically, i'm not sure how specify criteria match numbers in cells in range. or maybe there's way entirely. thanks in advance! you can use mod , sumifs functions in way: the result in cell d1. note have semicolons (;) instead of commas in formula.