Posts

Showing posts from April, 2014

java - spring security oauth2 (2.0.8) getting Invalid access token used InMemory tokenstore -

trying implement spring security oauth2 in application. i able access token , refresh token using : http://localhost:8080/xapp/oauth/token?username=user1&password=password&grant_type=password&client_id=xapp&client_secret=xapp { "access_token": "798c7e71-983b-4137-a0cb-ceae4e9b4190" "token_type": "bearer" "refresh_token": "0752b8ff-5086-4457-918d-54376c7a2bec" "expires_in": 299 "scope": "read trust write" } when i'm trying access protected resource using below url http://localhost:8080/xapp/data/product/api/index/?access_token=798c7e71-983b-4137-a0cb-ceae4e9b4190 i getting: { "error": "invalid_token" "error_description": "invalid access token: db48214c-04d7-4d6b-aa34-6d16c9c2a438" } applicationcontext-security.xml : <?xml version="1.0" encoding="utf-8"?> ...

java - android multiple upload image error -

Image
i got error when tried upload of images. use "for" loop process, still got error in looping. if don't use for, still can upload image 1 image uploaded. how can solve this? uploadactivity.java intent intent = getintent(); filepath = intent.getstringextra("filepath"); arraylist<string> flpath = new arraylist<string>(); sharedpreferences prefs = getsharedpreferences("savedfilepathsjsonarray", context.mode_private); string myjsonarraystring = prefs.getstring("savedfilepathsjsonarray", ""); if (!myjsonarraystring.isempty()) { jsonarray jsonarray = null; try { jsonarray = new jsonarray(myjsonarraystring); } catch (jsonexception e) { // todo auto-generated catch block e.printstacktrace(); } (int = 0; < jsonarray.length(); i++) { try { flpath.add(jsonarray.get(i).tostrin...

How to disable 'Download Complete' notification using selenium Webdriver -

