Posts

Showing posts from September, 2010

ios - Get only updated data from API -

i'm beginner in swift , i'm building first app fetches data server. working well, i'm thinking how make app updated data. there tutorials, examples, or ideas me understand mechanism , right method achieve goal? in advance! yes, there way that, need add code server. recommend checking old data set against new 1 , sending ones weren't in first data set. recommend researching storing data in whichever language you're server code in.

visual studio 2013 - Creating Azure SQL Database login/user using Azure AD -

i have 2 users (name@company.com) in our azure ad have been granted owner permissions azure server via azure portal. first, possible create login links/pulls azure ad these login credentials? i've searched , haven't found specific answer this, though suspicion no. second, have created logins/users same database, however, while access server fine, access database denied. have granted connect logins executed sp_addrolemember datareader each database. in double checking work, had referenced several examples show same syntax i'm using azure logins/users, , yet access still denied. any appreciated. steve. code: create login [login_name] password = n'password' create user [user_name] login [login_name] default_schema = dbo go grant connect [user_name] exec sp_addrolemember 'db_datareader', 'user_name' first, possible create login links/pulls azure ad these login credentials? i've searched , haven'

powershell - Polluted pipeline troubleshooting -

i have script, in code fails, exit code of -2145124322 $new.exitcode > $null $filepath = "wusa.exe" $argumentlist = "`"\\px_server\rollouts\microsoft\virtualpc\windows6.1-kb958559-x64-refreshpkg.msu`" /quiet /norestart" $exitcode = (start-process -filepath:$filepath -argumentlist:$argumentlist -wait -erroraction:stop -passthru).exitcode write-host $exitcode now, main script has 15,000 lines of "other stuff going on", , these lines not this. variables pulled xml, there data validation , try/catch blocks, sorts of stuff. so, started pulling pertinent lines out, , put them in tiny separate script, , hard coded variables. , there, works, nice 3010 exit code , off races. so, took working code, hard coded variables , all, , pasted original script, , breaks again. so, moved code out of function belongs, , put after initialize , before start working through main loop. , there works! now, gotta believe it's usual "polluted pipeline&quo

php - Create variable from data pulled from database -

i'm using mysql table called users includes fields such "userid, username, , password". when users login, form passes "username" , "password" entries authentication.php file a select * $tbl_name username='$myusername' , password='$mypassword . i want run php query create new variable equal "userid" in table "username" equals variable called $username. creates new variable such as $_session["userid"] = $userid how can create variable userid data pulled. the script lines below when checking username , password , creating session variables them: $sql="select * $tbl_name username='$myusername' , password='$mypassword'"; $result=mysql_query($sql); // mysql_num_row counting table row $count=mysql_num_rows($result); // if result matched $myusername , $mypassword, table row must 1 row if($count==1){ echo "welcome "; echo $myusername; echo "!"; // create s

ruby on rails - Invalid scope error -

i'm trying send bitcons using coinbase ruby gem i'm having hard time getting work. i'm authenticating this: c = coinbase::wallet::client.new(api_key: env["coinbase_key"], api_secret: env["coinbase_secret"]) ca = c.account(user.last.account.account_id) ca.send(to: env["bitcoin_address"], amount: '0.0001', currency: 'btc') this error i'm getting back. coinbase::wallet::invalidscopeerror: api::basecontroller::invalidscopeerror to clear, api key has required permission set in dashboard. doing wrong? the new ruby gem uses api v2 requires v2 scope, wallet:transactions:send instead of v1's send . can check have enabled?

javascript - if statements within while loop -

i have looked @ sites www.w3schools.com, www.developer.mozilla.org, www.codeacademy.com, , www.tutorialspoint.com , have still had hard time looking example of wrong code. first off, here code: var randomnumber = math.floor(math.random()); while(randomnumber > .5) { var name = prompt("do want play game? checkers or something?"); if (name === "yes") { console.log("good jorb!"); } else if(name === "yes") { console.log("good jorb!"); } else if(name === "yes.") { console.log("good jorb!"); } else if(name === "yes.") { console.log("good jorb!"); } else if(name === "yup") { console.log("good jorb!"); } else if(name === "yup.") { console.log("good jorb!"); } else if(name === "yup.") { console.log("good jorb!"); } else if(name === "yup") { console.log("good jorb!"); } } else if(name ==

lodash - How to count same items with specail form in a array (javascript) -

for example: input: var arr = ['a','b','c','a-5','c-2']; output: var result = {'a':6,'b':1,'c':'3'} ; my solution is: function countsameitem(arr) { var counter = {}; (var = 0; < arr.length; i++) { var item = arr[i].split('-'); if (item.length === 1) { counter[item] = (counter[item] + 1) || 1; } else { counter[item[0]] = (counter[item[0]] + parseint(item[1]) || parseint(item[1])); } } return counter; } but want thought more consise solution using lodash you can concisely without lodash: var result = ['a','b','c','a-5','c-2'].reduce(function(o, s) { var = s.split('-').concat(1); return o[a[0]] = (o[a[0]] || 0) + +a[1], o; }, object.create(null));

javascript - Whatsapp button working on Android but Blank on IOS -

this code working on android device samsung galaxy tab , s3 etc. after selecting contact, appears thetitle -> theurl . but it's not working @ ios device iphone 6 plus , iphone 5. after selecting contact, thetitle -> theurl not appear, it's blank. how can fix this? var thetitle = "post title text", theurl = "blog.com/url-post.html"; $('#myid').after('<a class="button-share whatsapp" data-action="share/whatsapp/share" href="whatsapp://send?text=' + thetitle + ' -> ' + theurl + '" target="_blank">whatsapp</a>'); solved. text value must encode @ ios whatsapp. var thetitle = "post title text", theurl = "blog.com/url-post.html", nuklear = thetitle + ' ›› ' + theurl, bomb = encodeuricomponent(nuklear); $('#myid').after('<a class="button-share whatsapp" data-action="share/whatsapp

c# - Validation of DateTime Format -

i trying validate datetime format user can provide. here sample code ... datetime tempdatetime; string _userformat = "aa"; string tempdatetime2 = datetime.now.tostring(_userformat); bool b = datetime.tryparseexact(tempdatetime2, _userformat, cultureinfo.invariantculture, datetimestyles.none, out tempdatetime); console.writeline("{0},{1}", tempdatetime, b); console.readline(); this returns true (value of b) , valid datetime (tempdatetime). in impression return false because _userformat not valid format. there other way or missing something. thank you since calling tostring() format aa , not represent valid custom format code, code treated string literal , string value aa back. when try parse "date" using same format specifier, sees format of source string matches format specifier, parses without error. since neither source nor format code specifies viable information data/time, "default" value of datetime.now.date

osx - Homebrew update error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master -

when try run brew update , see: error: following untracked working tree files overwritten merge: , large list of packages, , error: error: failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master . what can this? thanks! are installed beta of el capitan? read this: https://github.com/homebrew/homebrew/issues/40519

javascript - property 'length' of undefined Jade - simple loop -

i rendering jade template using query mongodb through node. express handling using... app.get('/rendered', function(req, res){ console.log(mongodoc[0].date + " date 0"); console.log(mongodoc[1].date + " date 1"); res.render('renderme', mongodoc); }); the mongodb { "date" : "1-may-12", "close" : "58.13" } { "date" : "1-apr-12", "close" : "18.13" } the jade template (very new this! ) for result in mongodoc p #{result.date} am using jade incorrectly? there tutorials out there? when pass mongodoc array template, use json.stringify , parse json in template app.get('/rendered', function(req, res){ console.log(mongodoc[0].date + " date 0"); console.log(mongodoc[1].date + " date 1"); res.render('renderme', {mongodoc: json.stringify(mongodoc)}); }); and i

ios - Constraint broke UIButton on iPhone -

Image
i have universal app using auto layout, unknown reason, constraint have on uibutton causing button not respond on iphone (works fine on ipad). below snapshot of .xib view embedded inside uiscrollview . note "(read drug facts...)" standard uibutton doesn't respond click on iphone. however, when changed top spacing between dose label , body view , responded clicks. but, when reduced spacing constant 40 down 10 button won't respond anymore. don't see view invisibly hiding button. update 1: matt reminding me of great view debugging feature i've forgotten about. view debugging, i'm unable find culprit. please see images below.

java - How to Disable JavaScript in WebDriver when automating in Selenium? -

i trying write test tests non-js version of website. use selenium java. have tried this: firefoxprofile profile = new firefoxprofile(); profile.setpreference("javascript.enabled", false); driver = new firefoxdriver(profile); driver.get(); however isn't working. loads page javascript enabled. as workaround did, this, requirement. manually set javascript.enabled property false following script. webdriver driver = new firefoxdriver(); driver.get("about:config"); actions act = new actions(driver); act.sendkeys(keys.return).sendkeys("javascript.enabled").perform(); act.sendkeys(keys.tab).sendkeys(keys.return).perform();

javascript - How to prevent my crossfilter from selecting nothing - dc.js -

Image
i'm working on project using dc.js , don't want crossfilter render unless data selected. currently, possible is there way avoid happening? want @ least 1 bar have selected crossfilter. i found answer. need add following 2 lines bar chart: .round(dc.round.floor) .alwaysuserounding(true) if bar chart has property .centerbar(true), should use following instead: .round(function(n) { return math.floor(n) + 0.5 }) .alwaysuserounding(true)

ios - SceneKit - Draw 3D Parabola -

Image
i'm given 3 points , need draw smooth 3d parabola. trouble curved line choppy , has weird divots in it here code... func drawjump(jump: jump){ let halfdistance = jump.distance.floatvalue/2 float let tup = calcparabolavalues(0.0, y1: 0.0, x2: halfdistance, y2: jump.height.floatvalue, x3: jump.distance.floatvalue, y3: 0) println("tuple \tup") var currentx = 0 float var increment = jump.distance.floatvalue / float(50) while currentx < jump.distance.floatvalue - increment { let x1 = float(currentx) let x2 = float((currentx+increment)) let y1 = calcparabolayval(tup.a, b: tup.b, c: tup.c, x: x1) let y2 = calcparabolayval(tup.a, b: tup.b, c: tup.c, x: x2) drawline(x1, y1: y1, x2: x2, y2: y2) currentx += increment } } func calcparabolavalues(x1: float, y1: float, x2: float, y2: float, x3: float, y3: float) -> (a: float, b: float, c: float) { println(x1, y1, x2, y2, x3, y3) let

javascript - Fetch 10000 coordinates synchronously using Google Maps -

i want fetch coordinates of 10,000 line of data using google maps geocoding api, , print each line browser. approach loop each line (contain address) , pass google maps url, parse json data lat , lng. use jquery. problem here seems run asynchronously. have tried use recursive loop without print anything. have read set async=false dont know place it. here current code var x = 1; setinterval(function(){ geturl = 'parse.php?urut='+x; $.get(geturl, function(get){ url = get; }); $.getjson(url, function(data){ var lat = data.results[0].geometry.location.lat; var lang = data.results[0].geometry.location.lng; var nama = data.results[0].address_components[1].long_name; $('table').append("<tr><td>"+x+"</td><td>"+lat+","+lang+"</td><td>"+nama+"</td></tr>"); }); x++;

C# - Network Programming - Verify client before allowing connection -

i'm new network programming stackoverflow, hope won't make bad mistakes. i try code client/server application using tcplistener/tcpclient. don't want accept every client trying connect server. i don't understand if 2 parties stay connected when client doesn't send request, , how possible verify client using password or something. how this? i don't expect tutorial maybe link reference or youtube tutorial, couldn't find helpful things on research. thank you, fre3zr the tcp protocol works following: or accept connection or don't. after accepting, can checks , reject client, if want. pseudo-code: sock1.accept() if data store received data in "x" if password match "x" continue, if not: kickclient() end if and yes, client keeps connected when finished sending data, must disconnect him in order free resources. add code question, more.

javascript - How to serialize form data into an object with nested properties -

given following inputs: <input name="person[1]['first']" /> <input name="person[2]['first']" /> <input name="person[3]['first']" /> i want serialize object so: person = { 1: {first:value}, 2: {first:value}, 3: {first:value} } is functionality available in jquery or javascript now? or have write function it? you can use, when inside <form> tag: $(formelement).serialize();

vba - Automatically creating worksheets based on a list in excel -

i trying achieve following. when enter value on 'master' worksheet in range a5:a50, macro run creates new worksheet same name value , copies template onto new sheet. in addition copy value adjacent value enter on master worksheet new worksheet calculations automatically. for example enter '1' in a5 , '2' in b5. create new worksheet name '1', copy template 'template' worksheet , copy value of b5 on new worksheet named '1'. i have following code tries copy template worksheet macro run results in error because worksheet name 'template' exists. sub createandnameworksheets() dim c range application.screenupdating = false each c in sheets("master").range("a5:a50") sheets("template").copy after:=sheets(sheets.count) c activesheet.name = .value .parent.hyperlinks.add anchor:=c, address:="", subaddress:= _ "'&

c# - How to make the download image link work? -

i have code viewdepositslip.aspx wherein shows imageurls folder uploaded files stored: <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" emptydatatext = "no files uploaded"> <columns> <asp:boundfield datafield="text" headertext="file name" /> <asp:templatefield> <itemtemplate> <asp:linkbutton id="lnkdownload" text = "download" commandargument = '<%# eval("value") %>' runat="server" onclick = "downloadfile"></asp:linkbutton> </itemtemplate> </asp:templatefield> <asp:templatefield> <itemtemplate> <asp:linkbutton id = "lnkdelete" text = "delete" commandargument = '<%# eval("value") %>' runat = "server" onclick = "deletefile" /> </it

vala - genie HashTable of string, STRUCT -

note: question array, not [ array or genericarray ] code: init var h = new hashtable of string, int? (str_hash, str_equal) h["a"] = int ({1, 2, 3}) h["b"] = int ({5, 6, 7}) // here: works fine // error here: // array concatenation not supported public array variables , parameters h["a"].data += 4 struct int data: array of int construct (a: array of int) this.data = how fix this? not answer, alternative way express this: init var h = new hashtable of string, int? (str_hash, str_equal) h["a"] = int ({1, 2, 3}) h["b"] = int ({5, 6, 7}) h["a"].append ({4}) struct int data: array of int construct (a: array of int) this.data = def append (a: array of int) this.data = this.data + now there no mixing of "variables , parameters" going on anymore, solves compiler error original code triggering. the problem results

postgresql - how to restrict specific hosts from connecting to pgbouncer? -

i running postgres-9.2 on 6432 port , pgbouncer on 5432 port. few of colleagues client machines have firewall connection permissions on 5432 port on server machine. db admin, wanted restrict ip addresses accessing database. but, though block in pg_hba.conf file, since pgbouncer port allowed, able access. i can block @ os firewall level don't want take of system administrator. so, there way restrict , deny ip addresses accessing pgbouncer through pg_hba.conf postgresql. please suggest. https://pgbouncer.github.io/2015/12/pgbouncer-1-7 main changes v1.6 support tls connections, hba control file , authentication via unix peer uid. so 1.7 have hba file, in vanil postgres. , filtering connections ip easy. also can use tricks, dropping connections after connected, described in other recent answer https://stackoverflow.com/a/46191949/5315974 again - more trick urgently getting rid of connections. using such tricks in while loop or job bad idea.

javascript - AngularJS : Reuse custom directive programmatically -

i working on first single page angular.js application , kind of stuck @ programmatically compilling/evaluating custom directive in order insert dom within controller. custom directive created uses 2 values (which return functions , take parameter) , parameter. whole thing works fine ng-repeat in initial html of spa: .directive('mydirective', ['value1', 'value2', function('value1', 'value2'){ return { restrict: 'e', scope: { param: '=param' }, replace: true, templateurl: '/path/to/template.html', link: function(scope, element, attrs){ scope.v1 = value1(scope.param); scope.v2 = value2(scope.param); } }; }) the directive template looks this: <div> <img ng-src="{{ param.img.src }}" /> <div> <a href="{{ param.link.src }}">{{ param.link.text }}</a>

php - Unknown column 'expiry_date' in 'where clause' my sql query -

i have multiple tables , using following query filter records expiry_date not expired yet. my query: select mt.id, concat(mem.name,' ',mem.last_name) name, ifnull((select max(mft.membership_end_date) membership_future_transaction mft mft.membership_transaction_id = mt.id),mm.end_date) expiry_date, mem.phone, mem.email, mmst.name membership_name, mmst.price, mmst.session membership_transaction mt left join member_master mem on mem.id = mt.member_id left join members_membership mm on mm.membership_transaction_id = mt.id left join membership_master mmst on mmst.id = mt.membership_id mt.is_casual = 'no' , mt.is_deleted = 'no' , mm.is_cancelled = 'no' , expiry_date >= '2016-01-01'" but unknown column 'expiry_date' in 'where clause' error please me missing here. mysql has perhaps nifty feature can use having alias. if change

Modelica: can stream connecter be conditional too? -

for model of heat generating device, want have optional possibility extract heat via fluid flow. related question " conditional component declaration , following if equation ". in code model derived modelica.fluid.interfaces.partialtwoporttransport. have written equivalent partial class having conditional fluidport connectors using 'internalize équation' méthode. must add 2 equations like: port_b.h_outflow *m_flow=instream(port_a.h_outflow)*m_flow+prescribedtemperature.port.q_flow; it can internalized division m_flow, if lose ability detect q_flow=0. what other approach can work?

python - Pivot Tables in Pandas- Unorderable Types -

i've got pandas dataframe (df) looks following testdate manager score 0 2015-06-05 00:00:00 jane smith 5.000000 1 2015-06-05 00:00:00 john doe 4.875000 2 2015-06-05 00:00:00 jane doe 4.428571 3 2015-06-05 00:00:00 john doe 4.000000 4 2015-06-07 00:00:00 josh smith 3.500000 .....(~250 rows) df.dtypes() testdate datetime64[ns] manager object score float64 dtype: object i want create simple pivot table on calculate average score each manager each day. such, should have column each manager name. however, when run df.pivot('testdate', 'manager', 'score') i get typeerror: unorderable types: int() <= nonetype() with output <class 'pandas.core.frame.dataframe'> datetimeindex: 11 entries, 2015-06-05 00:00:00 2015-06-24 00:00:00 data columns (total 11 columns): john doe 4 non-null values jane doe 4 non-null values ....

java - How to add a loading image in my frame? -

i have made small game in java , when open using jar file, have taken frame want put "loading bar". how can add loading image frame? use jprogressbar if can track how loaded. if can't track add jlabel gif icon of loading animations (easily available on web)

javascript - Chosen JS Drop-down list not updating -

i have 3 drop-down lists: region, location, , person. can select region, filters locations, , select location, filters people there. if select person first, select region , location. if click view persons drop-down list, see people @ location. issue appeared when added chosen.js make people drop down list searchable. when added it, people drop down list no longer filtering. region ddl: <div class="col-md-3"> @html.label("region", new {@class="control-label", @for="region"}) <select name="region" id="region" class="form-control input-md"> <option value=""></option> @foreach (var elem in model.regions) { if (model.person != null){ if (model.person.region.equals(elem.name)) {

php - "Add to WishList" and "BuyNow" buttons are missing | Wordpress Woocommerce -

in wordpress woo-commerce website on product catalogue page - both buttons "buy now" , "add wishlist" missing on single product page - " buy now " button missing. in wordpress admin found php wishlist, there wrong in code has disabled button "add wishlist" ? how enable "add wishlist" button ? <?php /** * wishlist page template * * @author inspiration themes * @package yith woocommerce wishlist * @version 1.0.0 */ global $wpdb, $yith_wcwl, $woocommerce; if( isset( $_get['user_id'] ) && !empty( $_get['user_id'] ) ) { $user_id = $_get['user_id']; } elseif( is_user_logged_in() ) { $user_id = get_current_user_id(); } $current_page = 1; $limit_sql = ''; if( $pagination == 'yes' ) { $count = array(); if( is_user_logged_in() ) { $count = $wpdb->get_results( $wpdb->prepare( 'select count(*) `cnt` `' . yith_wcwl_table . '` `user_

