Posts

Showing posts from June, 2012

android - Text View on click listener -

i have 3 text view on page , each of them has on click method. when click on each of them,text view3 called. wrong? <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context="com.card.admin.nfcapp.readcertificateactivity" android:id="@+id/test"> <textview android:id="@+id/dipcert1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textsize="30dp" android:text="@string/cert1" android:gravity="center&q

php - Can not group by when creating json encode on CodeIgniter -

i'm trying make encode json mysql database , join table codeigniter want combine typing same data 1 group_by error occurred. wrong? error alert expression #1 of select list not in group clause , contains nonaggregated column 'project.mytb1.id' not functionally dependent on columns in group clause; incompatible sql_mode=only_full_group_by my script function get_idcode() { $keyword = $this->uri->segment(3); $data = $this->db->from('mytb1') ->join('mytb2', 'mytb2.id = mytb1.id') ->like('mytb1.id',$keyword) ->group_by('mytb1.id') ->get(); foreach($data->result_array() $row) { $arr['query'] = $keyword; $arr['suggestions'][] = array( 'value' =>$row->id, 'name' =>$row-

android - Cordova app doesn't see file changes until it is restarted, but other programs see them -

i'm modifying image in cordova app file plugin, testing on android 5.0.2. write image file location, read back. changes not visible in image! in es file explorer, can see changed image. , if kill cordova app or re-download it, changes visible. i'm thinking there caching going on, don't know how flush , proceed... or maybe there else going on? here code using write image: function writecurrentfile (thecanvas) { g_currententries[g_entrynum].createwriter ( function createwriterok (filewriter) { // createwriter() success filewriter.onwriteend = function (e) { writelog ("wrote file w/ note: " + g_currententries[g_entrynum].name); }; filewriter.onerror = function (e) { writelog ("error writing file w/ note: " + g_currententries[g_entrynum].name + ": " + e); }; thecanvas.toblob (function (blob) { filewriter.write (blob); }, "

time - PHP - Convert seconds to Hour:Minute:Second -

i need convert seconds hour:minute:second . for example: 685 converted 00:11:25 how can achieve this? you can use gmdate() function: echo gmdate("h:i:s", 685);

gridview - Android OnClickListener does not get fired when clicked on first image in the grid -