i using selenium automate functionality on webpage. downloading files using selenium. download completes, can see pop notification on web page download complete. enter image description here kindly suggest using selenium, can remove pop notification? i setting following firefox profile: firefoxprofile firefoxprofile = new firefoxprofile(); firefoxprofile.setpreference("browser.download.folderlist", 2); firefoxprofile.setpreference("browser.download.manager.showwhenstarting", false); firefoxprofile.setpreference("browser.download.manager.usewindow", false); firefoxprofile.setpreference("browser.download.manager.showalertoncomplete", false); firefoxprofile.setpreference("browser.download.manager.closewhendone", true); firefoxprofile.setpreference("browser.download.dir", downlodelocation); firefoxprofile.setpreference("browser.helperapps.neverask.openfile", "application...

pointers - wrong address value being passed to function in C -

this similar incorrect pointer value passed c function there doesn't appear answer. i have struct, called bigint , has fields char sign , size_t len , uint32_t *val . bigint s initialized bigint_init() function allocates memory uint32_t array, sets default values, etc. i have function, void bigint_subtract(bigint a, bigint b, bigint *diff) stores a-b in diff . have tested function previously, follows: bigint test = bigint_inithex("4567890987654345678987654adbfcaedcfaaebfc625213"); bigint test2 = bigint_inithex("acbefabedfc13271723976aebdfcabefc12837618237"); bigint diff = bigint_init(); bigint_subtract(test,test2,&diff); printf("0x%s - 0x%s == 0x%s\n\n",bigint_tohex(test), bigint_tohex(test2),bigint_tohex(diff)); among numerous other tests edge cases, varying lengths, etc. tests check out. now, in function, void bigint_egcd(bigint a, bigint b, bigint c, bigint *x, bigint *y); it's extended euclidean algorithm. in main loop ...

angularjs html5 mode pretty url not working -

i doing angularjs application generated web storm. tried use html5 model pretty url (without # on url).it not working.the url # working fine. here workouts app.js var app = angular.module('myapp', [ 'ngroute', 'ngcookies', 'myapp.login', 'myapp.services', 'myapp.authenticationservice', 'headroom', 'angular-loading-bar', 'angularsoundmanager', 'updatemeta' ]). config(['$routeprovider','$locationprovider', function ($routeprovider,$locationprovider) { $routeprovider.when('/login', {templateurl: 'user/login.html', controller: 'loginctrl'}); $routeprovider.when('/view2', {templateurl: 'partials/partial2.html', controller: 'myctrl2'}); $routeprovider.otherwise({redirectto: '/login'}); // configure html5 links working on node-webkit if(window.history &...

Java String internal representation -

i understand internal representation of java string utf-16. java string representation? also, know in utf-16 string, each 'character' encoded 1 or 2 16-bit code units. however, when debug following java code string hello = "hello"; the variable hello array of 5 bytes 0x48, 0x101, 0x108, 0x108, 0x111 ascii "hello". how can be? i took gcore dump of mini java process code: class hi { public static void main(string args[]) { string hello = "hello"; try { thread.sleep(60_000); } catch (interruptedexception e) { e.printstacktrace(); } } } and did gcore memory dump on ubuntu. (usign jps pid , passed gcore) if found this: 48 65 6c 6c 6f in dump using hexeditor, somewhere in memory ascii. but 48 00 65 00 6c 00 6c part of utf-16 representation of string

c# - Treeview IsExpanded not fires up -

i trying add treeview ability catch isexpanded event. when item expand raise property or command on view model. here code: <treeview name="scenariostreeview" itemssource="{binding path=cat, mode=twoway}" focusable="true" > <treeview.inputbindings> <keybinding key="delete" command="{binding deletecommand}" commandparameter="{binding selectedvalue ,elementname=scenariostreeview}" /> </treeview.inputbindings> <treeview.itemcontainerstyle> <style targettype="{x:type treeviewitem}"> <setter property="isexpanded" value="{binding isextended, mode=twoway}" /> <setter property="isselected" value="{binding isselected, mode=twoway}"/> </style> </treeview.itemcontainerstyle> <treeview.resources> <hierarchicaldatatemplate datatype="...

php - Search value in same array and replace it -

i have array array ( [0] => array ( [id] => 15 [parent] => # [text] => shb2-1 ) [1] => array ( [id] => 17 [parent] => 16 [text] => shb2-3 ) [2] => array ( [id] => 18 [parent] => 17 [text] => shb2-4 ) ) i search if [parent] value exist in same array [id] if not exist exists, [parent] value replaced 0. example: check if value 16 exists in whole array [id] (in example available [id] 15, 17 , 18). if not exist, 16 replaced 0. check next array key, , until un output final replaced values. thank help. if wanted change parent 0 if not equal id , think simple code it: foreach ($array $key => $val) { // search if 'id' exists in array $a_key = array_search($val['parent'], array_column($array, 'id')); // check if 'id'...

java - Use mock object in test method implementation -

i have question. there's method implementation using objects. i'd test method not using objects invoking. class object1 { public void method1() { object2 object2 = new object2(); string info = object2.getinfo(); // ... // working info, want test // ... } } class object1test { @test public void testmethod1() { object1 object1 = new object1(); object1.method(); // want run method without invoking object2 } } could me understand how in junit while testing method1() can mock using of object2 object2mock? you need make changes class achieve trying do. class object1 { private object2 object2 = new object2(); /* setter method object2 */ public void setobject2(object2 object2) { this.object2 = object2; } public void method1() { string info = object2.getinfo(); // ... // working info, want test // ... } } now have call set...

How to convert UTF16 (emoji) to HTML Entity (hex) using java -

how convert utf16 (emoji) html entity (hex) using java have string db "\ud83d\ude02". try display unicode emoji, displays ��. search in google convert utf16 html hex code. didnt solution. please me i show unicode emoji smily icon you can use emoji4j library this. for example: string line = "hi , fine \ud83d\ude02 \ud83d\ude02, how r u ?"; emojiutils.hexhtmlify(line); //hi , fine &#x1f602; &#x1f602;, how r u ?

python - dot dashed line touch yaxis min and max in matplotlib -

is there way vertical dot-dashed line in matplotlib touch top , bottom of yaxis? drawing 2 vertical lines, space between them, , want them touch top , bottom of yaxis. touch bottom of yaxis, touch top of yaxis of plot if change starting y-value linestyle pattern happens touch @ top. tried using ax.vlines , got same result. maybe - there way change spacing of dot , dash in linestyle in order this? plt.plot((55843.8747516981, 55843.8747516981), (yminplot, 4.53), linewidth=2, linestyle='-.', color='r') plt.plot((55843.8747516981, 55843.8747516981), (7.03, ymaxplot), linewidth=2, linestyle='-.', color='r') if understand correctly question, can solve changing order of how second line drawn, drawn top bottom plt.plot((55843.8747516981, 55843.8747516981), (yminplot, 4.53), linewidth=2, linestyle='-.', color='r') plt.plot((55843.8747516981, 55843.8747516981), (ymaxplot, 7.03), linewidth=2, li...

cordova - How to use mDNS in AngularJS / ionic? -

i want use cordova plugin use mdns: https://github.com/stevenpack/phonegap-multicastdns but there no example code or guides, , quite new angularjs , ionic. how use plugin? , how can derive plugin code? this i've got far: added plugin: cordova plugin add https://github.com/stevenpack/phonegap-multicastdns.git it went ok , have "plugins/com.koalasafe.cordova.plugin.multicastdns" folder. now guess need include controller , use functions? you can use in angular code following way multicastdnsplugin.query(host, multicastip, port, successcallback, errorcallback) for more create issues on author source directory here , understand flow of customize plugin refer link hopes !

python - What should be the outcome of stemming a word with apostrophe? -

i'm using nltk.stem.porter.porterstemmer in python stems of words. when stem of "women" , "women's" different results respectively: "women" , "women'". purposes need have both words having same stem. in line of thought both words refer same idea/concept , pretty same word suffering transformation should have same stem. why getting 2 different results? correct? it's necessary tokenize text before lemmatizing. without tokenization: >>> nltk import word_tokenize >>> nltk.stem import wordnetlemmatizer >>> wnl = wordnetlemmatizer() >>> [wnl.lemmatize(i) in "the woman's going home".split()] ['the', "woman's", 'going', 'home'] >>> [wnl.lemmatize(i) in "the women's home in london".split()] ['the', "women's", 'home', 'is', 'in', 'london'] with tokeniz...

Trying to retrieve the x-value from a x-coordinate on a d3.js SVG graph -

i'm little stuck on something, , hoping maybe point me in correct direction solution. running searches on google isn't helping me out due wording of searches. what i'm trying 'value' of x-position on graph. on graph, x-axis made of dates. so, if know plotted x co-ordinate point on graph 200 example, i'd date label x-position 200. there lots of tutorials , examples demonstrate how retrieve x-coordinate (200), not x-coordinate value (date object x-position 200). what i'm going build user notes feature allows user select x-position on graph , make note @ point. i'll need store object note containing x , y value of coordinates, , since points on graph mapped , remapped applying date object .x, need date points plot on graph can recorded , re-applied, , moved if user decides move note tool around. anyway, i'm kind of looking way reverse-engineer this... function getdatex(x, data) { var datex = x(data.date); return datex; } ...but ins...

web services - Implementing WS-I Basic Profile in Spring WS -

my project uses spring ws consume soap webservice. webservice calls sent via webservicetemplate.marshalsendandreceive(..) works fine until now. recently webservice publisher had informed implement ws-i basic profile 1.1 in order able responses. following sample received supposedly sent on soap header of request. <wsse:security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <wsse:usernametoken> <wsse:username> </wsse:username> <wsse:password type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#passwordtext"> </wsse:password> </wsse:usernametoken> </wsse:security> is there example configure ? how proceed spring-ws security in scenario? any pointers appreciated. managed find out myself. here approach. declare bean wss4jsecurityinterceptor (this available in spring-ws-security jar) provid...

sql server - BCP using xp_cmdshell to generate outputfile -

i'm using following generate output file xml content stored in image data type: exec master..xp_cmdshell 'bcp "select xml mydatabase.dbo.mytable id = 1 " queryout "c:\temp\exportdir\myfile.xml" -t -s xyz\sqlexpress' but following message: enter file storage type of field xml [image] the file gets generated it's empty?

pebble sdk - pebbleCentral:watchDidConnect never gets called on iOS -

i have old pebble classic watch, upgraded latest firmware (3.8.2) , using latest pebble-sdk. i have followed few simple steps install sdk, setup xcode project , adding code initialise , connect: https://developer.getpebble.com/guides/mobile-apps/ios/ my problem is, delegate method pebblecentral:watchdidconnect never gets called! i using pebble time app on ipad install watchapp in watch, know ipad connected watch. same ipad runs ios app, apparently not discover watch. i have tried import old test project colleague, had running year or 2 ago. same watch, same watchapp, of course older firmware , sdk versions. same result... i think documentation on pebble site quite simple , easy follow. however, feel missing explanations of how , when watchdidconnect supposed triggered. i missing simple step somewhere, quite lost in look! any ideas welcome! edit: code looks this: viewcontroller.h: #import <uikit/uikit.h> @import pebblekit; @interface viewcontroller : uivie...

identityserver3 - How do I model Application specific Roles in Claims -

we have central usermanagerapplication manage users , roles multiple application. in application typically set usera in role admin application1 usera in role reader application2 problem: when application2 request scope (say scopeapp1) includes roles, both reader , admin roles claim returned filtered on claimtypes , not scope. question: how can request subset of roles? we use custom userservice, , understanding place filter out returned claims in method, , cant find way figure out scope client requested: public override task getprofiledataasync(profiledatarequestcontext context) as far can see options are: include applicationname included in role (app1admin, app2reader etc) create new claimtype each application. app1role, app2role i've missed obvious , need better understanding thanks help larsi i pointed read @ https://github.com/identityserver/identityserver3/issues/474 describes problem. in addition adding claims in customuserservice scope...

scala - How can I find where does a method definition rather then declaration in idea IDE? -

in scala, class combine many trait , it's difficult find method definition.does function exist in idea? example: trait { def name: string } class achildren extends { def name = "achildren" } class b(val a: a) { } object main extends app { val binstance = new b(new achildren()) binstance.a.name } when use ctrl/cmd + b on name of binstance.a.name , idea trace a.name .obviously, useful information achildren.name , implements executable code. can point achildren.name ? in intellij idea, move cursor function call , press ctrl+b. should open function definition (unless changed hotkey ofc.)

ios - playerID is deprecated, Objective C -

what replaces player id? - (void)lookupplayers { nslog(@"looking %d players...", match.players.count); [gkplayer loadplayersforidentifiers:match.players withcompletionhandler:^(nsarray *players, nserror *error) { if (error != nil) { nslog(@"error retrieving player info: %@", error.localizeddescription); matchstarted = no; [delegate matchended]; } else { // populate players dict self.playersdict = [nsmutabledictionary dictionarywithcapacity:players.count]; (gkplayer *player in players) { nslog(@"found player: %@", player.alias); [playersdict setobject:player forkey:player.playerid]; } // notify delegate match can begin matchstarted = yes; [delegate matchstarted]; } }]; }

apache pig - Pig script parameters in Hue editor -

Image
im writing pig script in hue pig editor, when executing it, says there eof @ column 3: this happens when use parameters or through %declare or %default , , same scripts work fine using $pig myscript.pig command. use hue 3.7.0. this looks hue-2508 fixed in hue 3.9 .

request error on postgreSQL using postgis (more than one row returned) -

i have column containing 37 000 city of country on postgresql using postgis , i'm trying put point (geometry column) postgis function st_point(long, lat). have different long , lat data. here request : update city set geom_city = (select st_setsrid(st_point(city.city_long, city.city_lat),4326) city); problem i've error msg saying : more 1 row returned subquery used expression postgresql i found out on stackoverflow needed pu "limit 1" @ end of request : update city set geom_city = (select st_setsrid(st_point(city.city_long, city.city_lat),4326) city limit 1); which make request working write in geom_city column same result city. anyone knows ? the nested select subquery not needed, try this: update city set geom_city = st_setsrid(st_point(city_long, city_lat),4326) ;

sqlite - I am unable to install sqlite3 on rails 3.2 Windows -

here error: c:>gem install sqlite3-ruby temporarily enhancing path include devkit... building native extensions. take while... error: error installing sqlite3-ruby: error: failed build gem native extension. c:/ruby200-x64/bin/ruby.exe extconf.rb checking sqlite3.h... * extconf.rb failed * not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=c:/ruby200-x64/bin/ruby --with-sqlite3-dir --without-sqlite3-dir --with-sqlite3-include --without-sqlite3-include=${sqlite3-dir}/include --with-sqlite3-lib --without-sql...

database - How to display data from multiple tables in SQL -

i'm relatively new sql. i'm trying figure out how satisfy condition: display customer_id, customer_last_name, order_id,order_item_id, product_name customer living in virginia. so far, have this, i'm not sure how display values together. appreciated. select customer_id, cust_first_name demo_customers cust_state= 'va' select order_id demo_orders customer_id= '1' you need join select customer_id, cust_first_name, order_id, order_item_id, product_name demo_customers inner join demo_orders on demo_orders.customer_id = demo_customers.customer_id cust_state= 'va'

Is it possible to upgrade SonarQube 5.1.2 to 5.3? -

i interested in improvements sonarqube 5.3 brings. using 5.1.2 currently. 5.3 not lts noticed on website. in test environment noticed upgrade 5.1.2 5.3 fail. message in /opt/sonarqube-5.3/logs/sonar.log show database migration not working. how can fix this? 2016.01.27 09:32:43 info web[o.s.s.d.m.platformdatabasemigration] starting db migration 2016.01.27 09:32:43 info web[dbmigration] == addprojectlinkscomponentuuid: migrating =================================== 2016.01.27 09:32:43 info web[dbmigration] -- columns("project_links") 2016.01.27 09:32:43 info web[dbmigration] -> 0.0100s 2016.01.27 09:32:43 info web[dbmigration] -- add_column("project_links", "component_uuid", :string, {:limit=>50}) 2016.01.27 09:32:43 info web[dbmigration] -> 0.0370s 2016.01.27 09:32:43 info web[dbmigration] -> 0 rows 2016.01.27 09:32:43 info web[dbmigration] == addprojectlinkscomponentuuid: migrated (0.0490s) =======================...

jquery - Secondary Menu Drop Down Styling -

i have responsive menu setup, when @ desktop size secondary drop list hidden until hover on main nav lists. i have added onto fiddle here: https://jsfiddle.net/4ewrrbxb/ secondary menu sit right of main menu, outside main white box. i know simple, cannot seem working. any great lee my html is: <div class="nav-wrap"> <nav id="nav-main"> <ul> <li><a href="index.php">home</a></li> <li><a href="products.php">products</a></li> <ul> <li>product one</li> <li>product two</li> <li>product three</li> </ul> <li><a href="trade-processing.php">trade processing</a></li> </ul> </nav> <div id="nav-trigger"> <span>menu...