Posts

Showing posts from May, 2014

node.js - Running blocks of code synchronously in NodeJS/Selenium/Mocha -

i'm doing automated testing in nodejs/selenium/mocha , having lots of trouble getting things execute correctly. the following code block tests webpage clicking button , checking if corresponding counter goes 0 1. it('votes item when user clicks button', function(done) { driver.findelements(by.classname('list-group-item list-group-item-action')) .then(function(buttons) { driver.findelements(by.classname('vote-count')) .then(function(counts) { var flag = true counts[0].gettext().then(function(text) { console.log('test') if (text != '0') flag = false }) buttons[0].click() counts[0].gettext().then(function(text) { if (text != '1') flag = false }) expect(flag).to.equal(tru...

javascript - querySelectorAll loop "undefined" -

i try loop on few input elements in order each value, reason last one: <input type="text" name="input-loop" data-loop="true" /> <input type="text" name="input-loop" data-loop="true" /> <input type="text" name="input-loop" data-loop="true" /> <button type="button" onclick="loop()">loop</button> <div id="output"></div> <script> function loop() { var element = document.queryselectorall('[data-loop="true"]'); for(var = 0; < element.length; i++) { console.log(element[i].length); // or: // document.getelementbyid('output').innerhtml = element[i].value + '<br>'; } } </script> the console shows undefined , when try output values, last element , not of them. doing wrong? thank (and please excuse english)...

x86 - A "while" in assembly -

i have compare number 0 , if lower or equal 0 have re-read number. i've designed method read number before while condition if number equal or lower 0 doesn't re read number should following method. my code looks this { char number1[] = "enter number(>0):"; char format[] = "%d"; // format string scanf function int number; _asm { atat: lea eax, number1// ask number push eax call printf add esp, 4 lea eax, number// read in push eax lea eax, format push eax call scanf add esp, 8 // while: mov eax, number cmp eax, 0 jg end_while jmp atat end_while:

python - What is causing this error and how can I fix it? -

i trying make simple compression program in python, receiving error with open("admin.dll", "r").read() text: attributeerror: __exit__ why getting error? full code import zlib, sys, time, base64 open("admin.txt", "r").read() file: print("uncompressed: " + str(sys.getsizeof(file))) compressed = zlib.compress(file, 9) print("compressed: ", end="") print(sys.getsizeof(compressed)) you asking python treat result of expression open("admin.dll", "r").read() (a string) context manager. context managers expected have __exit__ method, strings don't have methods. you'd pass in file object : with open("admin.dll", "r") fileobj: text = fileobj.read() file objects do have required context manager methods. note have other errors too; sys.getsizeof produces memory size of python object, not size of file. use os.stat() that, or se...

java - While Loop not printing second command -

can tell me why second statement not print when counts gets below 4? first part prints "looping" part fine not print "no more loops". what's wrong? enter code here public class scratchpad { public static void main(string[] args) { int xray = 7; while (xray > 4) { system.out.println("looping"); if (xray < 4) system.out.println("no more loops"); xray = xray - 1; } } when xray reaches value 4, while loop finishes. that's why second statement doesn't printed. if want printed 1 solution one: public class scratchpad { public static void main(string[] args) { int xray = 7; while (xray >= 4){ system.out.println("looping"); if(xray <= 4) system.out.println("no more loops"); xray = xray-1; } } }

php - Autoloader issue not returning Class -

problem? bootloader (autoloader) not seem working properly, or i'm missing something. here simplified code. the code below returns class "skeleton" not exist. on index.php file. index.php <?php include 'bootloader.php'; use skeleton\html\loginheader; $tool = new skeleton/html/loginheader(); bootloader.php <?php function boot($classname) { $filename = ''; $namespace = ''; // sets include path "src" directory $includepath = dirname(__file__).directory_separator.'src'; if (false !== ($lastnspos = strripos($classname, '\\'))) { $namespace = substr($classname, 0, $lastnspos); $classname = substr($classname, $lastnspos + 1); $filename = str_replace('\\', directory_separator, $namespace) . directory_separator; } $filename .= str_replace('_', directory_separator, $classname) . '.php'...

javascript - MariaSQL Nodejs no function return -

im pretty new in js , ive problem following code: console.dir(request("select id viewer order id desc limit 1;")); ... function request(query){ var answer = "test"; var query = c.query(query); query.on('result', function(res) { res.on('data', function(row) { console.dir(row); answer = row; }) }); return answer; } the second console.dir returns expected answer { id: '1' }, first 1 returns "test". seems 'answer = row;' has no effect. does can explain me behavior , can tell me how solve ? thanks in advance, ystro :)

Blockchain decentralised database on rails -

i want store data of rails application on blockchain technology data decentralised. quick tutorials or reference articles can learn how so? i want store json data inside blockchain , want use external service. and reliable blockchain service people heroku rails started? thanks. you have handle database setup. go through document https://www.bigchaindb.com/whitepaper/bigchaindb-whitepaper.pdf . also, see how done python. think helpful https://www.sitepoint.com/managing-data-storage-with-blockchain-and-bigchaindb/

ionic framework - backup and restore in LokiJS -

in ionic project, need take backup lokijs data , upload server on regular basis , when user need restore data, latest version downloaded , restored. trying use db.serialize() method extract lokijs data , send server (not sure if there better way). couldn't find way restore data json string.

java - Android app button not working -

i have used snippet of code in few other projects, cannot understand why not work here. simple button changes activities. code giving error message: cannot resolve symbol "setonclicklistener" import android.content.intent; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.button; import android.widget.spinner; public class mainactivity extends appcompatactivity implements adapterview.onitemselectedlistener { public static string value2; public static string value3; public static string value4; public static string value5; public static string value6; public static string value7; public static string value8; public spinner spinnermath; public spinner spinnerenglish; public spinner spinnerhistory; public spinner spinnerscience; public spinner spinnerlanguage; public spinner spinnerreligion; public spinner spinnerseventh; public...

javascript - adding json to scope in AngularJS -

i concatenating 2 objects in json , assigning $scope in angularjs. unable same. code given below //https://wind-bow.hyperdev.space/twitch-api/channels/esl_sc2 /*global variable*/ var responsedata=[]; var responsedatavalues=[]; var twitch = angular.module("twitch",[]); twitch.controller("liststremers",streamme); function streamme($scope,$http) { var streamers=["esl_sc2", "ogamingsc2", "cretetion", "freecodecamp", "storbeck", "habathcx", "robotcaleb", "noobs2ninjas","comster404","brunofin"]; for(var i=0;i<streamers.length;i++) { $http({ method:"jsonp", url:"https://wind-bow.hyperdev.space/twitch-api/streams/"+streamers[i], params:{ format: 'json', callback: 'fitdata' } }); $http({ method:"jsonp", url:"https://...

Downloading videos off website in Java/Selenium? -

as bit of side project, wanted create program friendly students @ university download lectures posted online. the videos available online, , watch them, users first login university account, navigate list of courses have online lectures, click course , watch lecture. download them, users need install 3rd party extension (like video downloader professional) , download lectures i wanted create small applet students input login user , password university website the course wish download the lecture number of course/option lectures download the download path save these lectures program create new browser window, login website, go course, , download lecture number want. i ideally want run in background users can't see going on. know phantonjs can run invisible, there way chrome this? so question: selenium idea this? how make google chrome instance invisible end user in selenium? basically want run chrome headless . not obvious task (although might in near...

javascript - Make a popover over a table -

i want make popover covers table <!doctype html> <html> <head> <title>js bin</title> <script src="https://code.jquery.com/jquery.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <style> .popover { width: 2000px; } .popover-table th, td { padding: 0px 15px; white-space:nowrap; } </style> </head> <body> <a href="#" data-toggle="popover4">4</a> <div id="popover4-html" style="display: none"> abcdefghi: <table class="popover-table"> <tr></tr> <tr> <th>alongtitleisverylong</th> <th>li...

c++ - How to create and execute a copy constructor for a linked list? -

i have tried looking @ videos , older posts still difficult understand concept of copy constructors. clear me? class did not cover part 100% professor focused on constructors , destructors. main cpp #include <iostream> #include "header.h" using namespace std; int main() { node access; access.getdata(); access.outdata(); system("pause"); return 0; } header file #include <iostream> using namespace std; class node { public: node(); // had create own default constructor because of copy constructor. node(const node &n); // copy constructor. ~node(); void getdata(); void outdata(); private: int num; int lcount = 0; // counts number of nodes, increments after each user input. int *ptr; // linked list copied node *next; node *first; node *temp; node *point; }; node::node() { num = 0; } node::node(const node &n) { temp = first; ptr = new node; (int = 0...

ssl certificate - Alexa skills kit integration with locally hosted service gives error -

i trying integrate alexa locally hosted service. trying hit url https://www.myurl.com:443/somepath i generating self signed certificate domain "myurl.com." however, when test in service simulator response "the remote endpoint not called, or response returned invalid." the error "parse error on line 1: remote endpoint". tell me how integrate alexa url stated above?

Cordova Android: Empty request while uploading file using official cordova-plugin-file-transfer -

trying upload file server using official cordova-plugin-file-transfer provided apache @ https://github.com/apache/cordova-plugin-file-transfer . created empty cordova project, setup file picker ( https://github.com/don/cordova-filechooser ) , file uploader, , ran following code: function servupload(fileurl) { var win = function (r) { console.log("code = " + r.responsecode); console.log("response = " + r.response); console.log("sent = " + r.bytessent); } var fail = function (error) { alert("an error has occurred: code = " + error.code); console.log("upload error source " + error.source); console.log("upload error target " + error.target); } var options = new fileuploadoptions(); options.filekey = "upfile"; options.filename = "test.jpg"; options.mimetype = "image/jpeg"; options.httpmethod = "post...

Cordova Android 6 InAppBrowser Error -

i tried use plugin can't work on android 6, works on previous android on emulator. https://github.com/apache/cordova-plugin-inappbrowser do know how make works on android 6? permission issue? thank you updated crosswalk 2.2.0 , problem thankfully gone. same deviceready more 5sec error.

python - Celery Generating group tasks from chain task -

i trying chain following tasks celery(v4.0), task = group([tasks1.s(), task2.s()) | generate_job_requests.s() | execute_job.map() | aggregate_result.s() result = task.get() above part working fine upto generate_job_requests chord. problem starts execute_job gets list of jobs generate_job_requests , need create parallel tasks , later on aggregate result of jobs. i trying validate whether such kind of taskgraph possible celery ? there possible alternate workflow solve problem such dependency ? missing in documentation. i used map functionality intermediate task creator acts chord, @shared_task(ignore_result=false) def dmap(it, callback, end_task): callback = subtask(callback) grp = group(callback.clone([arg, ]) arg in it) c = (grp | end_task) return c() so task flow reduced this, task = (group([tasks1.s(), task2.s()) | generate_job_requests.s() | dmap.s( execute_job.s(), aggregate_result.s())).apply_async() for getting ultimate output ...

Sparse matrix nonzero count in Eigen 3.3 -

in eigen 3.2 sparse matrices had method named 'nonzeros' returned count of non-zero elements. method seems gone in eigen 3.3. how 1 obtain number of nonzero in 3.3? it's still there. in eigen/src/sparsecore/sparsecompressedbase.h line 56 there 1 definition (for sparsecompressedbase ). template<typename derived> class sparsecompressedbase : public sparsematrixbase<derived> { ... protected: typedef typename base::indexvector indexvector; eigen::map<indexvector> innernonzeros() { return eigen::map<indexvector>(innernonzeroptr(), iscompressed()?0:derived().outersize()); } const eigen::map<const indexvector> innernonzeros() const { return eigen::map<const indexvector>(innernonzeroptr(), iscompressed()?0:derived().outersize()); } public: /** \returns number of non 0 coefficients */ inline index nonzeros() const { if(derived::isvectoratcompiletime && outerindexptr()==0) ret...

PROLOG defining 'delete' predicate -

delete(x,[x|r],[_|r]). delete(x,[f|r],[f|s]) :- delete(x,r,s). above definition of delete predicate, delete(x,l,r), intended delete every occurrence of x in l result r. i had queried below, , " g2397797 ". string stand for? ?- delete(1,[1,2,3,4,5],x). x = [_g2397797, 2, 3, 4, 5] . if correct first clause , remove unnecessary anonymous variable, get: delete_each(x, [x|l], l). delete_each(x, [y|ys], [y|zs]) :- delete_each(x, ys, zs). this use unification, , delete each occurrence of x in list upon backtracking: ?- delete_each(a, [a,b,a,c], r). r = [b, a, c] ; r = [a, b, c] ; false. do see how identical select/3 ? if want delete occurrences of x in list, can see answer @coder .

sql server - Why I cannot connect to remote database when using tablediff.exe? -

i trying sync tables on differenet servers (local 1 , remote one) using code rum command prompt: "c:\program files\microsoft sql server\120\com\tablediff.exe" -sourceserver localpc\sql2014 -sourcedatabase localdb -sourceschema sche -sourcetable table1 -destinationserver remotepc\sqlexpress -destinationdatabase remotedb -destinationschema sche -destinationtable table1 -et difference -f d:\table1_differences.sql but recieve error : unable access database remotedb the local db sql server 2014 express edition remote db sql server 2014 express edition firewall turned off. assigned admin user logon account sql service on remote server. note can connect remote db c# application or local sql server . thanks, solved assigning -destinationuser , -destinationpassword parameters

django + Nginx + Gunicorn - 404 for Static file when debug is false -

i dont know how nginx serves static files /etc/nginx/site-available/default : upstream example.com { server unix:/home/www/example/env/run/gunicorn.sock fail_timeout=0; } server { listen 80; server_name example.com; client_max_body_size 4g; access_log /home/www/example/logs/nginx-access.log; error_log //home/www/example/logs/nginx-error.log; location /static/ { alias /home/www/example/codeab/static/; } location /uploads/ { alias /home/www/example/codeab/uploads/; } location / { include proxy_params; proxy_pass http://unix:/home/www/example/env/run/gunicorn.sock; } # error pages error_page 500 502 503 504 /500.html; location = /500.html { root /home/www/example/templates/; } error_page 404 /401.html; location = /401.html { root /home/www/example/codeab/templates/; internal; } } django setting.py static_url = '/static/' staticfiles_d...

I am unable to upload my image to server using multipart data in swift3? -

i unable upload image on server. using multpart form data.i selecting image imagepicker controller.everything set imagerpicker delegate each , .after uploading image not shoeing error image not uploading on server.and when select image using imagepicker shows error creating image format unknown type error app not crashes this code using in swift3 sending image. here code using. viewcontroller.swift //i not writnig full code following action of button calling function button action{ // image let image = userimage.image let unwrappedimage = image! let data = uiimagejpegrepresentation(unwrappedimage, 1.0) let params = ["user_dob":dob, "user_gender":"1", "user_name": username, "user_status":userstatus] nsdictionary self.uploadrequest(image:data,parameters:params) } my function uploading image , data func uploadrequest(image:nsdata,parameters:nsdictionary){ let url = nsurl(string: ...

javascript - checking returned data from PHP script through jquery -

i have written php script cch.php $stmtcheck = $mysqli->prepare("select id members email=? , unlock_code=?"); $stmtcheck->bind_param("si", $_session['unlockemail'], $_post['code']); $stmtcheck->execute(); $stmtcheck->bind_result($id); $stmtcheck->fetch(); $stmtcheck->close(); and jquery submitting form is recover.php $("#formunlock").submit(function(e) { e.preventdefault(); $.ajax( { url: '../scripts/cch.php', method: 'post', data: $(#formunlock).serialize(), success: function() { alert("unlocked"); } }); }); now want check whether $id has value or not! how fetch $id variable main script? in cch.php, if want pass id javascript, can print id echo $id; what ever data received on ajax response passed parameter success callback function. either have execute success actions inside succes call or have wr...

Wi-Fi or hotspot Android connectivity -

is there way detect if user has connected wifi or hotspot? extra_* the above connectivity variables in android connectivity manager doesn't seem provide info hotspot or wifi. tried google couldn't find.

hdfs - How can i set the map chunk size in hadoop? -

i know default size of chunks in hadoop 64 mb. want change it. how can this? thanks in hadoop version 1.0 default size 64mb , in version 2.0 default size 128mb. if want change block size go hdfs-site.xml file , add following property <property> <name>dfs.block.size<name> <value>134217728<value> <description>block size<description> <property> note: should mention size in bits.for example : 134217728 bits = 128 mb. for further query go link ( extra ) change block size of existing files in hadoop

gitkraken - How to push/pull with Gitkrakent to/from Heroku? -

when try push/pull gitkrakent to/from heroku, gitkraken tells me : "please log in continue" what requested "user/login" ? (the 1 personal heroku account doesn't work"). lot ! pointing remote ssh protocol solved me. https://git.heroku.com/{your-app}.git => git@heroku.com:{your-app}.git make sure have same updated ssh keys in account settings in heroku related repository. you may use ssh-agent handle many keys

zend framework2 - How to get the ZFTool working? -

the zftool isn't working (anymore) on debian vm. $ zf /usr/local/bin/zf $ ls -lia /usr/local/bin/ | grep "zf" ... zf -> /usr/share/.composer/vendor/bin/zf.php $ cd /usr/share/.composer $ composer info | grep "zftool" zendframework/zftool v0.1.0 utility module zend framework 2 applications. $ echo $composer_home /usr/share/.composer now when start it: $ zf create module foo or $ $composer_home/vendor/bin/zf.php create module foo or $ php $composer_home/vendor/bin/zf.php create module foo i error: reason failure: invalid arguments or no arguments provided so cannot run zftool jobs config , classmap generate etc. what issues caused , how zftool working? you're providing incorrect arguments says. error coming withing zf2 you're triggering it, there's there's no -h option. try ./vendor/zendframework/zftool/zf.php or ./vendor/bin/zf.php no arguments , within root directory, you'll list of options. ...

c - Scanf with a specific format -

i allow user put input in specific format. the format: a=1,b=-2,c=3 example. spaces allowed inbetween commas , characters. i'm using: if (scanf("a=%lf,b=%lf,c=%lf",&a,&b,&c) == 1) reason doesn't work. how can fix it? you converting 3 numbers, return value should 3 if conversions successful. note %lf ignores spaces before number. if want ignore spaces around , , before = or a , add space in format string: double a, b, c; if (scanf(" =%lf , b =%lf , c =%lf", &a, &b, &c) == 3) { /* conversion successful, 3 numbers parsed */ ... } note scanf() not ignore space characters, ignore , whitespace characters, including newlines, tabs, etc.

npm - Warnings about peer in fresh install of AngularClass angular2-webpack-starter -

i new angular2. installed https://github.com/angularclass/angular2-webpack-starter , bit puzzled lot of warnings. first, have no idea if warnings harmless or not... or if may encounter issue later. have worry them ? i not understand should ok. see (1) so, have try correct them ? there risk break other packages, right ? see (2) & (3). secondly, warnings incompatible between them. how manage ? see (4) tslint@^3.9.0 /(3) tslint@4.0.0-dev.* , (4) rxjs@5.0.0-beta.12 / (2) rxjs@5.0.0-rc.2 thanks advices. regards. here warnings: (1) +-- unmet peer dependency @angular/common@2.1.1 +-- @angular/compiler@2.1.1 +-- unmet peer dependency @angular/core@2.1.1 +-- @angular/forms@2.1.2 whereas in package.json have: "dependencies": { "@angular/common": "2.1.1", "@angular/compiler": "2.1.1", "@angular/core": "2.1.1", "@angular/forms": "^2.1.1", "@angular/ht...

list - How to get count of items in this data structure when label missing in R? -

i want count of significant items 60, can see when str(res.r) see following fields not have name refer. normally, data made data.frame(v1, v2) , res.r$v1 here cannot. tried unsuccessfully res.r$1 . # ..$ : chr [1:60] "cyl" "disp" "hp" "wt" ... # ..$ : chr [1:2] "row" "col" minimal example referring lista[[1]] works simplest example lista <- c( list(seq(1,5)), list(seq(1,7)) ) str(lista) str(lista[[1]]) #list of 2 # $ : int [1:5] 1 2 3 4 5 # $ : int [1:7] 1 2 3 4 5 6 7 # int [1:5] 1 2 3 4 5 code referring res.r[[1]] not work here expected library("corrplot") library("psych") library("gplots") m.cor <- cor(mtcars) p.mat <- psych::corr.test(m.cor, adjust = "none", ci = f) alpha <- .0000005 plt.r <- corrplot(m.cor, method = "color", type = "upper", tl.col = 'black', ...

selenium - ChromeDriver.exe stopped working after patching on my Windows Remote Server -

chromedriver.exe has stopped working after patching on windows remote server these updates installed kb3018238,kb3175443,kb3177723 i have tried means including turning off dep , ip virtualization it's not working, when run remote jenkins jobs

digital ocean - Express JS with Node.JS -

i having problem website. running ubuntu 16.04.1 x64 node.js. website, whenever go other pages on website. directs them 404 page though have routing set it. here server.js file: var http = require('http'); var express = require('express'); var fs = require('fs'); var bodyparser = require('body-parser'); var app = express(); app.use('/',express.static(__dirname + '/')); app.use(bodyparser.urlencoded({ extended: false })); app.engine('.html', require('ejs').__express); app.set('view engine','html'); app.get('/', function(req, res){ res.render('index'); }); app.get('/resume', function(req, res){ res.render('resume'); }); app.get('/contact', function(req, res){ res.render('contact'); }); app.use(function(req, res) { res.status(404).render('404'); }); app.listen(3000, function () { console.log('listening on port 3000!...

java - Files not saving if app is installed from APK -

my app doesn't save files in internal storage if installed apk if installed ide adb saving. apk generated build/build apk i solved problem. don't know why when using fileoutputstream fos = new fileoutputstream(file); it wasnt working, when changed to: fileoutputstream fos = context.openoutputstream("file.txt", context.mode_private); it works fine.

Ratio-of-Uniforms Distribution in R -

i have exercise, in have create algorithm follows: ratio of uniforms based on fact random variable x density f(x) can generate x desired density calculating x = u/v pair (u, v ) uniformly distributed in set af = {(u,v):0 < v ≤ f(u/v)} random points can sampled uniformly in af rejection min- imal bounding rectangle, i.e., smallest possible rectangle contains af . given (u−, u+) × (0, v+) where v+ = max f(x), x u− = minx f(x), x u+ = maxx f(x) then ratio-of-uniforms method consists of following simple steps: generate random number u uniformly in (u−, u+). generate random number v uniformly in (0, v+). set x ← u/v . if v 2 ≤ f(x) accept , return x. else try again. my code far: x <- cnorm(1, mean = 0, sd=1) myrnorm <- function(pdf){ ## call rou() n times pdf <- function(x) {exp(-x^2/2)} } rou <- function(u, v) { uplus <- 1 vplus <- 1 n <- 100 u <- runif(n, min=0, max=uplus) v <- runif(n, min=0, max=v...

c# - ASP.NET MVC Model validation ignoring inputs that have become readonly -

i have form shipping , billing information using view model containing required attributes. here's exctract of code enough explain issue. extract of view model: public class checkoutviewmodel { [required] public string shippingpostalcode { get; set; } [required(errormessage = "*")] public string billingpostalcode { get; set; } } extract of razor form: @html.textboxfor(m => m.shippingpostalcode, new { @class = "form-control", placeholder = "postal code" }) @html.textboxfor(m => m.billingpostalcode, new { @class = "form-control", placeholder = "postal code", data_bind = "attr: { 'readonly': billingsameasshipping }" }) @html.validationmessagefor(model => model.billingpostalcode) i use knockout make billing fields (including billingpostalcode) readonly if checkbox checked using observable billingsameasshipping variable. <input type="checkbox" data-bind="chec...

javascript - $windows.localStorage reset when I call setItem() after I refresh the page -

Image
the following addtocart factory: .factory('addtocart', function ($window) { var products = {}; products.list = []; return { addproduct: function (_sku, _image, _name, _price, _quantity, _remark) { return products.list.push({ id: products.list.length, sku: _sku, image: _image, name: _name, price: _price, quantity: _quantity, remark: _remark }); }, updateproduct: function (_id, _sku, _image, _name, _price, _quantity, _remark, _show) { return products.list[_id] = { id: _id, sku: _sku, image: _image, name: _name, price: _price, quantity: _quantity, remark: _remark, show: _show }; }, saveproduct: function () { $window.localstorage.setitem("cartproducts", json.stringify(products.list)); }, getlocalstor...

python - printing CSV in a different way -

i need print out rankinglist csv file. can printed out, that's not problem this: [['team1', '100'], ['team2', '200'], ['team3', '300']] i want print out this: team1, 100 team2, 200 team3, 300 i found knowledge of python/ english language isn't high enough understand being explained on other stackoverflow topics here have ask simple possible piece of code i'm using def read(): = open('casus.csv','r') areader = csv.reader(a) = [] row in areader: if len (row) != 0: = + [row] print(a) if have 2 elements in each list, should work. def read(): = open('casus.csv','r') areader = csv.reader(a) row in areader: if len(row != 0): print(row[0]+","+row[1])

java - Problems making a soap request -

i'm trying make request soap api, using ksoap2 library version 3.6.2. the problem i'm getting error message: "soapfault - faultcode: 'soap:server' faultstring: 'server unable process request. ---> object reference not set instance of object.' faultactor: 'null' detail: org.kxml2.kdom.node@338a49b". my code looks this: string namespace = "x"; string method_name = "x"; string soap_action = "x"; string url = "x"; soapobject request = new soapobject(namespace, method_name); request.addproperty("username", "x"); request.addproperty("password", "x"); //request.addproperty("token","token","?"); log.i("soap: ", request.tostring()); soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.dotnet = true; envelope.implicittypes = false; envelope.setoutputsoapobject(request);...

angularjs - Module 'ng' has no exported member 'IDirective' -

i implemeting angular 1 directive typescript . looks fine, compiles, receive following error in visual studio code editor: module 'ng' has no exported member 'idirectivefactory'. here code: class mydirective implements ng.idirective { constructor(a, b) { ...... } static factory(): ng.idirectivefactory { const directive = (a, b) => new mydirective(a, b); directive.$inject = ['a', 'b']; return directive; } ///more code }; angular.module('module1').directive('mydirective', mydirective.factory()); i tried replace ng.idirectivefactory angular.idirectivefactory , , worked fine documentation says should use ng module instead of angular one. any ideas ? i guess you're importing angular way: import * angular 'angular'; they import in documentation this: import * ng 'angular'; they because it's shorter :).

winapi - Cast a ptr::null() to a Windows handle -

i'm trying use winapi crate create gui vst plugin . functions user32::setmenu need handles, of can null . the following method called when plugin loaded: fn open(&mut self, window: *mut c_void) { unsafe { let menu = user32::createmenu(); let sub_menu = user32::createmenu(); let hwnd: hwnd = window hwnd; user32::setmenu(hwnd, menu); let mut data = osstring::from("heee"); let raw = &mut data *mut _ lpwstr; let mut menu_item = menuiteminfow { cbsize: 0, fmask: 0o0000_0020 | 0o0000_0040, ftype: 0, fstate: 0, wid: menuitem_id, hsubmenu: sub_menu, hbmpchecked: ptr::null() hbitmap, hbmpunchecked: ptr::null() hbitmap, dwitemdata: 0, dwtypedata: raw, cch: 0, hbmpitem: ptr::null() *mut _, }; menu_item.cbsize = mem::size_of_val(&menu_item) u32; ...

php - convert emoji to their hex code -

i'm trying detect emoji through e.g. post (the source ist not necessary). as example i'm using emoji: ✊🏾 (i hope it's visible) the code u+270a u+1f3fe (i'm using http://unicode.org/emoji/charts/full-emoji-list.html codes) now converted emoji json_encode , get: \u270a\ud83c\udffe here part equal 270a . \ud83c\udffe not equal u+1f3fe , not if add them ( 1b83a ) how ✊🏾 u+270a u+1f3fe e.g. php? use mb_convert_encoding , convert utf-8 utf-32 . additional formatting: // strips leading zeros // , returns str in uppercase letters u+ prefix function format($str) { $copy = false; $len = strlen($str); $res = ''; ($i = 0; $i < $len; ++$i) { $ch = $str[$i]; if (!$copy) { if ($ch != '0') { $copy = true; } // prevent format("0") returning "" else if (($i + 1) == $len) { $res = '0'; ...

php - getting value of multiple check boxes inserted using foreach loop -

Image
i have created table of check boxes using 6 foeach loops. following output of table. i'm passing data retrieved database view names in above table.in view have created table follows. <tbody> <tr> <form data-toggle="validator" role="form" id="team_for_event" method="post" action="<?php echo base_url(); ?>index.php/event/team_for_event" > <td> <?php foreach($c_list $n_key){ ?> <div class="checkbox"> <label><input type="checkbox" id="c" name="c[]" value="<?php echo $n_key->name; ?>"> <?php echo $n_key->name; ?></label></div> <br/><br/> <?php }?> </td> <td> <?php foreach($ca_list $n_key){?> <div class="checkbox"> ...

python - How to increase yaxis on seaborn stripplot -

i trying increase number of y-ticks stripplot. my code is: g = sns.stripplot(data=flightdelays,x="delay", y="schedtime", jitter=true, size=10) i understand cannot alter y-axis using available commands within stripplot. the y-axis scheduled time in 24-hour form. able show me how set yticks every 100 i.e. every hour? the seaborn plot returns instance of matplotlib axes object, means matplotlib axes function can called. solution here is: g.set_ylim([min,max])

DynamoDB Query to get all rows between two string prefixes -

i'm storing attendance data per school/class/section/subject follows partition_key => schoolid + classid + sectionid + subjectid rangekey => ts + studentid my requirement search attendance records given partition key between timestamp ts1 , ts2. essentially, i'd need find range keys starting ts1 , ending ts2 + infinity. there way perform such query in dynamodb?

swift - Is the ios iPhone simulator causing memory usage analysis to swell? -

i trying process large text file in app. know want careful amount of memory being consumed while read data. once piece of data read app not need keep data around. thanks “martin r” , post read file/url line-by-line helping me jump start effort. i trying monitor memory consumption of app reads in large data file can sure behaving expected. here’s running problem. when run instruments using command-i within xcode , monitor allocations see during read of file app peeks @ ~15mb , drops down. repeatable +/- 0.5mb. when run app using command-r within xcode , let finish reading through file, , press record within instruments, memory consumption swells ~360mb. so clarify, 2 ways have done measurement of memory allocations are: profile: 1. xcode command-i. 2. instruments record allocations. observe ~15mb simulate , profile: 1. xcode command-r. 2. let app run “idle”. 3. instruments record. observe ~360mb. i have been trying figure out few things here. q1. why diffe...

aptana - Eclipse Neon Does Not Start -

eclipse neon displays error message box during startup , not open. message gives file path log file. in file see error message: !entry org.eclipse.e4.ui.workbench.swt 4 2 2016-11-13 08:50:49.856 !message problems occurred when invoking code plug-in: "org.eclipse.e4.ui.workbench.swt". !stack 0 java.lang.illegalaccesserror: com.aptana.editor.css.csssourceeditor.iswordwrapenabled()z @ org.eclipse.ui.texteditor.wordwraptoggleaction.iswordwrapenabled(wordwraptoggleaction.java:66) @ org.eclipse.ui.texteditor.wordwraptoggleaction.update(wordwraptoggleaction.java:57) @ org.eclipse.ui.texteditor.texteditoraction.<init>(texteditoraction.java:68) @ org.eclipse.ui.texteditor.wordwraptoggleaction.<init>(wordwraptoggleaction.java:34) @ org.eclipse.ui.texteditor.abstracttexteditor.createactions(abstracttexteditor.java:5898) @ org.eclipse.ui.texteditor.abstractdecoratedtexteditor.createaction the os ubuntu 16.04 i found solution , worked m...

ruby - Prevent Custom Validation Error on Association -

i have app list , email models many many association. want users able add many emails lists @ once, have function in controller split emails custom textfield in new list form "emails" array. i want validation error if it's blank added custom validation on field in lists model: class list < applicationrecord has_and_belongs_to_many :emails #tried adding ", validates: false" here too, didn't work #custom attr_accessor :emails validates :emails, presence: true end it works great, except when try associate existing email list (in case user entered 1 in db), validation error. oddly, can prevent validation error when associating net new emails lists "(validation: false)" seen below, not when email exists already, if add save function , append "validation: false". part of controller in question is: emails.each |email| if email.where(email: email).blank? db_email = email.new( email: email ) db_email...

.htaccess to remove a string within a URL -

i working on website uses dokuwiki , website called miscwiki . currently of urls structured way http://www.miscwiki.org/doku.php/something/something i use .htaccess rewrite remove doku.php url. have statement not working. rewriterule ^([^/]+)/doku.php/?(.*)$ /$1 [r=301,l] thank on one. you can use these rules in site root .htaccess: acceptpathinfo on rewriteengine on ## uncomment next 2 lines when want remove doku.php/ old links #rewritecond %{the_request} \s/+doku\.php/(\s*) [nc] #rewriterule ^ /%1 [r=301,ne,l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule .+ doku.php/$0 [l]

ggplot2 - R ggplot annotated with atop using three values and bgoup -

is there way annotate ggplot 3 lines 1 on top of other, while keeping text sizes same across 3 lines? i there text sizes different in third line, looks bgroup using first 2 lines , cannot right... i adding text using "atop" applications "?plotmath", works fine text in third line comes out in different size compared other 2 lines... library(ggplot2) line1 = "xxx data1" line2 = "yyy data2" line3 = "zzz data3" df=data.frame(x=rep(1:8, 3), y=c(0,1,3,4,5,6,7,8, 8,7,6,3,2,1,3,4, 0,2,4,5,6,7,8,9), variable=c("x", "x","x","x","x","x","x","x","y","y","y","y","y","y","y","y","z","z","z","z","z","z","z","z")) p <- ggplot(df) + theme_bw() + geom_point(aes(x=x,y=y, color=variable)) + geom_line(aes(x...

winapi - Why do WM_APPCOMMAND LPARAM have to be multiplied by 65536 -

i trying control master volume. able succesfully this: hwnd mainhwnd = createwindow(szwindowclass, _t("window-noit-ext-profilist"), 0, 0, 0, 0, 0, hwnd_message, null, wcex.hinstance, null); if (!mainhwnd) { messagebox(null, _t("profilist: call createwindow failed!"), _t("window-noit-ext-profilist"), null); return 1; } sendmessage(mainhwnd, wm_appcommand, (wparam)mainhwnd, (lparam)(appcommand_volume_mute * 65536)); // mute sendmessage(mainhwnd, wm_appcommand, (wparam)mainhwnd, (lparam)(appcommand_volume_down * 65536)); // vol down sendmessage(mainhwnd, wm_appcommand, (wparam)mainhwnd, (lparam)(appcommand_volume_up * 65536)); // vol why have multiply 65,536? docs not state this. if don't multiply, doesn't work. for wm_appcommand, lparam parameter packs 3 values in single integer. the lower 16bit word, dwkeys , indicates whether various virtual keys down. the higher 16bit word packs 2 fields: highest 4 bits, udevice ...

osx - Trying to get my Mac to work as a Xamarin build host -

i trying doing xamarin development on windows machine visual studio. have imac 2009 running mac os x lion 10.7.5 . right when go set mac agent in visual studio on windows machine seems able find imac gives error when trying connect "os x yosemite or higher required" . ve looked around on net . more cemented in windows world need ask , d o have options outside of getting new machine ? doesn't seem os x yosemite option imac (be built in 2009)..is true or have wrong? advice appreciated. jason

Iteratively posting via cURL set of Json records in bash -

i have set of json records in file. post iteratively. example file "jsondata.dat" contains following json records { "json_records":[ { "name": "name_1", "mark": "mark_1" }, { "name": "name_2", "mark": "mark_2" } ] } i post each json record i.e. { "name": "name_x", "mark": "mark_x" } in separate curl post. how achieve in bash? i use jq pipe each record single line, read output while loop pass curl . jq -c '.json_records[]' | while ifs= read -r rec; curl -x post -d"$rec" "$url" done

r - How to give every year a number for unique players -

this question has answer here: create sequential number (counter) rows within each group of dataframe [duplicate] 6 answers is there option give every year number unique player in r? example: playerid yearid stint teamid lgid pos g po e dp score <chr> <chr> <chr> <fctr> <fctr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 aardsda01 2004 1 sfn nl p 11 0 0 0 0 0.0 2 aardsda01 2006 1 chn nl p 45 1 5 0 1 7.5 3 aardsda01 2007 1 cha al p 25 2 4 1 0 3.5 4 aardsda01 2008 1 bos al p 47 3 6 0 0 9.0 5 aardsda01 2009 1 sea al p 73 2 5 0 1 7.5 6 aardsda01 2010 1 sea ...

javascript - CSS transition inline menu -

i need inline menu transition. i tried recode example requirement, have problem a:hover class - maybe problem in js class. but have no idea how red background under main link (dropdbtn class) while scrolling submenu. $(document).ready(function() { console.log("ready!"); $(".dropdown-content").mouseenter(function() { $(this).prev().addclass('href-hovered'); }) $(".dropdown-content").mouseleave(function() { $(this).prev().removeclass('href-hovered'); }) }); .nav { width: 1200px !important; height: 50px; padding-bottom: 20px; list-style: none; margin: 0; padding: 0; } .nav ul { margin: 0; padding: 0; list-style: none; display: table; } .nav a.dropbtn { display: block; line-height: 1.5em; color: #bcf1f3; font-family: 'webfont'; font-size: 1.5em; width: 170px; } .nav a.dropbtn:hover { display: block; //padding:20px 40px; line-height...

sql - Trouble with the MS Access AutoNumber field and VB.net -

i've started teaching myself database access vb.net , i've been using this reference . ms access database little more complex example reference goes through since i've set relational database. have 2 tables; players and, villages. each player can have 1 more more villages (1 many relationship), relationship tied between player id unique key in players table , used in villages table define owner of village. here's how add new player database; public sub newplayer(byval playername string) dim playerid integer = getlastident("players") + 1 dim tmpnum integer = playerid dim dsnewrow datarow dim sql string sql = "select * players" da = new oledb.oledbdataadapter(sql, con) da.fill(ds, "players") dim cb new oledb.oledbcommandbuilder(da) dsnewrow = ds.tables("players").newrow() dsnewrow.item("id") = playerid dsnewrow.item("namep") = playername dsnewrow.ite...