Posts

Showing posts from February, 2014

c++ - When embed one application into Qt application, hwo to get the mouseMoveEvent and embed windows size -

i use qx11embedcontainer embed application: spicec(it based on x11). follows: qx11embedcontainer spicec; spicec.embedclient(winid); spicec.setmousetracking(true); spicec.show(); i have unresolved questions: i reimplemented mousemoveevent, not work (the parent widget set setmousetracking(true) too); how can mouse move event qx11embedcontainer? or there way can mouse move event, mouse not in qt windows (global mouse move event)? since embeded windows have own size, there way original size of the embeded windows? because want adjust qt application show full content. the environment ubuntu 14.04 , qt 4.8.

How to create a git patch from the differences between 2 repos but keep the history? -

the code in our repo copy of download of source rather git clone (the repo wasn't available @ time) when doing git blame, lot of files author downloaded code. we have since made lot of changes code. but have access original repo, i'd add git history original repo. wondered if possible? if do cd originalrepo git checkout taggedversionineed git log copy last commit hash cd ../ourcode git remote add upstream ../originalrepo git fetch upstream git checkout develop git diff taggedversionhash it happily shows differences between 2 without history. if try git format-patch taggedversionhash --stdout > ../mypatch.patch it seems add commits, not code differences. when do git checkout -b feature_updatehistory taggedversionhash git < ../mypatch.patch i lots , lots of applying: commitmessage error: patch failed: filename:387 error: filename: patch not apply patch failed @ 0001 commitmessage copy of patch failed found in: /home/username/www/mycode/.git/

Updating row on mysql php -

i want update row on table , not updating. html , php code : <?php if ($_get) { if (isset($_get['id'])) { $id = preg_replace('#[^0-9]#', '', $_get['id']); echo $id; $query = "select * posts id='{$id}'"; $result = mysqli_query($connect, $query); $rows = mysqli_fetch_assoc($result); } elseif (empty($_get['id'])) { header("location: manage_posts.php"); } } ?> <form action="modify_post.php?id=<?php echo $id; ?>" method="post"> <h3>post title <?php //echo $id; ?></h3> <input name="title" value="<?php echo $rows['title'];?>" type="text" placeholder="title here ..." id="title" required> <h3>post content</h3> <textarea name="content" required placeholder="title here ..." style="resi

algorithm - Solving a TSP-related task -

i have problem similar basic tsp not quite same. i have starting position player character, , has pick n objects in shortest time possible. doesn't need return original position , order in picks objects not matter. in other words, problem find minimum-weight (distance) hamiltonian path given (fixed) start vertex. what have currently, algorithm this: best_total_weight_so_far = inf foreach possible end vertex: add vertex 0-weight edges start , end vertices current_solution = solve tsp graph remove 0 vertex total_weight = weight (current_solution) if total_weight < best_total_weight_so_far best_solution = current_solution best_total_weight_so_far = total_weight however algorithm seems time-consuming, since has solve tsp n-1 times. there better approach solving original problem? it rather minor variation of tsp , np-hard. heuristic algorithm (and shouldn't try better heuristic game imho) tsp should modifiable situation

c++ - ctypes passing C string to Python, ValueError: invalid string pointer -

i'm trying pass const char * c code python via ctypes. here code: .h file: extern "c" { _declspec(dllexport) const char * return_string(); } .cpp file: const char * return_string() { const char* test = "test"; return test; } python code: a = lib.return_string(); print("a =",a) b = c_char_p(a).value print(b) result: > = -1781171860 traceback (most recent call last): file > "c:\users\krzys\desktop\test\pythontest.py", > line 23, in <module> > b = c_char_p(a).value valueerror: invalid string pointer 0xffffffff95d5796c [finished in 0.1s] what causes problem? is related memory management or wrong approach of getting c string?

c++ - Rendering to a CCRenderTexture not working -

i'm trying use ccrendertexture create heightmap use terrain class. don't know if best way it, i'm newb both opengl , cocos2d-x, please bear me. auto* rendertexheightmap = ccrendertexture::create(width, height); rendertexheightmap->begin(); glrasterpos2i(0, 0); gldrawpixels(width, height, gl_rgb, gl_float, pixelbuffer); rendertexheightmap->end(); rendertexheightmap->savetofile("heightmap.jpg", false); i know pixelbuffer contains data want (greyscale pixel data), whenever call ccrendertexture::savetofile black picture. missing? rendertexture delay 1 frame render ,so need savetofile @ next frame,my english not ,do anderstand? can use delaytime or way way: code type lua local function save() rendertexture:savetofile("heightmap.jpg",false) end local callfunc = cc.callfunc:create(save) local dela = cc.delaytime:create(0.01) local seq = cc.sequence:create(dela,callfunc) node:runaction(seq)