c# - Apply italic effect in the part of Text property of Label in Xamarin.forms -

this snippet in xamarin.forms. grid.children.add (new label {text = "italic, bold", xalign = textalignment.center, yalign = textalignment.center, fontsize = 30 }, 1, 1); i need make "italic" italic font , bold "bold". can me? i solved it. var fs = new formattedstring (); fs.spans.add (new span { text="italic", foregroundcolor = color.gray, fontsize = 20, fontattributes = fontattributes.italic }); fs.spans.add (new span { text=", bold", foregroundcolor = color.gray, fontsize = 20, fontattributes = fontattributes.bold }); labelformatted.formattedtext = fs;

php add to array x times -

i have modified dimensions/shipping calculator , got working require except have hit hurdle can not find solution too. what need pass $b->add_inner_box($inner_l,$inner_w,$inner_d); x number of times (set buy cycle value , $count loop) this passed public function add_inner_box($l,$w,$h) { if ($l > 0 && $w > 0 && $h > 0) { $this -> inner_boxes[] = array( "dimensions" => $this -> sort_dimensions($l,$w,$h), "packed" => false ); } return true; } i have looked @ arr.push , other options don`t think these work in situation, can tell novice , guidance add $b->add_inner_box array x times if use $b->add_inner_box($inner_l,$inner_w,$inner_d); $b->add_inner_box($inner_l,$inner_w,$inner_d); $b->add_inner_box($inner_l,$inner_w,$inner_d); within script works not work in aplication.

java - How can I change an object if it is in an ArrayList? -

i have arraylist of dogs. if fluffy in arraylist, want change name fido. if not in arraylist, want add it, , change name fido. so can check if fido exists in arraylist, how can retrieve can make changes? following closest have come. looking along lines of dogs.getelementequalto(new dog("fido")); import java.util.arraylist; public class dog { public static void main(string[] args) { arraylist<dog> dogs = new arraylist<>(); dogs.add(new dog("fido")); dog dog = new dog("fido"); if (dogs.contains(dog)) { dog.name = "fluffy"; } system.out.println(dogs.get(0).name); //prints fido } string name; public dog(string name) { this.name = name; } @override public boolean equals(object o) { if (this == o) return true; if (!(o instanceof dog)) return false; dog dog = (dog) o; return !(name != null ? !name

mysql - How do I fix this SQL syntax error, I cannot find it -

1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'insert ******_sports_teams (******_team_id, ******_content_type_id, ******' @ line 2 that error script; the stars cover name of company work cannot release, same word know spelled correctly. select * `******_sports_teams` 1 insert ******_sports_teams (******_team_id, ******_content_type_id, ******_content_type_desc, ******_sport_name, ******_sport_confernece, ******_sport_division, ******_sport_city, ******_sport_team) values (1,4,'sports','nba','eastern','atlantic','boston','celtics'), (2,4,'sports','nba','eastern','atlantic','brooklyn','nets'), (3,4,'sports','nba','eastern','atlantic','newy york','knicks'), (4,4,'sports','nba','eastern','atlantic','philedelphia',

lambda - Java 8 Streams: Analyze same list elements -

code explains better: test case @org.junit.test public void test() { list<integer> values = arrays.aslist(1, 2, 3, 4, 5, 6, 7, 8, 9); system.out.println(withoutstreams(values)); // output: 1,9 system.out.println(withstreamsol1error(values)); // compile time error system.out.println(withstreamsol2(values)); // output: 1,9 } required solution (without stream): private list<integer> withoutstreams(list<integer> values) { // list<integer> values = arrays.aslist(1, 2, 3, 4, 5, 6, 7, 8, 9); (int index1 = 0; index1 < values.size(); index1++) { int value1 = values.get(index1); if (value1 == 10) return arrays.aslist(value1); (int index2 = index1 + 1; index2 < values.size(); index2++) { int value2 = values.get(index2); if ((value1 + value2) == 10) { return arrays.aslist(value1, value2); } } } return collections.emptylist();

javascript - Change code for Console output to JSON output -

i have code read qaaws , prints out console, want instead create javascript run same code save json can used website. tried debug.writeline() instead of console.writeline() has not worked. i have writen code before read xml , convert json somehow giving me more issue. here code read in console: using system; using system.collections.generic; using system.linq; using system.text; using consoleapp1.testweb; namespace consoleapp1 { class program { static void main(string[] args) { consoleapp1.testweb.qaaws_by_user test1 = new consoleapp1.testweb.qaaws_by_user(); string message, creatorname, creationdateformatted, description, universe; datetime creationdate; int queryruntime, fetchedrows; consoleapp1.testweb.row[] row = test1.runqueryasaservice("<username>", "<password>", out message, out creatorname, out creationdate, out creationdateformatted, out description, o

django - It is normal for an OAuth2 implementation to create a new access token every authentication? -

i'm using oauth 2.0 implementation (django-ouath-toolkit) , noticed every time user request access token new registry in database. normal behaviour? should not recycled/replaced application , user every authentication request? if user logs in 5 times in row, 5 returned access tokens stored , valid until expires. if relevant, i'm using password grant type , public client type. thank all. yes, common practice: new access-token created on each authentication request. it is, however, uncommon user log in 5 times in row.

Elasticsearch return raw json with java api -

i have following requirements in spring web app: find objects elasticsearch , display them on google map (json format preferred) find objects (the same query above) elasticsearch , display them on list (java objects format preferred display on jsp page) i've written search java api using searchrequestbuilder , works fine: searchrequestbuilder request = client.preparesearch("index").settypes("type") .setsearchtype(searchtype.query_then_fetch).setfrom(0).setsize(10).addfields(response_fields); //request more complicated //... searchresponse response = request.execute().actionget(); searchhits hits = response.gethits(); but displaying on google map prefer json object elasticsearch instead of searchresponse object this: { "_index": "indexname", "_type": "type", "_id": "9094", "_version": 31, "found": true, "_source": { /

Android Studio remember keystore and password -

Image
whenever build signed apk dialog appears: every time have enter same texts (path, passwords, alias). my question: how save , remember them, across projects? ticking "remember passwords" not help. keystore file has been generated while ago , used in eclipse many times. go file -->project structure-->click on app-->and on right side 4tabs appear , select build in , enter detail. that's it important these in build.gradle file android { signingconfigs { prodsigningkey { keyalias 'any alias name' keypassword 'your actual password' storefile file('keystore file path on computer') storepassword 'your actual password' } } }

matlab - finding indeces of similar group elements -

i have vector test2 includes nan 0 , 1 in random order (we cannot make assumption). test2 = [nan 1 1 1 0 0 0 nan nan nan 0 0 0 1 1 1 0 1 1 1 ]; i group elements containing consecutive 1 , have in separte vectors start , finish first , last index of groups. in case start , finish should be: start = [2 14 18]; finish = [4 16 20]; i tried adapt code provided here coming solution not working...could me right solution , tell me why 1 tried doesn't work? a = (test2 ==1); d = diff(a); start = find([a(1) d]==1); % start index of each group finish = find([d - a(end)]==-1); % last index of each group start = 2 14 18 finish = 2 3 5 6 7 8 9 10 11 12 14 15 18 19 i using matlab r2013b running on windows. tried using matlab r2013a running on ubuntu. a = (test2 ==1) d=diff([0 0]) start=find(d==1) finish=find(d==-1)-1 padding 0 @ beginning , end easiest po

mysql - Java hibernate query issues with order by clause -

hi using hibernate query , trying results order id, getresultlist function returning result in ascending order though query has order clause of deviceactivitylogid. here function public list<deviceactivitylog> getactivitylogforsysactivityid(int userdevicerelid,int sysactivityid, int parentid, boolean deleteflag) { string query = "select d deviceactivitylog d d.userdevicerelid = :userdevicerelid , d.deleteflag = :deleteflag"; if (sysactivityid > 0) { query += " , d.sysactivityid = :sysactivityid"; } if (parentid >= 0) { query += " , d.isparent =:parentid"; } typedquery<deviceactivitylog> devicequery = entitymanager.createquery(query, deviceactivitylog.class); devicequery.setparameter("userdevicerelid", new userdevicerel(userdevicerelid)); devicequery.setparameter("deleteflag", deleteflag); if (sysactivityid > 0) {

ruby on rails - uninitialized constant UsersController on logout on devices gem -

i trying logout form device gem , show me error this. page crash url http://localhost:3000/users/sign_out uninitialized constant userscontroller rails.root: /var/www/rails/hustlo_dev/trunk application trace | framework trace | full trace

javascript - Angularjs limitTo not working in ng-repeat -

Image
i retrieving search query php mysql angularjs app. results in following format: this object displayed in angularjs app , displayed using ng-repeat. thing limit results 10 only. reason not work. did find possible solution limito not working . here states limitto not work if object in object. if solution how convert srchresults object in array in javascript?? if not issue? i'm using angular 1.3.11. my code: <md-list-item class="md-3-line" ng-repeat="result in srchresults|limitto:10" > <div class="md-list-item-text" ng-click= "getemployee(result.employee_id)"> <h3>{{result.last_name}}, {{result.first_name}}</h3> <h4>{{result.name}}</h4> <p>{{result.fk_cs_type}}, {{result.is_active==1?"active":"in-active"}}</p> <md-divider ng-if="!$last"></md-divider> </div> </md-list-item> to answer qu