i have fragment has grid view displaying upto 5 images. onclicklistener not fired first image in grid works when clicked on other images in grid. public view getview(int position, view convertview, viewgroup parent) { imageview imageview; if (convertview == null) { imageview = new imageview(_activity); } else { imageview = (imageview) convertview; } string imageurls = _filepaths.get(position).tostring(); picasso.with(this._activity).load(imageurls).placeholder(r.mipmap.ic_launcher).into(imageview); imageview.setscaletype(imageview.scaletype.center_crop); imageview.setlayoutparams(new gridview.layoutparams(imagewidth, imagewidth)); imageview.setonclicklistener(new onimageclicklistener(position)); return imageview; } class onimageclicklistener implements onclicklistener { int _postion; // constructor public onimageclicklistener(int position) { this._postion = position; } @overrid

ajax - How to Redirect POST Request to another Route in Nodejs -

i have nodejs server application provides api client-side application. previously, app send ajax request contains action parameter in request object, req.body.action, main route (i mean '/') proceed action base on parameter. however, need change/redirect route of ajax post request main route, '/', action specific route, '/{action route}'. n.b.: want allow backward compatibility every user hasn't updated client side app take change in consideration. i.e, can't modify ajax request code users. i have tried code below not work. app.use(bodyparser.json() ); app.post('/', function(req, res){ if( (req.body.action) && (req.body.action === 'action-1')){ res.redirect(307, '/action-1'); } if( (req.body.action) && (req.body.action === 'action-2')){ res.redirect(307, '/action-2'); } }); app.post("/action-1", function (req, res) { //would have procee

javascript - IE 11 browser not storing form data. I need to store page_is_dirty flag for page visited. My code is working fine in chrome only -

i need detect page dirty flag in application. i used: <form name="ignore_me"> <input type="text" value="0" id='page_is_dirty' name='txt' style="display: none" /> </form> to set flag in html: <script> var dirty_bit = document.getelementbyid('page_is_dirty'); if (dirty_bit.value == '1') { //some 1 went other site , came using button alert('on button , dirty page.'); callwicket(); } //first time page load mark dirty function mark_page_dirty() { dirty_bit.value = '1'; alert('in 3 dirty_bit = ' +dirty_bit.value); }; mark_page_dirty(); alert('in 4 dirty_bit = ' +dirty_bit.value); </script> this keep value 1 when again visited same page clicking button if user click on url other application url , press button come again in application. but kept value 1 in chrome. in ie

Printing integers from command line arguments in C -

i'm running program command line arguments. when enter 10, 10, 10 , print them out, prints out 49, 49, 49. here's code: int main(int argc, char *argv[]) { int seed = *argv[0]; int arraysize = *argv[1]; int maxsize = *argv[2]; why happening?? well, argv array of pointer strings. command line arguments passed strings , pointer each of them held argv[n] , sequence argument n+1 . for hosted environment, quoting c11 , chapter §5.1.2.2.1 if value of argc greater zero, string pointed argv[0] represents program name ; argv[0][0] shall null character if program name not available host environment. if value of argc greater one, strings pointed argv[1] through argv[argc-1] represent program parameters. so, clearly, execution like ./123 10 10 10 //123 binary name argv[0] not first "command line argument passed program". it's argv[1] . *argv[1] not return int value passed command-line argument. basically,

html - Remove borders between div -

i have following html page - <body> <div class="blue" ></div> <div style="padding-bottom: 0; margin-bottom: 0; display: inline-block" > <div class="yellow" style="border-right: none" ></div> <div class="red"></div> <div class="yellow"></div> </div> <div class="green"></div> </body> the css - .blue{ background-color: blue; width: 800; height: 100 } .yellow{ background-color: yellow; width: 150; height: 400; display:inline-block; border-right: 0; border-bottom: none; } .red{ background-color: red ; width: 500; height: 400; display: inline-block; padding: 0; border: none; } .green{ background-color: green; width: 800; height: 100; border-bottom:2px solid black; margin-top: 0; padding: 0; border-top: none; } how can remove borders between ye

performance - Named pipe faster than normal pipe in bash? -

i'm writing bash script in i'm using lot of named pipes. thought might create bit of overhead compared using pipes directly, decided i'm okay that, wanted stats find out how i'm dealing with. therefore ran these 2 commands 50 times each, writing down times average: time seq 1000000 | sort | head; time seq 1000000 | cat >a | cat | sort | head; #a created mkfifo this not actual way i'll using named pipes to write down times, used command: for in `seq 50`; { time seq 1000000 | sort | head; } 2>&1 | grep real | cut -c8-12 >> normal_pipe; done to astonishment, discovered these results: normal pipe: average: 1.712 sec stddev: 0.0157 sec unnamed pipe: average: 1.644 sec stddev: 0.0339 sec my questions now: why named pipe faster? is benchmarking setup flawed? or difference due other processes running in background? i'm guessing that, since sort can start working once has input (right?), how pipe spits out eof...

presentationml - Identify master shapes that were changed -

i'd identify shapes in "slidemaster1.xml" changed, i.e. text differs default. chance can that? looking @ following example can't see attribute marks element changed: <p:sp> <p:nvsppr> <p:cnvpr id="2" name="title placeholder 1"/> <p:cnvsppr> <a:splocks nogrp="1"/> </p:cnvsppr> <p:nvpr> <p:ph type="title"/> </p:nvpr> </p:nvsppr> <p:sppr> <a:xfrm> <a:off x="845127" y="365760"/> <a:ext cx="10515600" cy="1325562"/> </a:xfrm> <a:prstgeom prst="rect"> <a:avlst/> </a:prstgeom> </p:sppr> <p:txbody> <a:bodypr vert="horz" lins="91440" tins="45720" rins="91440" bins=

How to perform testing of a chat/socket.io feature in an Android emulator? -

so i'm new android development , i'm wondering if it's possible test "chat" feature (socket.io) of app in emulator or have build 2 apk , install in 2 devices? p.s i'm coming web app development wherein open 2 new window tabs test socket.io signaling between 2 users :p thanks advice. solved. click run icon press shift key select 2 or more devices. source: https://stackoverflow.com/a/33410957/2098493

python - Creating a matrix CSV file with numpy -

relatively new python here. so have csv file contents this: dsa dds fsdf dasdsa 1 1 32.2 9 4 1 2 53.2 8 2 1 3 44.2 0 1 1 4 12.3 3 2 1 5 15.6 4 3 2 1 12.3 3 2 2 2 91.3 4 11 2 3 32.3 5 33 2 4 44.2 3 2 2 5 55.2 4 1 3 1 60.2 4 2 3 2 80.2 1 15 3 3 10.2 4 1 3 4 99.2 8 3 3 5 13.1 10 2 4 1 32.3 19 2 4 2 10.3 12 3 4 3 52.3 22 4 . . . . . . . . . . i want output this: 1 2 3 4 . . . 1 32.2 53.2 44.2 12.3 . . 2 12.3 91.3 32.3 44.2 . . 3 60.2 80.2 10.2 99.2 . . 4 32.3 10.3 52.3 . . . . . . . . . . . . . . . . . as can see, i'm using first 3 columns of csv file , skipped first row (rubbish data). i'd use numpy this, thought code trick: from scipy.sparse import coo_matrix import numpy np l, c, v = np.load('test.csv', skiprows=1, delimiter=',').t[:3,:] m = coo_matrix((v, (l-1, c-1)), shape=(l.max(), c.max())) print(m.toarray()) this works, first 2 col

drools - Getting the latest event satisfying a condition -

is there way can latest event satisfies predicate ? for example, if write rule: rule 1: when myobject: myobject(id == "id1" && name == "name1" && type == "type1") myobject.dosomething(); i want rule fired if myobject object inserted id "id1" has given name , type. note @ time, there multiple myobject 's id. in essence, want this: rule 1: when myobject: (get latest myobject id == "id1") , ( myobject.name == "name1" && myobject.type == "type1") ) myobject.dosomething(); i using drools 6.2.0. assuming have events, requires declare myobject @role( event ) end you can write rule: rule "latest id1-name1-type1" when myobj: myobject( id == "id1", name == "name1", type == "type1" ) not myobject( after myobj, id == "id1" ) myobj.dosomething(); end

javascript - Regex to wrap all words in span, excluding img elements -

i trying find regex, in order wrap words of text in spans. using following code: $this.html($this.text().replace( /([^\s]*\s)/g, "<span>$1</span>")); where referred div element. however, img , elements, inside div, disappear. tried change regex into: $this.html($this.text().replace( /([^(\s | <a.*/a> | <img.*/img>)]*\s)/g, "<span>$1</span>")); but didn't fix problem. can me? replace non-whitespace ( \s ) there 1 or more ( + ) function, taking match parameter. var str = 'hello dear world <img src="https://placeholdit.imgix.net/~text?txtsize=60&txt=1&w=100&h=100"/> hello dear world <img src="https://placeholdit.imgix.net/~text?txtsize=60&txt=1&w=100&h=100"/>'; function replacethings(str) { var pre = "<span style='background-color:yellow'>"; var modstring = str .replace(/\s+/ig, funct

c# - Nsubstitute: Mocking an object Parameter for Unit Testing -

i new nsubstitute , unit testing. know in unit testing, don't care other dependencies. in order rule applied mock units. i have example tested code method has object parameter: class dependency { public int a; public dependency() { // algorithms going on ... = algorithm_output; } } class totest { public int xa; public void foo(dependency dep_input){ xa = dep_input.a; // xa used in algorithm ... } } i thinking of mocking constructor not figure out how in nsubstitute. ultimately, how test this? i can not add comment because long, add answer: if want test foo not need mock ctor dep_input . example if use moq . can use stub public interface idependency { int { get; } } public class dependency : idependency { public int { get; private set; } public dependency() { // algorithms going on ... = algorithm_output(); } private static int algorithm_output() { return 42; } } public cla

c# - Event not firing for dynamically created Label -

i have windows form labels , created common click event handler labels. event bound code. need create more labels in run-time , bind same event handler dynamically created labels. tried following didn't work. private void ctrl_click(object sender, eventargs e) { control control = (control)sender; if (control label) { label lbl = (label)sender; txtcaption.text = lbl.text; cbofont.text = lbl.font.fontfamily.name; txtsize.text = lbl.font.size.tostring(); chkbold.checked = lbl.font.bold; txtx.text = lbl.location.x.tostring(); txty.text = lbl.location.y.tostring(); txtwidth.text = lbl.width.tostring(); gblogo.visible = false; gbcontrol.visible = true; gbdetail.visible = false; } } private void btnadddynamic_click(object sender, eventargs e) { label label = new label(); int count = pl.controls.oftype<label>().tolist().count; label.location = new point(50, (25 *

html - Magento site wider on chrome mobile browser than on chrome desktop browser -due to floating right div?- genius needed -

i have site has tiny sidebar social icons on right side of page. on desktop version these social icons placed on right side in chrome should be: live version http:// ont.999games.nl/ the-unusual-suspects.html chrome desktop version on mobile browser these social icons not visible unless slide page left: chrome mobile browser i have tried range of css , metatag tricks none have resulted in page wide browser social icons visible on right side. set container divs position:relative, set content divs position:fixed. tried adding metatag viewport, , versions thereof. didn't work. is there magician know why happening , more importantly how fix it? i can't replicate issue in either chrome desktop reduced mobile width, or on mobile. it's looking ok me on both.

Python: Delete Singleton Object Instance running Flask Application -

i have application global errorhandler object. object has metaclass singleton. here singleton: #!/usr/bin/python class singleton(type): def __init__(cls,name,bases,dic): super(singleton,cls).__init__(name,bases,dic) cls.instance=none def __call__(cls,*args,**kw): if cls.instance none: cls.instance=super(singleton,cls).__call__(*args,**kw) return cls.instance here errorhandler: #!/usr/bin/python # -*- encoding: utf-8 -*- singleton import singleton class errorhandler(object): __metaclass__ = singleton _errors = [] def __init__(self): self._jobid = "" def seterror(self , message ): self._errors.append( message ) def geterrors( self ): return self._errors def geterrorcount(self): return len(self._errors) def setjobid( self, jobid ): self._jobid = jobid def getjobid( self ): return self._jobid @classmethod def clear_instance(cls): del cls.instance

android - how to load image from sdcard into pager adapter? -

i new android development, want load image either internal storage/pictures/forldername or sdcard/pictures/foldername swipe feature galley. images should displayed swipes. can havae example of what. thanks in advance use glide fast , efficient image loading. string path =environment.getexternalstoragedirectory()+"/foder_name/locationtoyourimage.png"; glide.with(mainactivity.this) .load(path) .centercrop() .crossfade() .into(myimageview);

java - HTTP 500 code during JSON file upload -

i getting server error code 500 while trying upload json file server.the problem occurs because of parameters. when use plain json string, without multipart builder, works. code use below many in advance public void uploadsegmentcustomerlist(file jsonfile, string segmentid) throws ioexception { if(this.apiclient.gettoken() == null){ apiclient.login(); } multipartentitybuilder builder = multipartentitybuilder.create(); builder.setmode(httpmultipartmode.browser_compatible); httppost uploadpost = new httppost(restconfig.getbaseurl() + restconfig.getuploadurl().replace("@segmentid@",segmentid)); uploadpost.setheader("sessiontoken", this.apiclient.gettoken()); // attaches file post: file f = jsonfile; builder.addbinarybody("test" , new fileinputstream(f), contenttype.application_json,f.getname() ); httpentity multipart = builder.build(); uploadpost.setentity(multipart); httpres

asp.net - Consume PHP web service in VB.net / ASP application -

i created web service using nusoap in php/apache. service requires client certificate , additional soap header username , password element authentication. i having trouble on consuming service .net application. idea or references on how send request supplying client certificate , adding soap header web service reference? (note: soap header not yet included here, trying if can connect service.) dim svc useraccountservices.useraccountservice = new useraccountservices.useraccountservice dim cert system.security.cryptography.x509certificates.x509certificate = system.security.cryptography.x509certificates.x509certificate.createfromcertfile("d:\client.pem") dim certpath = "d:\client.pem" dim rawdata byte() = readcertfile(certpath) cert.import(rawdata, "password", x509keystorageflags.machinekeyset) svc.clientcertificates.add(cert) dim result result = svc.useraccountservicegetuserdetails("testuser") encounter

javascript - How to loop through an array containing objects and access their properties -

i want cycle through objects contained in array , change properties of each one. if this: for (var j = 0; j < myarray.length; j++){ console.log(myarray[j]); } the console should bring every object in array, right? in fact displays first object. if console log array outside of loop, objects appear there's more in there. anyway, here's next problem. how access, example object1.x in array, using loop? for (var j = 0; j < myarray.length; j++){ console.log(myarray[j.x]); } this returns "undefined." again console log outside loop tells me objects have values "x". how access these properties in loop? i recommended elsewhere use separate arrays each of properties, want make sure i've exhausted avenue first. thank you! use foreach built in array function yourarray.foreach( function (arrayitem) { var x = arrayitem.prop1 + 2; alert(x); });

javascript - depName is not defined -

it tells me depname undefined.i trying iterate,just can see whats wrong it.i trying profitable department out of array. var salesdata = [ {department : 'hardware', sales : 4500, day : 'monday'}, {department : 'outdoor', sales : 1500, day : 'monday'}, {department : 'carpentry', sales : 5500, day : 'monday'}, {department : 'hardware', sales : 7500, day : 'tuesday'}, {department : 'outdoor', sales : 2505, day : 'tuesday'}, {department : 'carpentry', sales : 1540, day : 'tuesday'}, {department : 'hardware', sales : 1500, day : 'wednesday'}, {department : 'outdoor', sales : 8507, day : 'wednesday'}, {department : 'carpentry', sales : 8009, day : 'wednesday'}, {department : 'hardware', sales : 12000, day : 'thursday'}, {department : 'outdoor', sales : 18007, day : 'thursday'}, {department : 'carpentry', s

swift3 - GMSServicesException', reason: 'Google Maps SDK for iOS must be initialized via -

terminating app due uncaught exception 'gmsservicesexception', reason: 'google maps sdk ios must initialized via [gmsservices provideapikey:...] prior use' import google map written below import googlemaps get api key create app using following link https://console.developers.google.com/ write below code in didfinishlaunchingwithoptions method of appdelegate gmsservices.provideapikey("your app id") that's it

java - How to use IN clause with Mybatis Annotation inside SQL Provider -

i have seen links pointing solution relevant how use annotations ibatis (mybatis) in query? doesn't provide solution oracle driver. public string getemployees(map<string, object> params){ //value hold params params={empid={123,345,667,888}} stringbuilder sql=new stringbuilder(); sql.append("select * employee emp_id in (#{empid}"); mybatis substitute values params. when value substituted query becomes thing below. select * employee emp_id in ('123,345,667,888'); which invalid query mybatis has added single quotes in query. how should handle issue fix? cannot concatenate values because prevent sql injection. the accepted answer in how use annotations ibatis (mybatis) in query? gives solution working postgres, string representation of list/array passed , converted database. oracle not support this. list must iterared bind every value. in opinion, looking dynamic sql, explained lordofthepigs in next answer. adapted case be: @

Wordpress site doesn't stop loading -

i have big problem. wordpress site doesn't stop loading. blue circle in firefox shows loading , don't know why. loop? way track whats loading there? thanks you. you can have browser dev tools , console, network tab. the page maybe trying external (or internal) assets doesn't exists anymore or unavailable. you can, install plugin query monitor see different details page loaded.

angularjs - How to break pdf content on next page on angular js -

Image
i converted html pdf in angular js using kendo ui. things working fine. want add content on multiple pages. using kendo ui content not aligned messed , content hide between pages. me script - <script> var generatepdf = function() { kendo.drawing.drawdom($("#printplanid"), {papersize: "a4"}).then(function(group) { kendo.drawing.pdf.saveas(group, "converted pdf.pdf"); }); } </script> my content shown like:- what can export html pdf? try code , think more.. reference link : [ http://dojo.telerik.com/uqoqu/4][1] <html> <head> <meta charset="utf-8"/> <title>kendo ui snippet</title> <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.3.1028/styles/kendo.common.min.css"/> <link rel="stylesheet" href="h

java - A resource reference binding could not be found for "xxx" resource reference, -

i trying deploy ear shows error as: injectionproc e cwnen0044e: resource reference binding not found globisdatasource resource reference, defined globis component. [11/10/16 16:20:35:196 ist] 00000027 injectionengi e cwnen0011e: injection engine failed process bindings metadata. [11/10/16 16:20:35:198 ist] 00000027 componentname e cntr0125e: unable process injection information class: []. [11/10/16 16:20:35:235 ist] 00000027 webapp e com.ibm.ws.webcontainer.webapp.webgroupimpl webgroup srve0015e: failure initialize web application globis [11/10/16 16:20:35:237 ist] 00000027 deployedappli w wsvr0206e: module, globisweb.war, of application, globisswati.ear/deployments/globisswati, failed start..

html - How on div hover make other div's image animate -

guys i'm bit stuck, deal that, div need hover on under div image need trigger, have no idea how that, , need css. layout floats left, changing positions hard form me. ideas? here html code <div id="layout"> <div id="zydra"><img src="1blokopav.jpg"></div> <div id="zalia"> </div> <div id="melyna"></div> <div id="geltona"></div> <div id="orandzine"></div> <div style="clear: both;"></div> <div id="ruda"></div> <div id="raudona"></div> <div id="balta"></div> </div> need hover on div has id of melyna trigger div of zydra id image of divs given float left , kind of width , height, it's simple color block layout, love hear guys suggestions , if there no way, how move div contains image bottom won't change

html - Why webkit-line-clamp property doesn't work on Gmail Browser Email Client (in Chrome)? -

Image
i have template email should display text in div. text should truncated on third line, in image bellow: i use following css acheive effect. <div style="overflow: hidden;display: -webkit-box;-webkit-line-clamp: 3;-webkit-box-orient: vertical;border: 1px solid red;width:200px;min-width:200px;min-height: 45px;height: 45px;max-height: 45px;font-size:14px;line-height:16px"> many times i've had design responsive websites targeting specific devices css media queries, , not base break points site's content. because of this, i've ended large list of css media queries typical devices on past year or two. </div> this html works if open email in ios mail client, doesn't work gmail browser client (in chrome browser). is there way make webkit-line-clamp property works in gmail? thanks!

Convert java List to object using collection -Stream -

from method list> method() output 3 elements [123456, 10, 03-jan-16] [956233, 20, 03-jan-16] [254656, 30, 03-jan-16] [455556, 40, 04-jan-16] [548566, 50, 03-jan-16] [215663, 60, 03-jan-16] i need store above result in pojo class name 'classname' has following columns col1, col2 , col3, try run following code public void method() { try { list<list<string>> list = testdao.methodname(); list<classname> classname= new arraylist<classname>(); (iterator<list<string>> iterator = list.iterator(); iterator.hasnext();) { list<string> list2 = (list<string>) iterator.next(); int = 0; classname classname= new classname (); (iterator<string> iterator2 = list2.iterator(); iterator2.hasnext();) { string string = (string) iterator2.next(); /* system.out.println(string); */ if (i == 0) cl

sql - Concurency between 2 where() clause with rails? -

i have in seed.rb : c1 = chapter.where(number: 1).first_or_create a1 = article.where(number: 1, text: 'foo bar' chapter: c1).first_or_create a2 = article.where(number: 2, text: 'foo bar baz', chapter: c1).first_or_create and in article class : class article belongs_to :chapter before_create self.foo = true if article.where(chapter_id: chapter_id).count == 0 # tried version too, same problem : self.foo = true if chapter.articles.count == 0 end end the query excepted count : select count(*) articles `articles`.`chapter_id` = 1 but, sql log, have : for first article : select count(*) articles `articles`.`number` = 1 , `articles`.`text` = "foo bar" , `articles`.`chapter_id` = 1 , (`articles`.`chapter_id` = 1) and second article : select count(*) articles `articles`.`number` = 2 , `articles`.`text` = "foo bar baz" , `articles`.`chapter_id` = 1 , (`articles`.`chapter_id` = 1) my problem before_create is call bef

oauth 2.0 - Exchange authorization_code for access_token and id_token not working using Auth0 -

i using auth0 sms passwordless login , can login correctly , redirected correctly specified callback url: http://localhost:8000/authenticated?code=authorization_code . have been following this tutorial when step 4 , 5 exchange authorization_code access_token , id_token getting error message back: {"error":"access_denied","error_description":"unauthorized"} . this how sending code auth0 server through post: var code = request.query.code; var url = `https://${process.env.auth0_client_domain}/oauth/token?client_id=${process.env.auth0_client_id}&redirect_uri=http://localhost:8000/authenticated&client_secret=${process.env.auth0_client_secret}&code=${code}&grant_type=authorization_code`; wreck.post(url, (err, res, payload) => { console.log(payload.tostring()); }); is there missing querystring? or need before sending post request? my question answered in issue on auth0 repo: https://github.com/auth0/auth0.js/iss

process - Memory Addresses: Linker Vs. Loader -

i trying understand how memory allocation works @ different stages of compilation , loading of program. 1) compilers , assemblers generate code , data sections start @ address 0. 2) linker relocates these sections associating memory location each symbol definition, , modifying of references symbols point memory location. 3) loader loads program main memory, in context of process, and hence @ step paging , memory management related operations done. my question 2 things: 1)how addresses assigned linker related ones assigned loader. can call linker addresses virtual addresses? 2)do programs have same virtual addresses(that mapped different physical addresses?) generally compilers generate relocatable code not start @ particular address. there cases no entirely possible. e.g. int x ; int *y = &x ; these need special handling. the linker merges program sections referenced compiler. output of linked program directs loader how place program in memory.

mysql - Python AWS Lambda spins new connection to RDS for each deployment -

i have python based lambda function, connects mysql(rds) database. every time deploy lambda code , run function, new connection created. how can reuse same connection or flush old connections before creating new one? close connection inside lambda function. expected , normal behaviour of lambda.

python - Tkinter or Pygame which should I use -

i'm start programming game computing level. game version of scrabble won't have board. how many words can make in amount of time. game have menus, buttons , logins different users access game. i'm wanting know if better use tkinter or pygame or if can use aspects of both: eg tkinter menus , pygame main loop. appreciated i'm quite new both these ideas please explain specialist terminology. lot so, expanding issue: love pygame, in offers simple api 1 draw things on screen-canvas, , nice o.o. hierarchy , tooling sprites , game objects on screen. on other hand, did not evolve have nice installer python3 - in platforms near impossible working in python3 (despite pygame code being python3 ready). it not offer support menus, or buttons, or text-entry - have either use third party module that, or create allby hand yourself. yu have implement things reading keyboard code, drawing corresponding glyph on correct location on canvas - , keyboard reading raw, , won&

cross domain - Single Sign On (SSO) using JWT -

Image
i have read several articles sso not find answer in mind. have scenario below: scenario: my company wants have sso mechanism using jwt. company has 2 different domains abc.com abc , xyz.com xyz . also there masterdomain manages clients authentication. user x wants log in abc @ first. abc sends credentials masterdomain , masterdomain authenticates user create signed jwt in order send abc . abc keeps jwt in cookie. after while if login abc attempted @ same computer, system not ask credentials , automatically login user. question: if user tries open page in xyz domain, how system understand user loggedin before? mean xyz domain cannot reach cookie of abc has jwt. information should sent xyz indicates user x trying login? thanks in advance you can store jwt authentication token in cookie / localstorage of intermediate domain connected home page using iframe scenario abc sends credentials masterdomain , masterdomain authenticates

javascript - webpack-dev-server --inline recompiles and reloads page but no changes shown -

i'm having issues getting webpack's live reloading working. believe have setup correctly. problem when saving files browser refreshes no changes displayed. i run webpack development server following command: webpack-dev-server --inline and start php development server command: php -s localhost:8000 -t public/ in public/index.php file include webpack-dev-server.js file: <script src="http://localhost:8080/webpack-dev-server.js"></script> when make changes entry.js , hit save can see files recompiling , browser refreshes. except no changes made. i following output @ terminal when saving entry.js : time: 44ms asset size chunks chunk names app.js 240 kb 0 [emitted] main app.css 42.4 kb 0 [emitted] main chunk {0} app.js, app.css (main) 222 kb [rendered] [75] ./src/js/entry.js 108 bytes {0} [built] + 77 hidden modules webpack: bundle valid. webpack: bundle invalid. hash: 3937d6fc90a1794a8d

asp.net mvc - Pass a list of objects to MVC action method using AngularJS post -

i have action method given below: [httppost] public actionresult ask(question question) { if (modelstate.isvalid) { tempdata["newquestion"] = question; return redirecttoaction("submit"); } return view(question); } the question class definition given below: public class question { public int id { get; set; } public string title { get; set; } public string body { get; set; } public string userid { get; set; } public list<tag> tags { get; set; } public int votes { get; set; } public list<answer> answers { get; set; } public int views { get; set; } public datetime creationdate { get; set; } } the code have written call above given action method given below: <script> function questioncontroller($scope, $http) { $scope.submit = function () { var data = $.param({

javascript - Css dynamic font-size -

i try make special screen dynamic in angularjs . i screen there object define size: .item { margin: auto; margin-bottom: 10px; width: 11vw; height: 11vw; text-overflow: ellipsis; overflow: hidden; } there items insert ng-repeat loop base on return of api . <div class="item" ng-click="ctrl.clickfunction()" ng-style="{'background-color':ctrl.color }"> <div class="itemglobalcode">{{::ctrl.name}}</div> </div> problem items round , have best render i'd change font size of content (here ctrl.name) if content long fit container. i find jquery solution if it's possible i'd avoid them , if it's possible i'd pure css solution. have idea ? you can put expression on ng-style: ternary <div class="itemglobalcode" ng-style="{'font-size': ctrl.name.length > 10 ? '12px' : '14px'}"></div

How does screen command works in Linux -

if screen in linux, , ssh other machine, run job there, detach screen , disconnect terminal. if open terminal again can go session , job still running. want know how internally screen working? detach literally means. detaches screen process it's parent. means parent (your ssh session) not inform dependent/child process termination. for more info links useful: https://en.wikipedia.org/wiki/nohup https://unix.stackexchange.com/questions/3886/difference-between-nohup-disown-and

android - seekbar thumb onclicklistener -

Image
i need customize default android seekbar control music player. know sounds simple, don't know how set seekbar thumb listener. want control music , change icon accordingly play , pause when user press on seekbar thumb icon. how can achieve this? know possible because saw apps pocketguide functionality implemented. here's screenshot pocketguide app maybe helps you. adjust code needs. public class seekbarwiththumbtouch extends seekbar { private int scaledtouchslop = 0; private float inittouchx = 0; private boolean thumbpressed = false; public seekbarwiththumbtouch(context context) { super(context); init(context); } public seekbarwiththumbtouch(context context, attributeset attrs) { super(context, attrs); init(context); } public seekbarwiththumbtouch(context context, attributeset attrs, int defstyleattr) { super(context, attrs, defstyleattr); init(context); } p

javascript - How to get the length of a json returned data and run a for loop -

this question has answer here: how loop through or enumerate javascript object? 23 answers i have ajax call result in json format $.ajax({ url: link, datatype: "json", success: function(data){ console.log(data); //c.l-1 console.log(data.length); //c.l-2 } }) and here result $users_arr = array(); //after successful query database while($sql = mysqli_fetch_array($query)){ $user_id = $sql['id']; $user_age = $sql['age']; $user_name = $sql['name']; $users_arr[$user_id] = $user_id.','.$user_name.','.$user_age; } echo json_encode($users_arr); now c.l-1 returns true c.l-2 returns undefined. thought data returned array on it's own want run loop each user this for(var = 0; data.length > i; i++){ eachuser = data[i]; userinfo = eachuser.split(',');

reactjs - Redirect after login to the original url in react-router -

hi using erikras' react-redux-universal-hot-example my problem trying visit page lets "/chat" , in doing should redirected "/login" page since needs authentication. once complete authentication should redirected original url "/chat". i trying use onenter hook didn't work. after login redirecting users "/loginsuccess" page default (hard coded) thanks in advance help here's how approach high level... when redirect /login , add current route next route's location state. handle login. when navigating /loginsuccess , check location state route passed, , redirect that. it this... // function passed onenter handle authentication check redirectifnotloggedin(nextstate, replace) { if (notloggedin) { replace({ pathname: '/login', state: { redirectto: nextstate.location.pathname } }) } } // function passed onenter handle loginsucesss redirect redirectafterloggedin(nex

Google sheets eBay API data automation macro -

i using google sheets , ebay search api search particular listings based on keyword , seller type. limitation api return 1 page of results @ time 100 listings worth of data. the api key itself: http://svcs.ebay.com/services/search/findingservice/v1?service-version=1.13.0` &security-appname=xxxxxx-ebaysear-prd-xxxxxxx-xxxxxxx &response-data-format=xml[![1]][1] &global-id=ebay-gb &rest-payload &x-ebay-soa-operation-name=finditemsadvanced&descriptionsearch=true &searchresult.item.sellerinfo.feedbackscore&searchresult.item.storeinfo.storename &itemfilter(0).name=maxdistance&itemfilter(0).name=buyerpostalcode=b11aa &itemfilter(0).value=100 &itemfilter(1).name=feedbackscoremin&itemfilter(1).value=400 &itemfilter(2).name=hideduplicateitems&itemfilter(2).value=true &itemfilter(3).name=locatedin &itemfilter(3).value=gb &itemfilter(4).name=sellerbusinesstype &itemfilter(4).name=ebay-gb &outputselector(0)=sell

javascript - JSP on click working in fireox. Not working in chrome -

Image
hi have click event associated has jsp parameters <a href="javascript:void()"><div class="icn_deactivate" title="deactivate" onclick="deactivate(<%=module.getagreementtype() %>,'n')"> <a href="#abc" onclick='gethtml(<%=module.getagreementtype()%>,"html")'><%=templates.getlegaldoctmplfilename() %></a> but in html page coming this . please help!

Atlassian Git API Diff Commits using Git notation -

i have been able "diff" 2 files using stash git api, however, each time have specify full hashes of commits, so: rest/api/latest/projects/{project}/diff/{path file}?since={hash}&until={hash} what this: rest/api/latest/projects/{project}/diff/{path file}?since=head^^&until=head to resemble: git diff head^^ head {my_file} (so diff between head , previous commits on file.) the way have been able list of historical commits api using following docs: https://stash.atlassian.com/rest/api/1.0/projects/jira/repos/jira/commits which will: "the latest commits jira repository in jira project" not specific file. from have been able find seems though api not support functionality. i have been able solve this, firfox console. ui makes use of history drop down showing last 25 commits file following url: rest/api/latest/projects/{project}/commits?path={path_to_fil‌​e}&until=refs%2fhead‌​s%2fmaster&start=0&l‌​imit=25

iphone - iOS wrong resolution when building to phone -

when i'm building app after submitting build i'm getting wrong resolution when building on iphone 6s coming iphone 4 aspect ratio. ideas be? it used work fine when developing app i hadn't included iphone 6s splash screen, works now

java - How to hide and unhide box from checkbox -

i'm student of android developer. need make project , i've ran problem. problem need make box of checkbox disappear , after pushing specific button, box appear , clickable. searches i've found when write: mycheckbox.setbuttondrawable(new colordrawable(color.transparent)); it disappear , it's couldn't find way make appear after that.. lot. :) you can achieve making view disappear either using mycheckbox.setvisibility(view.gone); (or) mycheckbox.setvisibility(view.invisible); and again can make appear mycheckbox.setvisibility(view.visible); hope helpful:)

java - ApplicationContext with global variable lost after back pressed -

i have little problem global variable declared in global class called controller extend application. when start activity have arraylist 0 items in controller ( it's cart), go on activity b, on click, add item "controller", go (with button) on activity , arraylist still @ 0 items what's wrong ? my controller class : public class controller extends application { public static final int signup_request = 98; // request code public static final int signin_request = 99; private user muser;// instance de l'utilisateur connecté private cart mcart = new cart(); // panier private tracker mtracker; // analytics private session msession; private sessionmodule msessionmodule; @override public void oncreate() { super.oncreate(); } @override protected void attachbasecontext(context base) { super.attachbasecontext(base); multidex.install(this); msessionmodule = new sessionmodule(base);

scala - akka-http queries do not run in parallel -

i new akka-http , have troubles run queries on same route in parallel. i have route may return result (if cached) or not (heavy cpu multithreaded computations). run these queries in parallel, in case short 1 arrives after long 1 heavy computation, not want second call wait first finish. however seems these queries not run in parallel if on same route (run in parallel if on different routes) i can reproduice in basic project: calling server 3 time in parallel (with 3 chrome's tab on http://localhost:8080/test ) causes responses arrive respectively @ 3.0s, 6.0-s , 9.0-s. suppose queries not run in parallel. running on 6 cores (with ht) machine on windows 10 jdk 8. build.sbt name := "akka-http-test" version := "1.0" scalaversion := "2.11.8" librarydependencies += "com.typesafe.akka" %% "akka-http-experimental" % "2.4.11" *akkahttptest.scala** import java.util.concurrent.executors import akka.actor