go - Redis Pub/Sub Ack/Nack -

is there concept of acknowledgements in redis pub/sub? for example, when using rabbitmq, can have 2 workers running on separate machines , when publish message queue, 1 of workers ack/nack , process message. however have discovered redis pub/sub, both workers process message. consider simple example, have go routine running on 2 different machines/clients: go func() { { switch n := pubsubclient.receive().(type) { case redis.message: process(n.data) case redis.subscription: if n.count == 0 { return } case error: log.print(n) } } }() when publish message: conn.do("publish", "tasks", "task a") both go routines receive , run process function. is there way of achieving similar behaviour rabbitmq? e.g. first worker ack message 1 receive , process it. redis pubsub more broadcast mechanism. if want queues, can use blpop al

javascript - google.maps.LatLng is not a function -

all. building web app google map. working fine until decided add autocomplete feature address box. original javascript include was: everything working fine. once added autocomplete feature, saw had change javascript include to: <script src="https://maps.googleapis.com/maps/api/js?signed_in=true&libraries=places&callback=initautocomplete" async defer></script> the autocomplete works, older map code broken. specifically, error: typeerror: google.maps.latlng not function i everywhere have following code: var googleposition = new google.maps.latlng(lat, lng); from tests, can tell has portion after javascript include. signed_in=true&libraries=places&callback=initautocomplete async defer any ideas how can both of these features working together? thanks! yes, rid off async defer attributes. then have @ this: https://developer.mozilla.org/en/docs/web/html/element/script async set boolean attribute indi

How can to set validation (org.hibernate.validator.constraints) for rest in spring boot project? -

