Posts

Write a map with key as int to json in scala using json4s -

i trying write map in key int json string not able so: import org.json4s._ import org.json4s.jackson.jsonmethods._ import org.json4s.jsondsl._ object myobject { def main(args: array[string]) { // works fine //val mymap = map("a" -> list(3,4), "b" -> list(7,8)) // not work val mymap = map(4 -> map("a" -> 5)) val jsonstring = pretty(render(mymap)) println(jsonstring) } i receiving following error: [error] /my_stuff/my_file.scala:14: overloaded method value render alternatives: [error] (value: org.json4s.jvalue)org.json4s.jvalue <and> [error] (value: org.json4s.jvalue)(implicit formats: org.json4s.formats)org.json4s.jvalue [error] cannot applied (scala.collection.immutable.map[int,scala.collection.immutable.map[string,int]]) [error] val jsonstring = pretty(render(mymap)) [error] ^ [error] 1 error found [error] (compile:compileincremental) compilation failed i vaguely ...

javascript - communicate between a server and a client with node.js -

i have node.js server:- // *********** server receives orders ************ // // use features of http protocol. // var http = require('http'); // initialize empty string. // var req = ""; // create server receive order request. // var server = http.createserver(function(req,res) { res.writehead(200, {'content-type': 'text/plain'}); // when data received, success message displayed. // res.on('data', function(data){ req += data; // received data appended. // console.log("we have received request successfully."); }); }); // error message displayed - error event. // server.on('error', function(e){ console.log("there problem request:\n" + e.message); }); // server listens @ following port , localhost (ip). // server.listen(8000, '127.0.0.1'); and have node.js client:- var http = require("http"); var querystring = require("querystring"); var postor...

mysql - Addition of COUNT to query causes query to get stuck -

Image
edit: simplifying it's trivial example: select count(*) a_table use index(contract) left join b_table on a_table.contract = b_table.contract also, nothing. explain : i have 2 queries identical ( b_table temporary table): select if (b.contract null, 1, null) c a_table left join (select contract b_table) b on a.contract = b.contract this query returns reliably in below .25 seconds. here explain : here same query, count() around if : select count(if (b.contract null, 1, null)) c a_table left join (select contract b_table) b on a.contract = b.contract this 1 shows 'sending data' , @ least after several minutes, seems hang , nothing. here explain : (note d == a_table a , eric_tmp == b_table . not confusing.) this original query caused kerfuffle, above attempt rewrite it: select count(*) a_table not exists (select 1 b_table b a.contract = b.contract) which of course hung. heck going on here? i've tried adding , using non-unique index, do...

com - Executing cscript using IActiveScript with C++ -

i'm trying execute script using cscript iactivescriptparse , parsescripttext reason error: e_unexpected . this article has helped me lot. i'm using getengineguid function in code. the code below i've tried. prints: -2147418113 -2147418113 meaning activescriptparse->parsescripttext returns e_unexpected . doing wrong? #include <iostream> #include <windows.h> #include <objbase.h> #include <activscp.h> using namespace std; int main(int argc, char* argv[]) { coinitialize(null); guid guidbuffer; // find script engine use files end .js extension. // implemented in article linked to. getengineguid(".js", &guidbuffer); iactivescript *activescript; cocreateinstance(guidbuffer, 0, clsctx_all, iid_iactivescript, (void **)&activescript); iactivescriptparse *activescriptparse; activescript->queryinterface(iid_iactivescriptparse, ...

angularjs - Angular ng-table sorting not working in fixed header -

i new angularjs. have created table using ng-table, problem table header sorting not working. sample code attached here. html : (sample ng-table) <table ng-table="tableparams" show-filter="true" class="table"> <thead> <tr>row 1</tr> <tr>row 2</tr> <tr>row 3</tr> <tr>row 4</tr> <tr>row 5</tr> <tr>row 6</tr> </thead> <tbody> <tr ng-repeat="user in $data"> <td sortable="'value1'">{{user.value1}}</td> <td sortable="'value2'">{{user.value2}}</td> <td sortable="'value3'">{{user.value3}}</td> <td sortable="'value4'">{{user.value4}}</td> <td sortable="'value5'">{{user.value5}}...

multipartform data - How to handle FineUploader POST request in Java in PlayFramework? -

i trying integrate fineuploader in play framework code. view part set , working fine. i not clear how retrieve file in controllers upload method. , other query parameters, qquuid, qqfilename, content-type e.tc. following dump of file upload request sent fileuploader:- request headers accept:application/json accept-encoding:gzip, deflate accept-language:en-us,en;q=0.8 cache-control:no-cache connection:keep-alive content-length:1021645 content-type:multipart/form-data; boundary=----webkitformboundaryk8bzisbkkjjqiwq6 dnt:1 host:localhost:9000 origin:http://localhost:9000 referer:http://localhost:9000/computers user-agent:mozilla/5.0 (macintosh; intel mac os x 10_9_4) applewebkit/537.36 (khtml, gecko) chrome/42.0.2311.152 safari/537.36 x-requested-with:xmlhttprequest request payload ------webkitformboundaryk8bzisbkkjjqiwq6 content-disposition: form-data; name="id" 593 ------webkitformboundaryk8bzisbkkjjqiwq6 content-disposition: form-data; name="qquuid" ba...

php - How to get the value from array -

here array i.e., i have given print_r($result); , given below so output given below, here can take fullname by echo $result['structuredxmlresume']['contactinfo']['personname']['fullname']; but while try take employerorg i tried loop i.e., foreach($result['structuredxmlresume']['employerorg'] $x){ echo $x['employerorgname'] . '<br />'; } but don't values even tried print_r $result['structuredxmlresume']['employerorg'][0]; and $result['structuredxmlresume']['employerorg'] both returning empty. how can ? formatted array : /1430714172resume.docxarray ( [resumeid] => array ( [@attributes] => array ( [resumeparserproductname] => recruitplus resume parser ) [resumeparserorgname] => itcons e-solutions private limited ) [structuredxmlresume] => array ( [contactinfo] => array ( [personname] => array ( [fullname] => debra al...