Posts

Showing posts from January, 2014

java - How to run "Eclipse Che" behind NGINX reverse proxy? -

i have installed on server eclipse che , runs on machine when use locally localhost:8080 i make available internet, behind nginx front reverse proxy. here idea: example.com/che/ ---> nginx reverse proxy ---> server:8080/ i tried many different nginx configuration... without success. information, eclipse che embeds tomcat instance rewrite rules: rewriterule ^/api/ext/(.*)$ /ide/ext/$1 [l] rewriterule ^/api/(.*)$ /ide/api/$1 [l] rewriterule ^/$ /dashboard [r] there 3 webapps deployed on tomcat server: ide dashboard swagger if eclipse che behind nginx, above rewrite rules useless , can done directly nginx (that's did) i have 1 single block in nginx configuration (if possible) here tried far, it's not working , eclipse che not load (my guess websockets not proxified, , miss something) basically, tried "proxypass" different webapps, may not best option. location /dashboard { proxy_pass http://localhost:8080/dashboard; proxy_redirect off;

java - How to write ArrayList<Object> to a csv file -

i have arraylist<metadata> , want know if there java api working csv files has write method accepts arraylist<> parameter similar linqtocsv in .net. know opencsv available csvwriter class doesn't accept collection. metadata class public class metadata{ private string page; private string document; private string loan; private string type; } arraylist<metadata> record = new arraylist<metadata>(); once populate record, want write each row csv file. please suggest. surely there'll heap of apis you, why not such simple case? save dependency, thing project of size. create tocsvrow() method in metadata joins strings separated comma. public string tocsvrow() { return stream.of(page, document, loan, type) .map(value -> value.replaceall("\"", "\"\"")) .map(value -> stream.of("\"", ",").anymatch(value::contains) ? "\"

php - Update entity file field -

i have issues update of entity file field on it. don't know can be, because did lot of time, today won't work. entity: <?php namespace appbundle\entity; use doctrine\orm\mapping orm; use symfony\component\validator\constraints assert; /** * consigli * * @orm\table() * @orm\haslifecyclecallbacks * @orm\entity(repositoryclass="appbundle\entity\repository\consiglirepository") */ class consigli { /** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $id; /** * @var string * * @orm\column(name="titolo", type="string", length=255) */ private $titolo; /** * @var string * * @orm\column(name="testo", type="text") */ private $testo; /** * @var string $image * @assert\file( maxsize = "60000000", mim

ruby on rails - 'Where-in' query in postgresql for two different queries showing same result -

i have active record assosciation relation follows. @tasks = #<activerecord::associationrelation [#<task id: 3130, title: "commit @ least 1 small win today", content: "when check-in on app lets me acknowledge m...",created_at: "2016-01-13 01:36:15", updated_at: "2016-01-13 04:47:57", state: "active", #<task id: 3131, title: "purposefully walk 3 minutes ", content: "more ordinary day, choose 5 minutes ...", created_at: "2016-01-13 04:52:32", updated_at: "2016-01-13 04:56:22", state: "active", #<task id: 3132, title: "1km walk or run sunday", content: "i pick direction, start 10 minute warm up,...", created_at: "2016-01-13 04:56:05", updated_at: "2016-01-13 04:56:05", state: "active",#<task id: 3249, title: "1km walk or run wednesday", content: "i pick direction, start 10 minute warm up,...", create

deployment - Create a script to git pull/checkout from specific branch -

i'm trying write script deploy our webapp git. have 2 servers ("production" , "development"). i've made new develop branch, , after first clone on server situation git branch -a this: * master remotes/origin/head -> origin/master remotes/origin/develop remotes/origin/master i'm trying write simple script pull master on production server, , develop on development server. after clone did git pull origin develop git checkout develop and situation this: * develop master remotes/origin/head -> origin/master remotes/origin/develop remotes/origin/master the files matching develop branch. far good. i've tried same master: git pull origin master git checkout master and got message: your branch ahead of 'origin/master' 5 commits. (use "git push" publish local commits) and files seems same of develop. i guess knkowledge git , local/remote branch not enough, i'm missing something.

php - Laravel4.2&mongoDB. Class 'MongoClient' not found when try to call command from command line -

as topic title. work cron service execute artisan command every minute. have problem when try execute command via terminal debuging. got error class 'mongoclient' not found . so try simple query in laravel route $m = new mongoclient('mongodb://localhost:27017'); $db = $m->rootan; print_r($db) ; $result = $db->campaigns->findone(); print_r($result) ; i got result no error perfectly. so question why error when execute command terminal. problem permission? sorry english. ps. use ubuntu14.04 laravel4.2 , mongodb3

qtquick2 - QML: Center variable text and image -

Image
i need horizonally center variable-length text (red box) , image (yellow box) in big box (green box). text shall wrap if not fit box. existing code: item { id: bigbox x: 255 y: 0 width: 800 height: 100 image { id: imagebox source: "image.png" width: 52 height: 46 anchors.left: parent.left anchors.leftmargin: 12 anchors.verticalcenter: parent.verticalcenter horizontalalignment: image.alignleft verticalalignment: image.alignvcenter fillmode: image.pad } text { id: textbox anchors.left: symbol.right anchors.leftmargin: 12 anchors.right: parent.right anchors.verticalcenter: parent.verticalcenter text: qstr("heading text") font.pixelsize: 36 font.bold: true horizontalalignment: text.aligncenter } } update: actual running code , real screenshot showing problem: import q

Aurelia skeleton sample - dist/main.js not found? -

i’m trying run skeleton-navigation-typescript-vs on windows machine fails – see welcome screen , in developer tools there message: http://localhost:9000/dist/main.js failed load resource: server responded status of 404 i docs – step step. http://aurelia.io/docs.html#/aurelia/framework/1.0.0-beta.1.0.8/doc/article/a-production-setup . when check in chrome developer tools in sources tab there css, jspm_packages, lib , index.html – there no dist dir. is working sample? i’m doing wrong? you not using index.html provided tutorial. go index.html , replace this: <body aurelia-app="main"> with this: <body aurelia-app> when specify value aurelia-app attribute, framework js file start application. more information @ http://aurelia.io/docs.html#/aurelia/framework/1.0.0-beta.1.0.8/doc/article/app-configuration-and-startup edit create main.js file inside src folder, this: export function configure(aurelia) { aurelia.use .standardcon

android - How to remove a specific contact from contact list -

i trying delete specific contact not deleting. here code: public static boolean deletecontact(context ctx, string phone) { uri contacturi = uri.withappendedpath(contactscontract.phonelookup.content_filter_uri, uri.encode(phone)); cursor cur = ctx.getcontentresolver().query(contacturi, null, null, null, null); try { if (cur.movetofirst()) { { string lookupkey = cur.getstring(cur.getcolumnindex(contactscontract.contacts.lookup_key)); uri uri = uri.withappendedpath(contactscontract.contacts.content_lookup_uri, lookupkey); ctx.getcontentresolver().delete(uri, null, null); } while (cur.movetonext()); } } catch (exception e) { system.out.println(e.getstacktrace()); } return true; } try use code. contentresolver cr = getcontentresolver(); cursor cur = cr.query(contactscontract.contacts.c

Java / Batik, modifing attribute in java, updating SVG DOM -

i have redendered svg document several symbols. in java application modify attribute in dom changing stop-color attribute using setattributens. i can see attribute modified , changes new value, svg document render not reflect change. if same in browser using javascript, dom updates , change visible. there need batik render reflect changes in dom? edit: in addition being able modify attributes in java , see updates. have seen other behaviour works in browser same svg file doesn't in java application. example using browser dom debugger, can modify stop-color attribute of lineargradient , see change in browser, using script or java in batik application doesn't work, no change seen. edit2: have found if change fill attribute of element using lineargradient, modify stop-color attribute of linergradient, change fill attribute lineargradient works, not if leave fill attribute unmodified. behaviour in batik.

scala - Insufficient Memory behind a finite recursion -

i doing objsets coursera assignments. , faced memory problem there insufficient memory java runtime environment continue. native memory allocation (malloc) failed allocate 253231104 bytes committing reserved memory. when implementing union function that def union(that: tweetset): tweetset = (left union(right)) union(that) incl(elem) i fixed problem changing union method to def union(that: tweetset): tweetset = right union(left union(that)) incl(elem) what difference ? why iam getting memory problem in first case ? thank ! i have taken coursera course on fp scala , had same problem you. came same working solution. key knowing why 1 works , other doesn't in recursive decomposition of function. first, let's @ first solution not terminate. def union(that: tweetset): tweetset = (left union(right)) union(that) incl(elem) let's use simple example tree , arbitrary tree that : val tree = nonempty(tweet1, nonempty(tweet2, empty, empty), nonemp

networking - what is the "16 bit short address"? -

i'm using cc2538em , ccs v6. i had founded rf example project, , had studied few days. and got question 16 bit short address. when used basicrfsendpacket(rx_addr, (unsigned char*)&ttxpacket, packet_size) function, thought rx_addr rx_fifo address. wasn't rx_addr defined 0xbeef. and founded value short address. what short address ?! is address located in ram ? specific address of register ? that value allocated short_addr0 , short_addr1 , described "the short address used during destination address filtering". what address filtering either..... ? help me.. regrads the "short address" configuration parameter of rf transceiver contained in cc5238 system-on-chip (soc). compare other configuration parameters such "extended address" , "pan id". here excerpt cc2520 software examples user’s guide: uint8_t basicrfsendpacket(uint16 destaddr, uint8* ppayload, uint8 length) send packet given des

process - python 2.4.3 subprocess check_call -

i have apparently old version of python, , when try use subprocess.check_call(...) an error returned saying check_call doesn't exist. there equivalent? way... need understand line invoked when use subprocess.call(...) you should able use call check_call wrapper subprocess.call() , exists in python 2.4. can write own check_call function: (warning: not tested don't have python 2.4): class calledprocesserror(exception): def __init__(self, returncode, cmd, output=none): self.returncode = returncode self.cmd = cmd self.output = output def __str__(self): return "command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode) def check_call(*popenargs, **kwargs): retcode = subprocess.call(*popenargs, **kwargs) if retcode: cmd = kwargs.get("args") if cmd none: cmd = popenargs[0] raise calledprocesserror(retcode, cmd) return 0 and i

java - listen for RFID scanner and print data -

i have rfid reader/scanner bought site e-gizmo , have manual here: low cost rfid reader manual . i've been trying work java , far, have 0 idea how this. what want have class running on background(threading+listener? not sure.) waits rfid , store content of tag variable(string). so far, got class read physical port of device. here code. package data; import com.fazecast.jserialcomm.*; import java.util.scanner; public class comcontrol{ public static void main (string argsp[]){ serialport ports[] = serialport.getcommports(); for(serialport port: ports){ system.out.println(port.getdescriptiveportname()); } scanner = new scanner(system.in); int x = i.nextint(); serialport port = ports[x-1]; if(port.openport()){ system.out.println("port open"); }else{ system.out.println("port not available"); return; } port.setcomportpa

php - link inside pdf in new browser Window -

my project, generating pdfs, finished. facing problem can't figure out myself: how can manage make links inside pdfs open in new window while viewing pdf? i generate=ing pdf's using tcpdf, here code in showing dynamic links need open in new tab or window : <?php if(($appval['name'])== 'pdf'){?> <dt ><?php echo stripslashes($appval['name']); ?></dt> <dd><a href=<?php echo stripslashes($appval['value']); ?>><?php echo stripslashes($appval['value']); ?></a></dd>

convention - Names in JavaScript -

var = function () { this.someproperty = 0; }; var = new a(); the variable a object. call a ? class? a called constructor function . well, specifically, a variable refers constructor function, don't kind of mintuiae. sometimes people call these "classes," because constructor functions aid in producing classes of objects (in general sense, e.g., objects common characteristics). javascript doesn't have classes in class-based oop sense java or c#, has different inheritance mechanism called prototypical inheritance . (this true in es2015 , beyond, keyword class used define constructor function, properties of prototype assigns objects when used new , , properties on function referring other functions ["static methods"].)

artificial intelligence - Learning Algorithm not working? -

learning algorithm of single layer precptons works given training data, not new input.is there way correct this? private void traning(){ while(true){ int errorcount = 0; for( int = 0 ; < input_set_count ; i++ ){ float weightsum = 0; for( int j = 0 ; j < no_input ; j++ ){ weightsum = weightsum + weight[j] * train_data[i][j]; } int toutput = 0; if( weightsum >= threshold ) toutput = 1; int error = output[i] - toutput; if( error != 0 ) errorcount++; for( int j = 0 ; j < no_input ; j++ ){ weight[j] = weight[j] + error * train_data[i][j] * learning_rate; } } if( errorcount == 0 ) break; } system.out.println("traning complet

node.js - How can I access command options in separate files? -

i'm using commander specify commands , options global node module in index.js file of project (like shown in example ). i know can check if command used using following code: if (program.peppers) { console.log('-peppers used') } but how can check properties in other files? i've tried exporting program , requiring in other files, doesn't seem work. let's want check if option used in different file in 1 in i've defined them. how should that? you pass parsed program files/functions need parsed arguments or can export parsed arguments program instance file index.js var program = require('./program'); if (program.peppers) { console.log('-peppers used') } file program.js var program = require('commander'); program .version('0.0.1') .option('-p, --peppers', 'add peppers') .option('-p, --pineapple', 'add pineapple') .option('-b, --bbq-sauce', 'a

java - Spring-Hibernate integration : Unable to persist -

Image
i'm trying use hibernate in spring framework. following files : employee.java : package com.springstarter; public class employee { private int id; private string name; private float salary; public employee() { } public employee( int id, string name, float salary ) { super(); this.id = id; this.name = name; this.salary = salary; } public int getid() { return id; } public void setid( int id ) { this.id = id; } public string getname() { return name; } public void setname( string name ) { this.name = name; } public float getsalary() { return salary; } public void setsalary( float salary ) { this.salary = salary; } } employe

bash - How to assign Command line arguments to Variables in Shell Script -

i trying assign command line parameters variable (entire argument 1 variable) in shell script not working here tried: str1 ='$*' str1 ="$*" set str1 =$* set str1 ="$*" set str1 ='(echo $*)' set str1 ='$*' if want one variable containig all arguments; use $@ : str1="$@"

Issue with running SQL Scan queries in Apache Ignite in clientmode -

i trying start testing sql in apache ignite using following code. public void testsqldatabase(){ cacheconfiguration<long, person> cachecfg = new cacheconfiguration<>(); cachecfg.setname("mycache"); cachecfg.setcachemode(cachemode.partitioned); cachecfg.setindexedtypes(long.class, person.class); // setting query entity. queryentity queryentity = new queryentity(); queryentity.setkeytype(long.class.getname()); queryentity.setvaluetype(person.class.getname()); // listing query fields. linkedhashmap<string, string> fields = new linkedhashmap(); fields.put("id", long.class.getname()); fields.put("orgid", long.class.getname()); fields.put("firstname", string.class.getname()); fields.put("lastname", string.class.getname()); fields.put("resume", string.class.getname()); fields.put("sala

jquery - Fancybox only working sometimes without refreshing the page -

i'm using fancybox users can click on image thumbnails , see larger images. the problem i'm having doesn't work when page loads. i'll click on thumbnails , fancybox doesn't show larger images. if refresh page however, works fine. content generated dynamically wonder if need refresh dom? <script type="text/javascript"> $(document).ready(function() { $(".fancybox").fancybox({ openeffect : 'fade', // openeffect / closeeffect / nexteffect / preveffect closeeffect : 'fade', // animation effect ('elastic', 'fade' or 'none') each transition type nexteffect : 'fade', // string; default value: 'fade', 'fade', 'elastic', 'elastic' preveffect : 'fade', openspeed : '1000', // openspeed / closespeed / nextspeed / prevspeed

c# - HttpUtility.ParseQueryString value and Key -

i'm trying remove key , value of httputility.parsequerystring , not able key , value. (ex: //somesite.com/someaction?article=1&lang=en ) i want : [ {"article",1}, {"lang","en"} ]; any idea how there ? you can keys , values: string[] allkeys = request.querystring.allkeys .select(k => "key: " + k + " value: " + request.querystring[k]) .toarray(); modify select method data structure want (other string[] ), example: string[][] allkeys = request.querystring.allkeys .select(k => new string[] { k, request.querystring[k]}) .toarray();

javascript - How to get a selected row id in second while using a pagination in Kendo Grid? -

i have a, let's say, 250 rows, devided 25 pages. 10 rows on each page. if i'm on first page, , click on third row, rowindex = 2. if i'm on second page , click on first row, logically i'm supposed rowindex of 11th page, should rowindex = 10. i'm getting rowid = 0. how can fix that? in truth correct behaviour. because when click on first row, first index in table. doesn't know data on pages because don't exists (why load data don't need? can performance issue) so if want behaviour describing, have select page number , calculate that. something like: rowindex = getrowindex ... page = grid.datasource.page(); rowindex = (page - 1) * 10 + rowindex; here demo

java - Insert and Update in log(n) time with better performance -

i developing financial algorithms using java. have complex data structure many properties need updated during life time of algorithm. data structure updated more 1000 times ... to improve performance get(search)/update/insert decided use treemap container quite efficient in regard. now comes challenging part. need update data-structure properties need retrieve container requires: check if container has object if yes, object, else create new object , add map update object if present in container this process takes 3 x log(n) i.e check, , put. want in single log(n) time. for that, solution is: i add object in map ( insert/update/get ) using put . put returns old object, update current object old values, solves log(n) different object lost reference previous object because new value replaced in map. is there better solution or better container updating datastructure. can use list , use binary search of collections need sort datastructure again list not sorted.

React-Bootstrap Multiple Modal -

i using react-bootstrap in project. need open multiple dialog. there way achieve this? note: there answers bootstrap here not work in react-bootstrap. thanks. it depends on want achieve. have multiple react bootstrap modal dialogs , have embedded dialogs, modal dialog shows popup error message. can define state variable, this: this.state = {showmodal1:true, showmodal2:false,...} in render function can this: render() { return( <div> <modal show={this.state.showmodal1}> modal 1 text comes here </modal> <modal show={this.state.showmodal2}> modal 2 text comes here </modal> </div> ); } in code above, if both showmodal1 , showmodal2 true, both modal dialogs , second above first one.

c++ - Deleting void pointer after assigning it with original type -

is ok delete void pointer in below program. class sample { public: int intval; float floatval; }; main() { sample *samobj = new sample(); void *vptr = samobj; delete vptr; } this sample program have written. actually, in project have no other way doing similar thing. similar code in .h interface file, , when include file , compile other components, compiler gives warning message "warning: deleting 'void*' undefined", doubt since have assigned void pointer sample object type, isn't safe delete pointer? calling delete on void pointer undefined behavior [ref ] . should not @ all. not calling delete on void pointer on pointer of type sample fine. [ref ] c++ standard :section 5.3.5/3: in first alternative (delete object), if static type of operand different dynamic type, static type shall base class of operand’s dynamic type , static type shall have virtual destructor or behavior undefined. in

Does spring initialize beans in parallel? -

i have lot of independent spring beans in project (classes annotated @component -- not lazily initialized ). wanted know weather beans initialized serially or parallely? asking because beans modify common data structure on initialization , wanted know weather data structure should made thread-safe. spring version used:- 4.2 i reading open issues on spring jira website:- according https://jira.spring.io/browse/spr-9887 seems parallely initialized but according https://jira.spring.io/browse/spr-8767 seems serially initialized. spring initialises beans in serial. there nothing says initialised in parallel. in fact, ticket cite ( https://jira.spring.io/browse/spr-9887 ) closed ticket because it's duplicate of https://jira.spring.io/browse/spr-8767 . ticket unresolved , targetted release of spring 5.0 in future, nothing says beans initialised in parallel!

c# - How can I join strings from one List<string> into another one? -

i've got list<string> names; , has 700 000 names in it. how can join every 500 strings (using separator ",") , add them new list<string> abc; so want have 1 list<string> , hold 1400 joined strings. abc[0]= first 500 names, abc[1]= next 500 names , on. with morelinq batch (or any other batch implementation ): var abc = names.batch(500).select(x => string.join(",", x)).tolist(); note: grouping operator not streaming operator (as tolist). means 700k strings should enumerated , keys should calculated each item, , each items should stored in internal groups. , cost time , resources. batching streaming , not store items internally. stores current batch. batching if not convert results list , can process batches 1 one faster , save memory.

sass - Gulp: trying to import compass mixins -

i have followed this tutorial without problems, start using sass. can see includes part using compass mixins . have compiled .scss files including @import compass/css3/box-sizing without problems. now want compile .scss files, using gulp. have followed this tutorial. have these files: //src/defaultbundle/resources/public/assets/css/main.scss form { span { color: red; } } var gulp = require('gulp'); var sass = require('gulp-sass'); gulp.task('default', function() { gulp.src('src/defaultbundle/resources/public/assets/css/main.scss') .pipe(sass()) .pipe(gulp.dest('web/css')); }); so when run $ gulp latter tutorial says, .css file. the problem : if add @import compass/css/box-sizing @ top of .scss file , error when running $ gulp : [13:12:01] working directory changed /var/www/my_project [13:12:01] using gulpfile /var/www/my_project/gulpfile.js [13:12:01] starting 'default'... [13:12:01] fini

javascript - Dynamicly select object using number from variable -

i'm wondering, if it's possible : i have new object: // create new object form existing code var v1 = $("#div1").getmyobject(); now can use v1 object, example: v1.start(); now question is: have variable, example: var num = 1; now want find way select v1 object, using num variable (this of course not work, want show, need): v+num.start() so see, want use var num, , assign var object name, later use. i'm asking, because, need select proper object in loop, , want select dynamicly. thank advice. instead of having objects like: v1, v2, .... you should have: v[1], v[1], .... then can use v[1] = $("#div1").getmyobject(); v[num].start();

c - got wrong reult when make division of large double data -

there code double max = pow(2,1000); double test = max/10; the result test wrong result. want know how happened? the issue precision of float numbers. stored in binary format , double can store 53+1 bits in mantissa. when divide such big number 10, lose of bits it's not possible express division precisely in binary number. actually it's impossible store 1/10 precisely, here original power of 2 doesn't matter much. edit: regarding other answers - exponent can store 11 bits in double, it's able handle 2^1000.

PHP MYSQL $_GET['ID'] from table on dynamically generated page -

i have few products stored in table auto-incremented id entitled "product_id". i have managed create page displays list of products names selected db , dynamically created links each one. let's have product apple. when click on apple takes me view_product_details.php?id=9 but when click apple, view_product_details.php page tells me "notice: undefined index: product_id in c:\xampp\htdocs\working\product-website-exercise\view_product_details.php on line 16" <?php //$result = mysql_query("select * temaproduct.products id = '".mysql_real_escape_string($_get['product_id'])."'"); $id = $_get['product_id']; //this line 16 $result = mysqli_query($conn,"select * products id = $id"); echo $result['product_description']; echo "<br>"; var_dump($result); ?> i have tried different queries can't figure out, please me establish connection can read

android - PhoneGap resolution same but results differ -

i think issue similar referenced here: screen resolution on phonegap app basiaclly have ipad , android tablet, both resolution of 1024 across, yet screen displays correctly on ipad, yet on android, of output wrapped. the solution recommended in above post insert following 'viewport' within document head <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> i had in originally, , layout same fonts on android (almost) unreadable (9px ?) fine/readable on ipad. can advise on might going wrong? how can ensure fonts kept of similar sizes on both android , ios, , not have wrapping on android? thanks! remove height , target-densitydpi viewport <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width" />

Custom extensions throwing 404 after installing patch for magento -

i have installed following security patches in magento site: 4291,6237,7616,5344,5994,6285,6482,6788,7405. before of custom modules worked fine, aren't. here config.xml : <?xml version="1.0"?> <config> <modules> <custom_moduleadmin> <version>3.4.0</version> <depends>custom_module</depends> </custom_moduleadmin> </modules> <adminhtml> <layout> <updates> <custommoduleadmin> <file>custommoduleadmin.xml</file> </custommoduleadmin> </updates> </layout> </adminhtml> <admin> <routers> <custommoduleadmin> <use>admin</use> <args> <module>custom_moduleadmin</module> <frontname>custommod

python - how to extract a list of lists (containing any value type) from json -

from mobile client, we're sending list of lists part of json server(python 2.7). needs split individual lists processing. example json = {"table":"[[1,2,3],[2,3,4],....]"} what need extract individual lists [1,2,3],[2,4,5] etc, add object @ start of list , insert them postgres db. for extracting json use : post_data = json.loads(request.data) table = post_data['table'] print table prints u'[[1,2,3],[2,3,4]]'. i checked couple of questions , use following snippet processing , inserting db. tbl = post_data['table'] table = ast.literal_eval(tbl) print table tup_table = [] lst in table : lst.insert(0,userid) tup_table += [tuple(lst)] connection = engine.raw_connection() cur = connection.cursor() records_list_template = ','.join(['%s'] * len(tup_table)) insert_query = 'insert stats(userid,rid,val,fid) values {0}'.format(records_list_template) cur.execute(insert_query, tup_table) connection.co

node.js - Serve/Stop serve Socket.IO -

im wondering how can serve socket.io logged users? for im adding/removing <script src="/socket.io/socket.io.js"></script> <script> var socket = io(); </script> but when remove after successful session, page not loading. idea using/serving socket.io users passport session authentication? the true answer here use called handshake of socketio framework. allows checks , decide if should allow user connect server or not. other answers around don't automatically allow user connect. if opens console , instantiates socket against server - he's online. check out: http://socket.io/docs/server-api/#namespace#use(fn:function):namespace on each connection attempt , can run specific function see if things okay or not. can decline connection (calling next parameter), or accept - call next . and that's :) but here comes tricky part - how authenticate user? each socket instantiated simple http request client. it's late

c# - ReportViewer returns blank even if there exists data -

my reportviewer returns blank when deployed. have tried setting asyncrendering="false" , showparameterprompts="true" . while setting asyncrendering report loading not properly,the control lost width , no scroll appears, menu can't seen.

mercurial - How to get changes to .hgignore honored in remote repo -

i pushed changes mercurial repo (the remote server) , realized .hgignore misconfigured, files (binaries, etc.) included in commit/push should have bee ignored. so tweaked .hgignore , got perfect, , push change. surprise, remote server's web ui (rhodecode) still shows "bad" files belonging repo. have expected them automagically culled out since violate .hgignore . so looks need magic locally makes working copy honor ignore changes, , push changes. perhaps remove files tracking? as concrete example, in repo root have myapp-meta.bin . in .hgignore added entry *.bin . exact commands need in order remove *.bin tracking (but not file system!) , don't show in latest/head version on remote repo? also, hg have similar git's dry run ( git add . -n )? handy in future see would added tracking before go ahead , it! you added myapp-meta.bin , it's tracked despite added later .hgignore . if delete repo won't shown new file , ignored. as dry r

html - Redirecting to URL in external Javascript function not working -

i'm trying program relatively simple site, html , javascript skills pretty basic. basically, i'm trying create page user asked question answer typing form. external javascript function users answer compared right one, , if they're same, user supposed redirected different site. here's form in html document: <form name="myform" action="" method="get"> answer: <input type="text" name="inputbox" value=""> <button onclick="checkanswerexact(this.form)"> submit </button> </form> my javascript function looks this: function checkanswerexact(form){ //get answer var x = form.inputbox.value; //convert answer string var testansw =x.tostring(); //define right answer var rightansw = "rightanswer"; //check if same if (testansw.tolowercase() == rightansw.tolowercase() ){ alert("the answer right."); window.location.href = &#

html to pdf - Create footer with page number not displayed using Document object of EvoPdf -

i have pdf file converted html evopdf htmltopdfconverter. read file bytes evopdf document class , add footer element it. after saving bytes - it's displaying inline webbrowser. footer page number isn't displayed. this code: document pdfdoc = new document("myfilepath.pdf"); //create footer element textelement footertext = new textelement(0, 30, "page &p; of &p; ", new system.drawing.font( new system.drawing.fontfamily("arial"), 10, system.drawing.graphicsunit.point)); footertext.embedsysfont = true; footertext.textalign = horizontaltextalign.right; pdfdoc.addfootertemplate(50); pdfdoc.footer.addelement(footertext); byte[] outbuffer = pdfdoc.save(); pdfdoc.close(); //... if add footer element htmltopdfconverter displayed well. how can display it? thanks. i have run same situation. basically, wanted add header , footer existing pdfs without using htmltopdfconverter. here solution few tweaks existing code:

javascript - Proper way to limit wait time on selenium element search -

my nightwatch/selenium test code looks elements in page may not exist using code such browser.elementidelement(element,'class name', 'myclass', function(r) { if (r.status == 0) console.log('found match') else console.log('did not find match') }) if element found, callback invoked (< 50ms), if no element matches, callback takes longer (>1000ms). have hundreds of times , there few elements match search criteria, adds significant amount of time test run. i limit time selenium spends searching elements. tried using selenium timeoutsimplicitwait() function, e.g., browser.timeoutsimplicitwait(250) .elementidelement(element,'class name', 'myclass', function(r) {...}) but doesn't affect performance. correct method limiting element search time? perhaps misunderstanding problem; both of these patterns works me: client .usexpath().waitforelementpresent(selector, this.timeout) .usecss().wa

osx - Relaunch application Xamarin Mac -

in order apply settings application need close application , restart it. is possible xamarin.mac i closing app with nsapplication.sharedapplication.terminate(this); but don't know if it's possible restart again.

android - The interaction fragments -

i have 1 activity , 2 fragments. in drawer menu have 2 items: fragment1 , fragment2. in fragment1 have edittext , button. when click on button - text field must recorded in listview of second fragment. please me, how can make this. i changed code, when click on button application has stopped. please me. mainactivity public class mainactivity extends appcompatactivity implements screenone.onfragmentinteractionlistener { drawer drawerresult; arraylist<string> arrayitems; string message; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); primarydraweritem item1 = new primarydraweritem() .withname(r.string.navigation_menu_item1) .withidentifier(1); primarydraweritem item2 = new primarydraweritem() .withname(r.string.navigation_menu_item2

sql - Find those who have NOT written a letter -

i have 3 tables: tblareas, describes various areas of uk; tblnewsletters, lists quarterly dates when publish newsletters; tblissues, many-to-many table linking previous two. tbl issues describes each newsletter produced each area in each quarter (one newsletter per area per quarter). want find areas have not produced newsletter in given quarter. make start, did not attempt restrict output particular quarter, couldn't work. here code: select tblarea.id, tblarea.areaname tblissues not exists (select newsletterlookup tblissues tblissues.arealookup = tblarea.id); select * tblarea left join tblissues on i.areaid = a.id i.areaid null for specific quarter, have use subquery. select * tblarea left join (select areaid tblissues ii inner join newsletters n on n.id = ii.newsletterid n.issuedate = #12/31/2015# ) on i.areaid = a.id i.areaid null not tested..sorry

android - GCM Invalid sender error -

i'm stuck while on mysterious problem. implemented gcm in android app, receive invalid_sender error. my sender_id id url of google project. the android push notifications on the weird thing have registration id send notifications to. console looks this: 03-26 09:39:20.233: i/<test>(19761): registered: apa91bg6- o3onzt50eajyvj5ketv3qalpon2sfopxez7slamaaokhtn6emdjb91gfiwkftzkjiub6uoek4o- wqp7kk2ozgqjz1vczzs0wddqtjfacfyfzfb7sew3is1sd4cajcdze4la1f0hxzc7ss1uiyhxx-xxxx 03-26 09:48:23.522: i/<test>(19925): gcmintentservice 03-26 09:39:20.670: i/<test>(19761): on error invalid_sender inside oncreate: gcmregistrar.checkdevice(this); gcmregistrar.checkmanifest(this); final string regid = gcmregistrar.getregistrationid(this); if (regid.equals("")) { log.i("<test>", "registering"); gcmregistrar.register(this, "2194354949xx"); } else { log.i("<test>", "already registered: &q