i have project spring boot, spring mvc , hibarnate, , want validate rest params, have controller: import domain.user; import service.userservice; import validate.email; import org.apache.log4j.logger; import org.hibernate.validator.constraints.notempty; import org.springframework.beans.factory.annotation.autowired; import org.springframework.stereotype.controller; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod; import org.springframework.web.bind.annotation.responsebody; import javax.ws.rs.formparam; import java.util.arraylist; import java.util.list; @controller public class usercontroller { @autowired private userservice userservice; @requestmapping(value = "/registration", method = requestmethod.post) public @responsebody boolean registration(@notempty @formparam("login") string login, @notempty @formparam("password") str

access dictionary with unicode keys from django template -

i have dictionary unicode keys (the dictionary being pulled mongo db). when render in template, cant access using keys since there no way generate unicode string in template (none know of) here code: (abbreviated) views.py context={ 'title':'mytitle', 'options'={ u'a':u'1st option', u'a':u'1st option', u'a':u'1st option', u'a':u'1st option', u'a':u'1st option' } } return render(request,'trial.html',context) trial.html <head> <title>{{title}}</title> </head> <body> {% in 'abcde' %} <div>{{options.i}}</div> </body> all want show values in option in alphabetic order of keys. if can done in other way doesn't need solve unicode issue, happy. if there way ascii st

javascript - Div not responding to jQuery function -

i have bunch of products loaded(append-ed) page when user loads page first time. use $.post() call database , append data number of divs container. $(function() { var profile_looks = $('#profile_looks'); $.post("apples.php", function(json) { var looks = $.parsejson(json); profile_looks.prepend( (some code here) ) }); // close $.post() after these products loaded, want products change background color on hover. var product_tags = $('.product_tags'); product_tags.mouseenter(function() { $(this).css('background-color', 'white'); }); }); // close $(function() however step 2 not work, meaning when mouseover product_tags, not change. why aren't product_tags div responding function call? full code below $(function() { var profile_looks = $('#profile_looks'); $.post("apples.php", function(json) { var looks = $.parsejson(json);

html - <svg> element match child width and height -

i have simple svg element has children of elements: fiddle <svg xmlns:xlink="http://www.w3.org/1999/xlink"> <g opacity="1" transform="translate(0,0) scale(3,3) rotate(0)"> ... </g> </svg> the first <g> node has size of 31x42 px, <svg> element has default size of 300x150 px. want svg take size of children nodes, how that? adding height=100% doesn't work (it remains @ 300x150). if don't mind use javascript can this: document.getelementsbytagname('svg')[0].style.height = document.getelementsbytagname('g')[0].getboundingclientrect().height + 'px'; <svg xmlns:xlink="http://www.w3.org/1999/xlink"> <g opacity="1" transform="translate(0,0) scale(3,3) rotate(0)"> <g transform="translate(2.2775,3) scale(1,1) rotate(0)"> <g transform="translate(0,0) scale(1,1) rota

javascript - Avoiding Promise anti-patterns with node asynchronous functions -

i've become aware of promise anti-patterns , fear may have fallen 1 here (see code extract within function). can seen, have promises nested within 2 node asynchronous functions. way have been able expose inner promise using outer one. i'd welcome guidance on how write more elegantly. function xyz() { return new promise(function(resolve, reject) { return resto.find({recommendation: {$gte: 0}}, function (err, data) { if (err) return reject("makesitemap: error reading database"); return fs.readfile(__dirname + '/../../views/sitemap.jade', function(err, file) { if (err) return reject("makesitemap: error reading sitemap template"); [snip] resolve(promise.all([ nlpromise('../m/sitemap.xml', map1), nlpromise('../m/sitemap2.xml', map2) ])); }); }); }); } i've caught

javascript - Layout Attribute not working -

i'm doing stupidly wrong. i'm using polymer 1.0 , trying make basic module. when specify layout attributes won't work. however, if type class="layout flex [etc..]" , on, work. see below: <script src="bower_components/webcomponentsjs/webcomponents.min.js"></script> <script src="bower_components/time-elements/time-elements.js"></script> <link rel="import" href="/bower_components/polymer/polymer.html"> <dom-module id="x-chat-list"> <template> <section class="user-list" layout horizontal> <div class="avatar {{color}}" style="background-image: url({{avatar}})"> <div class="status {{status}}"></div> </div> <div flex> <div class="username">{{username}}</div> <div class="text">{{text}}</div>

php - Sending email form -

i have created html form, , part of php script. below. i need, somehow, send form, using mail function. how do this? html: <form id="kontaktform" action="scripts-contactform/recieving.php" method="post"> <div id="kontaktformvenstre"> <div id="inputfields_container"> <div id="inputfield_container"> <input class="inputfield" type="text" name="name" placeholder="dit navn" /> </div> <div id="inputfield_container"> <input class="inputfield" type="text" name="email" placeholder="din e-mail" /> </div> </div> <div id="inputfieldmessage_container"> <textarea class="inputfieldmessage" name="message" placeholder="din be

android - Quadrant 3 positions in a quadrant 4 imageview -

Image
i'm putting demo of indoor positioning technology android device. problem getting quadrant 3 positions system i'm using, 0,0 origin in upper right. map placed in imageview has origin in upper left (quadrant 4). naturally, when try put image on top move around according position getting, backwards on x-axis. best way display right coordinates? can transform points them, or there way somehow flip imageview origin in upper right? you have transform coordinates yourself. not complex - mapping values 1 other, in general. if image has width of "wo" , have vo (view origin) , mo (map origin) x coordinate map mx , transformed vx = mx + wo. (mx map x coordinates have negative values, no greater wo , no less 0). transform view map, opposite: mx = vx - wo. (the vx x-coordinates not have values less 0, , @ greatest width, should result in "0" on map.) that not cpu intensive, should fast.

html - Gray out background image without affecting nav bar or text -

so i'm trying gray out background image (oldrag.jpg), keep nav bar , other text on home page on top of , still in color. code i've pasted has background image code removed. i've tried of different ways of graying out background image in html, css, , html , css, , none of them work correctly. either gray out nav bar , text, or push nav bar down , text gets stuck in image. index.html <html> <title>edited privacy - index</title> <style> ul { list-style-type: none; margin: 0; padding: 0; } a:link, a:visited { display: block; width: 100px; font-weight: bold; color: #ffffff; background-color: #98bf21; text-align: center; padding: 4px; text-decoration: none; text-transform: uppercase; } a:hover, a:active { background-color: #7a991a; </style> <ul id="nav"> <li><a href="index.html">home</a></li> <li><a href="conta

c++11 - Implementing a fixed run-time size array. Should move ctor and swap throw exceptions? -

the problem std::array has fixed compile-time size. want container can created dynamic size, size stays fixed throughout life of container (so std::vector won't work, because push_back increment size 1). i wondering how implement this. tried writing class contains internal std::vector storage, , exposes members of std::vector don't change size. question regarding copy/move assignment operators, swap member function. usually, move assignment declared noexcept . however, before assignment, have check if lhs , rhs of same size. if not, must throw exception, because otherwise, assigning rhs lhs change size of lhs , don't want. same happens swap , in implementation noexcept same reason. i know going against usual advice make swap , move assignment noexcept (item 14 of scott meyers' modern effective c++), wondering if design? or there better way implement fixed runtime size container? example: suppose have defined fixed size container name fixedsizearr

c++ - Why I cannot use previous argument values to define argument default values? -

for example, why cannot write this: void f(double x, double y = x); to declare function f , call f(x) equivalent f(x,x) ? in case doesn't seem useful you, here's possible usage scenario. in example, declare f follows: void f(double x, double y = expensivecomputation(x)); where expensivecomputation denotes, guessed it, function slow computation. want give user of f possibility of passing in value of y if has computed previously, don't have compute again inside f . now, of course can resolve writing 2 overloads: void f(double x, double y); void f(double x) { f(x, expensivecomputation(x)); } but writing overloads becomes tiresome number of arguments grows. example, try write: void f(double x, double p = expensivecomputation(x), double q = expensivecomputation2(x, p), double r = expensivecomputation3(x, p, q), double s = expensivecomputation3(x, p, q, r)); using overloads. it's uglier. default a

Having trouble to exportmap in OpenLayer 3 + Javascript -

i'm trying export map, i'm getting same error: failed execute 'todataurl' on 'htmlcanvaselement': tainted canvases may not exported. i have following code: var canvas = event.context.canvas; var exportpngelement = document.createelement('a'); exportpngelement.download = 'mapa.png'; exportpngelement.href = canvas.todataurl('image/png'); document.body.appendchild(exportpngelement); exportpngelement.click(); document.body.removechild(exportpngelement); what wrong? have idea? to honest not answering question. did not check why example not work. propose using different approach: canvas.todataurl unreliable browser crashes depending on size of exported file. works lightweight maps. real life applications have use canvas.toblob instead. more info on canvas.toblob: https://developer.mozilla.org/en-us/docs/web/api/htmlcanvaselement/toblob canvas.toblob works in firefox ( https://developer.mozilla.org/en-us/docs/web/api

deployment - Google Kubernetes storage in EC2 -

i started use docker , i'm trying out google's kubernetes project container orchestration. looks good! the thing i'm curious of how handle volume storage. i'm using ec2 instances , containers volume ec2 filesystem. the thing left way have deploy application code ec2 instances, right? how can handle this? it's unclear you're asking, place start reading options volumes in kubernetes . the options include using local ec2 disk lifetime tied lifetime of pod ( emptydir ), local ec2 disk lifetime tied lifetime of node vm ( hostdir ), , elastic block store volume ( awselasticblockstore ).

ant - UglifyJS file watcher in IntelliJ minifies already minified files during build -

i have uglifyjs file watcher set in intellij idea, , works great while i'm editing -- modify source js, minified version gets created next automatically. however, when run ant build, , copies minified versions build working dir, watcher "helpfully" creates doubly minified versions of them (*.min.min.js) in build working dir, not ok. i've set scope of watcher 'src' module, apparently doesn't you'd think would, because doubles created when ant copies files 'build' module. happens when use idea manually copy single file src build too. i don't see how set include *.js exclude *.min.js, right thing. (seems sensible uglify should have built in, far can see doesn't.) other getting rid of watcher , scripting build minification, or copying original js versions , letting watcher (re)create minified ones, what's best way go here? got working, helpful commenter on idea forum . key setting custom scope, tried before failed.

java - Print the type of object using Iterator -

i write method printing type of object not working properly. idea read input, insert them in arraylist , then, print types. provide input follow 42 3.1415 welcome hackerrank java tutorials! and eventually, output in reverse order such string: welcome hackerrank java tutorials! double: 3.1415 int: 42 it come in serial int, double , string. method provided below 1 solution. i'm trying solve bufferedreader now. public static void printmethod ( ){ list<object> arr = new arraylist<object>(); scanner scan = new scanner(system.in); int count = 0; while (scan.hasnextline()) { count++; string line = scan.nextline(); if( count == 1 ){ try { integer v = integer.valueof(line.trim()); arr.add(v); continue; } catch (numberformatexception nfe) { } } if ( count == 2 ){ try {

c++ - Multiple template matching only detects one match -

Image
i'm trying match image in image however, can't find more 1 boss enemy. need find others? image loading struct xyposition{ float x; float y; }; std::vector<cv::mat> bosslist; std::string bossstrings[1] = { "sprites\\boss\\bossup.png" }; (int = 0; < 1; i++){ cv::mat pic = cv::imread(bossstrings[i], cv_load_image_grayscale); bosslist.push_back(pic); } multipletemplatematch(screenimage, bosslist); template matching std::vector<xyposition> multipletemplatematch(cv::mat &img, std::vector<cv::mat> tpllist){ std::vector<xyposition> matches; cv::mat convertimg(img.rows, img.cols, cv_8uc3); cv::cvtcolor(img, convertimg, cv_bgra2gray); double threshold = 0.8; int imgint = convertimg.type(); for(cv::mat tpl : tpllist){ int tplint = tpl.type(); cv::mat result(convertimg.rows - tpl.rows + 1, convertimg.cols - tpl.cols + 1, cv_32fc1); //must result type cv::matchtemplate(convertimg, tpl, resu

r - Technical error of measurement (TEM) for 3 or more participants -

Image
i need implement formula r function. surprise there no r packages tem function 3 or more participants. me out? here go # m : data frame of different measurements tem <- function(m) { nrows <- nrow(m) ncols <- ncol(m) sqrt(sum(apply(m,1,function(x) sum(x^2) - sum(x)^2/ncols))/(nrows*(ncols-1))) } here's example child_data <- data.frame( height_a=c(64.50,71.00,58.00,58.00,70.50,69.00,63.00,65.00,62.00,68.00), height_b=c(64.00,71.50,59.00,58.00,71.50,67.50,64.00,64.50,62.00,68.00) ) tem(child_data) # 0.5477 this figure presented in paper referenced. then, example (three columns) child_data$height_c <- c(63.5,71.3,59.0,58.5,71.4,67.4,64.2,64.50,62.5,67.5) tem(child_data) # 0.5

Ripple emulator is not working with Ionic on Mac OSX -

i getting error: error: static() root path required when using ripple emulator ionic framework. ripple emulate i found way work, added path apps www folder working now. ripple emulate --path /users/user/desktop/app/www more here: https://www.npmjs.com/package/ripple-emulator

csv - Filter/grok method on logstash -

supposed have log file: jan 1 22:54:17 drop %logsource% >eth1 rule: 7; rule_uid: {c1336766-9489-4049-9817-50584d83a245}; src: 70.77.116.190; dst: %dstip%; proto: tcp; product: vpn-1 & firewall-1; service: 445; s_port: 2612; jan 1 22:54:22 drop %logsource% >eth1 rule: 7; rule_uid: {c1336766-9489-4049-9817-50584d83a245}; src: 61.164.41.144; dst: %dstip%; proto: udp; product: vpn-1 & firewall-1; service: 5060; s_port: 5069; jan 1 22:54:23 drop %logsource% >eth1 rule: 7; rule_uid: {c1336766-9489-4049-9817-50584d83a245}; src: 69.55.245.136; dst: %dstip%; proto: tcp; product: vpn-1 & firewall-1; service: 445; s_port: 2970; jan 1 22:54:41 drop %logsource% >eth1 rule: 7; rule_uid: {c1336766-9489-4049-9817-50584d83a245}; src: 95.104.65.30; dst: %dstip%; proto: tcp; product: vpn-1 & firewall-1; service: 445; s_port: 2565; jan 1 22:54:43 drop %logsource% >eth1 rule: 7; rule_uid: {c1336766-9489-4049-9817-50584d83a245}; src: 222.186.24.11; dst: %dstip%

WSO2 App Manager single sign-on across mobile applications -

i ask there method or documentation newly released wso2 app manager configure single sign-on across mobile application promoted ? (e.g. http://www.openhealthnews.com/content/wso2-founder-and-ceo-unveil-latest-product-developments-harnessing-today%e2%80%99s-connected-world-w ) i have tried search every found nothing yet when comes sso acorss application mobile. wso2 app manager 1.0.0 not support in-app management features such sso mobile apps. current version of app manager support single sign-on (sso) across web applications.

c++ - How to count how many times each number has been encountered? -

i trying write program count each number program has encountered. putting m input number of array elements , max maximum amount of number shouldn't exceed number when writing input in m[i]. reason program works fine when enter small input data input: 10 3 1 2 3 2 3 1 1 1 1 3 answer: 5 2 3 but when put big input 364 array elements , 15 example max. output doesn't work expected , can't find reason that! #include "stdafx.h" #include <iostream> #include<fstream> #include<string> #include <stdio.h> #include<conio.h> using namespace std; int arrayvalue; int max; int m[1000]; int checker[1000]; int element_cntr = 0; int cntr = 0; int n = 0; void main() { cout << "enter lenght of elements, followed maximum number: " << endl; cin >> arrayvalue>> max; (int = 0; < arrayvalue; i++) { cin >> m[i]; checker[i]= m[i] ; element_cntr++; if (m

recursion - python tail recursive function doesn't return -

i have function modifies list, doesn't return anything. long function give example, following has same problem. why not returning anything? def inventedfunction(list1): list2=list1[:-1] if len(list2)!=1: inventedfunction(list2) else: return list2 replace inventedfunction(list2) return inventedfunction(list2) . if call without return statement, result thrown out. working code: def inventedfunction(list1): list2=list1[:-1] if len(list2)!=1: return inventedfunction(list2) else: return list2

c# - Dynamically generate DatePicker controls on the basis of Database values -

i have multiple rows inside database table id qid qname qtext qtype version 5 10025 datefrom daterange 1 5 10026 dateto daterange 1 i want dynamically generate datepicker controls on basis of values database table. question use qname , qid differentiate between (smaller id) , (greater id) generate controls, , apply comparevalidator to check date range validation . loop through controls on basis of id. here code generate controls. case "daterange": raddatepicker rdpdatefrom = new raddatepicker(); rdpdatefrom.cssclass = "form-control form-control-item"; rdpdatefrom.id = "rdpdatefrom" + j.tostring() + "-" + counter; rdpdatefrom.autopostback = false; rdpdatefrom.datepopupbutton.visible = true; rdpdatefrom.showpopuponfocus = true; rdpdatefrom.enablescreenboundarydetection = true; rdpdatefrom.maxdate = datetime.now; txtc1.controls.add(rdpdatefrom); raddatepic

Use datatables button extension in AngularJS -

i've been using angularjs.datatables , want enable export excel/pdf. angularjs-datatables project include support tabletools extension read on datatables site tabletools retired , should use buttons purpose. can't seem find reference new extension being use angular anywhere. if can point out me how use it, i'll appreciate. if it's not possible use buttons, please share experience using tabletools. goal print , export excel/pdf customized columns (render differently between view , export) thanks. you have add required js file: - angular-datatables.buttons.min.js and add dependency datatables.buttons angular app html: <div ng-controller="withbuttonsctrl showcase"> <table datatable="" dt-options="showcase.dtoptions" dt-columns="showcase.dtcolumns" class="row-border hover"></table> js: angular.module('showcase.withbuttons', ['datatables', 'datatables.butt

libgdx - GlyphLayout sometimes through ArrayIndexOutOfBoundsException -

there lot of label in game, use bitmapfont draw. exception through when run game 20-30 minutes 08-17 00:29:37.520: w/system.err(6526): java.lang.arrayindexoutofboundsexception: length=127; index=-1050 08-17 00:29:37.520: w/system.err(6526): @ com.badlogic.gdx.utils.array.pop(array.java:294) 08-17 00:29:37.521: w/system.err(6526): @ com.badlogic.gdx.utils.pool.obtain(pool.java:50) 08-17 00:29:37.521: w/system.err(6526): @ com.badlogic.gdx.graphics.g2d.glyphlayout.settext(glyphlayout.java:135) 08-17 00:29:37.521: w/system.err(6526): @ com.badlogic.gdx.graphics.g2d.bitmapfontcache.addtext(bitmapfontcache.java:482) 08-17 00:29:37.521: w/system.err(6526): @ com.badlogic.gdx.graphics.g2d.bitmapfontcache.addtext(bitmapfontcache.java:464) 08-17 00:29:37.521: w/system.err(6526): @ com.badlogic.gdx.graphics.g2d.bitmapfont.draw(bitmapfont.java:198) 08-17 00:29:37.521: w/system.err(6526): @ thanbaigog.actor.baselabelactor.draw(baselabelactor.java:179) 08-17 00:29:

javascript - IP address error when i am trying to access my application using tomcat on windows 7 -

the webpage @ http://192.168.1.101:8085/demo/main.html might temporarily down or may have moved permanently new web address. how resolve such error ? when try access through ip address in own computer runs fine. here server.xml : <?xml version="1.0" encoding="utf-8"?> <!-- licensed apache software foundation (asf) under 1 or more contributor license agreements. see notice file distributed work additional information regarding copyright ownership. asf licenses file under apache license, version 2.0 (the "license"); may not use file except in compliance license. may obtain copy of license @ http://www.apache.org/licenses/license-2.0 unless required applicable law or agreed in writing, software distributed under license distributed on "as is" basis, without warranties or conditions of kind, either express or implied. see license specific language governing permissions , limitations under license. -

javascript - Write multiple strings to stdout and pipe them separately -

is possible pipe each string written standard out command? // file example.js #!/usr/bin/env node process.stdout.write('foo') process.stdout.write('bar') when run ./example.js | wc -m 6, value of character length of both foo , bar together. i'd values 3 , 3 separately. have special within javascript file? or command? wc -m counts number of characters in input. can't make separate/group line (or other grouping matter). has nothing js code. if you'd type of counting other means, it's not difficult node!

android json object some issue in code not able to get the json array from php -

i cant following array object php side {"result":"sucess","data":["painting service","plumbing service", "electrical service","carpentry services","aluminium works", "house cleaning","home appliance","glazing cleaning", "yard maintenance","water tank cleaning", "electronics services","upholstery services","dry cleaners",""],"msg":" sucessfull"} this json responce php side and im using protected string doinbackground(string... args) { list<namevaluepair> userpramas = new arraylist<namevaluepair>(); //string =(spinerplan.getselecteditem().tostring()); userpramas.add(new basicnamevaluepair("package_type",glbstr_plan)); jsonobject json = jsonparser.makehttprequest(commonclass.servivecs_url, "post&

regex - javascript regular expression replace in input form validation -

when inputting string format: the beginning r or r , non-digit letters, want replace string r . it's in situation: onkeyup="this.value=this.value.replace(/^[rr]\d/g,'r')" but not work. somebody can me out? thanks. use following regex: onkeyup="this.value=this.value.replace(/^[rr]\d+/, 'r')"; see demo: <input onkeyup="this.value=this.value.replace(/^[rr]\d+/,'r')" />

windows runtime - Winrt Phone 8.1 Application share task functionality on Page works only once -

i have page in application share simple text, not working properly. steps produce functionality. go page click share shows application can share. tap button => click again on share button. this not open share screen time. pasting code below: protected override void onnavigatedfrom(navigationeventargs e) { _datatransfermanager.datarequested -= ondatarequested; this.navigationhelper.onnavigatedfrom(e); } protected override void onnavigatedto(navigationeventargs e) { _datatransfermanager = datatransfermanager.getforcurrentview(); _datatransfermanager.datarequested += ondatarequested; this.navigationhelper.onnavigatedto(e); } private void ondatarequested(datatransfermanager sender, datarequestedeventargs e) { e.request.data.properties.title = obj.title; htmldocument doc = new htmldocument(); doc.loadhtml(obj.description); string html = ""; foreach

transpose - Different luminance of Python imshow with transposed data -

Image
this might trivial question. i store series of spectrum 1025 frequency bins list, using want plot imshow . data list having 345 entries representing number of time frames, each of has 1025 dimensions representing frequency bins. normal or conventional way display spectrogram having x-axis time frame , y-axis frequency bin. my attempts follows: imshow(x, aspect='auto');show() imshow(np.array(x), aspect='auto');show() # seems same first one. # correct display x-axis time , y-axis frequency bin, # , y-axis should ordered lower upper. imshow(np.array(x).t, aspect='auto', origin='lower');show() however, third plot seems have dimmer luminance , issue of normalization. how imshow behave differently transposed data? edit: trying specify figure size @ first place plt.figure(figsize=(7,5)) imshow(np.array(x).t, aspect='auto', origin='lower') though figure size alters luminance of image, relative magnitude of each comp

c++ - end to end delay in Veins -

i want calculate end-to-end delay in veins example scenario. i have read old mails related topic don't provide real solution problem. i used getcreationtime() , simtime() functions. resulting delay 1.70*10^-4 . this delay doesn't make sense me. supposed more. need @ point. take creation time of macpkt using mackpkt->creationtime() function , extract simtime() calculating end-to-end delay. however, doesn't make sense. i guess macpkt not packet created transmitter. need creation time of packet @ transmitter side. can me? calculating end end delay problem of many users. hope question many users. you can use ‘timestamp‘ field of ‘waveshortmessage‘ store creation time, use field @ receiver calculate delay. if use own messages, add field of own.

c# - How to get Authorization code in Bing Ads Api for long term authentication -

how authorization code long term authentication. using bing ads api v 9.0. here code. string urlstring = "https://login.live.com/oauth20_authorize.srf?client_id=" + clientid + "&scope=bingads.manage&response_type=code&redirect_uri=" + "https://login.live.com/oauth20_desktop.srf"; var realuri = new uri(urlstring,urikind.absolute); var addy = realuri.absoluteuri.substring(0, realuri.absoluteuri.length - realuri.query.length); var myclient = webrequest.create(addy) httpwebrequest; myclient.method = webrequestmethods.http.post; myclient.headers[httprequestheader.acceptlanguage]="en-us"; myclient.contenttype = "application/x-www-form-urlencoded"; using (var writer = new streamwriter(myclient.getrequeststream())) { writer.write(realuri.query.substring(1)); } var response = (httpwebrespons

ios - Amazon SNS For Apple - Error loading apple credentials from file -

Image
i'm trying create sns application ios. after uploading .p12 file , entering password clicked on "load credentials file" button, following error message: "error loading apple credentials file" please, know what's going on? what's problem? you have exported wrong p12 file. open keychain access, click "certificates" @ left panel, click arrow @ left hand side of certificate, there's private key below. need export key. attached screenshot better illustrate this.

ios - How to increase performance in swift 2.0? -

hi im new swift , game random generated square fall down @ random speed, im having trouble function (this function executed when user touch square): let font = uifont(name: "avenir next medium", size: 16) let bgmusicurl:nsurl = nsbundle.mainbundle().urlforresource("destroy-square", withextension: "mp3")! override func didmovetoview(view: skview) { { try squaredestroyedsound = avaudioplayer(contentsofurl: bgmusicurl, filetypehint: nil) } catch _{ return print("no sound file") } squaredestroyedsound.preparetoplay() } func squareexploded (pos: cgpoint, nodecolor: string, points: string) { let mylabel = sklabelnode(fontnamed: font?.fontname) let emitternode = skemitternode(filenamed: "explodedwhitesquare.sks") mylabel.fontsize = 20 mylabel.text = points mylabel.position = pos actionmovepoint = skaction.movetoy(pos.y + 200, duration: 0.8) self

excel - Is there a way to seek documentation for VBA, that is not for VB.NET? -

i'm using vba in excel , , using almighty google find functions, classes, methods browsing html, string manipulation etc. question possibly general future usage. usually find microsoft documentation pages. figure out way use them, not. example found function "filter" ( https://msdn.microsoft.com/en-us/library/fat7fw0s(v=vs.90).aspx ) string manipulation seems vb, not vb.net have trouble running example code. "variable not defined" error "comparemethod" constant. i specific situation suspect may need add references code in order compilator recognize symbols. as different example: used function split ( https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.strings.split.aspx ), seems vb.net, seems work intended in vba code. my question : can please not explain me happening here, more importantly stir in right direction showing, can find vb functions , classes documented , references explained in way, allows me add them in excel vba c

php - Form validation is not working in codeigniter -

i working codeigniter. have created 1 function add university form. function add_uni_admin() { $user_id = $this->session->userdata("user_id"); if (!empty($user_id)) { $uni_name = $this->input->post("uni_name"); $uni_image = $this->input->post("uni_image"); $uni_email = $this->input->post("uni_email"); $phn_no = $this->input->post("phn_no"); $m_no = $this->input->post("m_no"); $address = $this->input->post("address"); $password = $this->input->post("pass"); $this->form_validation->set_rules('uni_name', 'university name', 'required'); $this->form_validation->set_rules('uni_email', 'email', 'required|valid_email'); $this->form_validation->