Posts

Showing posts from July, 2014

php - uasort bad performance sorting an array of object with custom order -

i have sort array of objects called "contents", made this: "articles" => array:106 [▼ 0 => array:5 [▼ "id" => 467823568 "title" => "my tittle" "data" => "my data" "category" => 23 "order" => 2 ] 1 => array:5 [▼ "id" => 46782356433 "title" => "my tittle 2" "data" => "my data 2" "category" => 25 "order" => 1 ] ... ] the order defined in 2 array, category_o , order_o made this: "category_o" => array:21 [▼ 0 => 25 1 => 95 2 => 135 3 => 72 4 => 4 5 => 23 6 => 7 7 => 803 ... ] i have articles sorted property "category" custom order specified in category_o array, , second sort property "order" other custom order specified in...

php - Aggregation date range mystery -

i have kind of mongo $date = (int)(date("ymdhis", strtotime("now -30 days"))); $date2 = (int)(date("ymdhis", strtotime("now"))); $visits_options2 = array( array( '$match' => array( 'date' => array('$lte'=>$date2, '$gte'=>$date), 'click'=>1 ) ), array( '$group' => array( "_id"=>array({lot of fields}), 'cpc' => array('$sum' => '$cpc'), 'visits' => array('$sum'=>1) ) ) ); the mystery comes when (having data sure) if use '$gte' on match works if use both $gte , $lte doesn't. any clue of whats happening? update : ok, got weirder. if use gte + lte on console (exact same query) works. if use gte , "now" date console says there n...

javascript - Bootstrap dropdown disappears after clicking it -

<div class="container" ng-controller="servicehistorycontroller"> <!-- search box start --> <div class="dropdown col-xs-8"> <button class="btn btn-default col-xs-4" id="dropdownmenu1" data-toggle="dropdown" aria-haspopup="false" aria-expanded="true"> select sut <span class="caret"></span> </button> <ul class="dropdown-menu col-xs-8" aria-labelledby="dropdownmenu1"> <li ng-repeat="sutname in sutlist"> <a href="#" ng-click="sutselected(sutname)"> {{sutname.name}} </a> </li> </ul> </div> </div> above bootstrap + angular drop down code using. once clicked on dropdown disappeared. using angular1 + boostra...

javascript - Handlebar and Safari 9 issue -

my code in .handlebar file as: <div class='module-sequence-padding'></div> <div class='module-sequence-footer clearfix'> <div class="module-sequence-footer-content"> {{#if previous.show}} <a href="{{previous.url}}" role="button" class="pull-left" data-tooltip="right" data-html-tooltip-title="{{previous.tooltip}}" aria-describedby="msf{{instancenumber}}-previous-desc"> <i class="icon-mini-arrow-left"></i>{{#t 'previous'}}previous{{/t}} <span id="msf{{instancenumber}}-previous-desc" class="hidden" hidden>{{previous.tooltiptext}}</span> </a> {{/if}} {{#if next.show}} <a href="{{next.url}}" role="button" class="pull-right bordered" data-tooltip="left" data-html-tooltip-title="{{next.tooltip}}" aria-desc...

javascript - Error in for loop in JS inside stylesheet file -

i have xsl file , there html part of writing javascript function inside <script type="text/javascript" language="javascript" > function toggle_tbody(obj) { var body = document.getelementsbytagname("tbody"); if( obj.innertext == 'expand all' ) { obj.innertext = 'collapse all'; d = 'inline'; } else { obj.innertext = 'expand all'; d = 'none'; } var length = body.length for(var = 0; < length; i++) { document.getelementbyid("demo").innerhtml = length; } } </script> but have error while compiling says: xml parsing error @ line 164: starttag: invalid element name i should mention line 164 beginning of loop. would let me know error because see there shouldn't any. thanks @rohankumar hint. then here f...

toast - getContext () , getApplicationContext(), getBaseContext are not working in Android -

i want show toast message getcontext() in toast.maketext((getcontext()," message" , toat.length_long.show())) giving error cannot resolve method. the problem in class want show toast message not mainactivity class. asynctask class. can show toast message in other classes (other mainactivity class) above mentioned problem? import android.os.asynctask; import android.widget.toast; public class myclass extends asynctask<string, string, string> { public myclass(double a, double b,context context ) { this.a = a; this.b=b; this.context = context; } protected string doinbackground(string... params) { return null; } protected void onpostexecute(string result) { toast.maketext((getapplicationcontext(), "message", toast.length_long).show(); } } edit made constructor (see above code) in mainactivity class calling in way myclassobj = new myclass(a, b,this); giving error myclas() in ...

c# - Multiple TextChanged and KeyPress event -

i have lot of textbox controls. every textbox control text_changed , key_press events. because of form.cs becomes crowded. question this, possible make more space free? events consist of 1 function. sample code: private void txtitem_textchanged(object sender, eventargs e) { showbuttonsave(); } private void txtitem_keypress(object sender, keypresseventargs e) { showbuttonsave(); char ch = e.keychar; if (ch == (char)keys.enter) e.handled = true; } private void txtitem2_textchanged(object sender, eventargs e) { showbuttonsave(); } private void txtitem2_keypress(object sender, keypresseventargs e) { showbuttonsave(); char ch = e.keychar; if (ch == (char)keys.enter) e.handled = true; } on txtitem2 can go properties , there says ontextchange should see set txtitem2_keypress change txtitem_keypress both use private void txtitem_keypress(object sender, keypresseventargs e) { showbuttonsave(); char ch = e.keychar; if (ch ...

How to force session_id in ASP.Net MVC -

i doing ajax calls (with jquery) browser. notice session id not sent browser. want pass session id parameter. on server side, not know how tell asp.net "now, use value session_id". in php, used that: session_start($_post['my_session_id']); i want same thing in asp.net thanks you want custom isessionidmanager . the isessionidmanager interface identifies methods must implement create custom manager session-identifier values. isessionidmanager interface implementation creates , validates session-identifier values, , manages storage of session identifier in http response retrieval of session-identifier value http request. [...] if want supply custom session-identifier values used asp.net session state, can create class inherits sessionidmanager class , override createsessionid , validate methods own custom implementation. enables supply own session-identifier values, while relying on base sessionidmanager class store values http...

Java: Try to Understand Getting Inputs from Users Using Scanner -

i have programs , few questions regarding how .next(), .nextint(), .hasnext() , .hasnextint() of scanner class work. thank in advance of :) import java.util.scanner; public class test { public static void main (string[] args) { scanner console = new scanner(system.in); int age; system.out.print("please enter age: "); while (!console.hasnextint()) { system.out.print("please re-enter age: "); console.next(); } age = console.nextint(); system.out.println("your age "+age); } } 1/ when !console.hasnextint() executed first time, why ask input? i thought @ first console empty, !console.hasnextint() true (empty not int), should go directly "please enter age: " "please re-enter age: " thought seems wrong. here, user needs enter before "please re-enter age: " printed. 2/ data type of console.next() string (i tried making int s = console.next(); , g...

javascript - Angular isolated scope values not visible in template when using replace -

i creating small app , have following directive template. smallgrid.directive.js: angular.module('myactions') .directive('smallgrid', ['$rootscope', function($rootscope) { return { restrict: "e", scope: { actionable: "=" }, controller: function($scope) { $scope.setlocation = function() { console.log("yee"); }; } }; }]) .directive('three', function() { return { replace: true, templateurl: '/app/my_actions/directives/templates/grid3x3.template.html' }; }) .directive('four', function() { return { replace: true, templateurl: '/app/my_actions/directives/templates/grid4x4.template.html' }; }) .directive('five', function() { return { ...

swift - Get specific corner co-ordinates of UIView/UIImageView irrespective of its rotation -

Image
i have simple uiimageview of in screen follow: to co-ordinates of highlighted corner of uiimageview , use simple formula: cgpointmake(cgrectgetmaxx(imageview.frame), cgrectgetmaxy(imageview.frame)) now rotate imageview , looks follows: after rotation, how can co-ordinates of highlighted point? because after rotation, previous code not applicable. you can consult next link topic: transformation of coordinates involving rotation https://www.math10.com/en/geometry/analytic-geometry/geometry1/coordinates-transformation.html it applies cos , sin functions calculate (x,y) in new rotated coordinate system. need rotation angle.

android softkeyboard - Keyboard Overlaps Edittext - Activity Fullscreen -

i working on chat application edittext , send button @ bottom. activity fullscreen, hidden navigation , status bar. need push edittext , send button when keyboard comes focus. i tried set android:windowsoftinputmode="adjustresize" didn't worked. i tried using androidbug5497workaround.assistactivity(this) class referred https://github.com/madebycm/androidbug5497workaround didn't worked. below activity theme , code in activity hide bar , make full screen : decorview = getwindow().getdecorview(); uioptions = view.system_ui_flag_hide_navigation | view.system_ui_flag_immersive_sticky | view.system_ui_flag_layout_fullscreen | view.system_ui_flag_immersive_sticky; theme : <style name="apptheme_darkstatus" parent="theme.appcompat.light.noactionbar"> <item name="colorprimary">@color/colorprimary</item> <item name="colorprimarydark">@color/colorprimaryverydark</item...

HTML/CSS Div Sive Affects Other Divs -

in jfiddle example: https://jsfiddle.net/upmuvk6t/ why .navigationtabs have same height? if inner divs removed, , height of 1 tab changed has same effect, shown here: https://jsfiddle.net/upmuvk6t/ if parent div's height changed, has no effect. why height of these divs seemingly connected? body, div { margin: 0; padding: 0; } .navigationtab { vertical-align: top; font-family: 'baloo tamma', cursive; display: table-cell; text-align: center; width: 150px; height: 30px; background-color: #00ace6; -webkit-border-bottom-left-radius: 10px; -webkit-border-bottom-right-radius: 10px; -moz-border-bottom-left-radius: 10px; -moz-border-bottom-right-radius: 10px; user-select: none; cursor: pointer; } .navigationtab:hover { background-color: #0086b3; } <div style="white-space: nowrap;position: fixed;width: 100%;"> <div class="navigationtab" style="float:right"> account...

push notification in Xamarin.forms PCL -

i need implement push notification in xamarin.forms project. i go through these links cannot find sample code. how approach push notifications on xamarin.forms project? add push notifications xamarin.forms app xamarin push notifications using azure notifications hub implemented push notifications in awesome xamarin.forms most of sample using azure service. not use one. end team manage send notification device. need pass token of notification , handle given notification @ end. i got 1 plugin push notification cannot find sample or useful code how use or implement it. xamarin-plugins pushnotification

Can ORM sequelize have polymorphism? -

i have model named user. can extend model admin/mod user model? have found sequelize doc, didn't find out yes, check out associations documentation , or more in scopes documentation . from docs: this.comment = this.sequelize.define('comment', { title: sequelize.string, commentable: sequelize.string, commentable_id: sequelize.integer }); this.comment.prototype.getitem = function() { return this['get' + this.get('commentable').substr(0, 1).touppercase() + this.get('commentable').substr(1)](); }; this.post.hasmany(this.comment, { foreignkey: 'commentable_id', constraints: false, scope: { commentable: 'post' } }); this.comment.belongsto(this.post, { foreignkey: 'commentable_id', constraints: false, as: 'post' }); this.image.hasmany(this.comment, { foreignkey: 'commentable_id', constraints: false, scope: { commentable: 'image' } }); this.comment.belon...

C++ Function Assignment grade calculator -

my programming lecturer teaching how write functions, terribly might add, make program calculates grade of students work. here specs on it. score 1 weighted 0.3, score 2 weighted 0.5, and score 3 weighted 0.2. if sum of scores greater or equal 85 grade 'a'. if sum of scores greater or equal 75 grade 'b'. if sum of scores greater or equal 65 grade 'c'. if sum of scores greater or equal 50 grade 'p'. otherwise grade 'f'. so wrote code follows: #include <iostream> using namespace std; void calculategrade() { int score1, score2, score3; int percentdec; cin >>score1>>score2>>score3; percentdec = (score1+score2+score3); if (percentdec >= 85) { cout << "the course grade is: a"; } else if (percentdec >= 75) { cout << "the course grade is: b"; } else if (percentdec >= 65) { cout <<"the course grade is: c"...

mysql - php while loop table repeating fix -

i have following while loop keep on repeating table each record how fix it? full table repeat each record. every row fetch can add <table width="1510" border="1" align="center" cellpadding="2" cellspacing="2" class="table table-bordered" > <tbody> <form name="f1"> <? $counter = 1; $total_marks = 0; $total_obtain = 0; while($row_rsdept = mysql_fetch_array($rsdept)) { if($counter === 1) { ?> <tr> <th width="71" rowspan="3" align="center" valign="middle" scope="col"><h4>sr. no</h4></th> <th width="229" align="right" valign="top" scope="col">&nbsp;</th> <th colspan="8" align="center" valign="middle" scope="col"...

string - Is it possible to do a swap on return in c++, instead of return by value? -

suppose i'm coding string class in c++ (i know can use library). string length variable , storage space dynamically allocated in constructor , freed in destructor. when main function calls c=a+b ( a,b,c strings), operator+ member function creates temporary object stores concatenated string a+b , returns main function, , operator= member function called free string stored in c , copy data temporary string a+b c , , temporary a+b destructed. i'm wondering if there's way make happen: instead of having operator= copy data a+b c , want swap data pointers of a+b , c , when a+b destructed, destructs original data in c (which want), while c takes result of a+b without needing copy. i know coding 2-parameter member function settostrcat , calling c.settostrcat(a,b) can this. example, function can coded as: void string::settostrcat(const string& a,const string& b){ string tmp(a.len+b.len); int i,j; for(i=0;i<a.len;i++) tmp[i]=a[i]...

ios - Combine two UIImageView in to one image stretching -

Image
when tried 2 combine 2 uiimageview images stretching here's code using cgsize size =cgsizemake(max(self.imgcapture.size.width, self.imggallary.size.width), max(self.imgcapture.size.height, self.imggallary.size.height)); uigraphicsbeginimagecontext(size); [self.imgcaptured.image drawinrect:cgrectmake(self.view.frame.origin.x,self.view.frame.origin.y,size.width/2,self.imgcapture.size.height)]; [self.imggallarycd.image drawinrect:cgrectmake(self.view.frame.origin.x+(size.width/2),self.view.frame.origin.y,size.width/2,self.imggallary.size.height)]; uiimage *finalimage = uigraphicsgetimagefromcurrentimagecontext(); here's first screenshot there 2 uiimageview's second screenshot when combine image 1 image stretching want aspect ratio screenshot 1 the image not "stretching". squeezing. it's matter of simple arithmetic. looking @ image context size , drawinrect commands, see image context size of one image, drawing both images @ half w...

c# - Convert datetime2 to string("dd/MM/yyyy") in LINQ -

Image
i have datetime2 column in database.i'm trying fetch database , want display in view string. i tried: dt.tostring("dd/mm/yyyy"); but gave error. an exception of type 'system.notsupportedexception' occurred in entityframework.sqlserver.dll not handled in user code additional information: linq entities not recognize method 'system.string tostring(system.string)' method, , method cannot translated store expression. i tried string.format("{0:y yy yyy yyyy}", dt); also, throwed error. i think realize problem, after posted screenshot. functions aren't allowed run inside linq, linq needs translate them sql. since can't copy paste code modifications (you need perform date formatting outside linq statement, whether using foreach loop, or other method). rough idea: allclient = (from .... select new allclient() { ... purchasedt = "", ...

database - Setting up ArangoDB cluster wihout DCOS -

i'm working on setting arangodb cluster in ubuntu machine based on these instructions : https://docs.arangodb.com/3.0/manual/deployment/distributed.html i keep getting below error when execute first command in above documentation sudo. ensured directories pointing in /etc/arangod.conf file has required permissions. please can let me know if i'm missing here. below error : 2016-08-23t07:29:52z [26629] fatal unable create database directory: failed create directory [agency1] permission denied the command passes database directory on command line (agency1) , arangodb doesn't seem have rights create agency1 in current working directory. either provide proper working directory on command line or specify 1 in config file.

How python interpreter determine the type of variable at runtime? -

i want know how python's (python 2.7) interpreter find type of variable. how python dynamic type behaviour internally works. macbook-pro:~ neelabhsingh$ python python 2.7.12 (default, jun 29 2016, 14:05:02) >>> type(i) <type 'int'> >>> type(str1) <type 'str'> >>> testfloat = 45.67 >>> type(testfloat) <type 'float'> in cpython 2.7 (i.e. c language implementation of python), there pyobject type . there pyobject_type function accesses type stored in pyobject i.e. object carries around type information it.

I am working on CodeIgniter, but unable to output entity that has timestamp at mysql end but other entities are working(coming out well) -

/// controller has : $users = $this->loginmodel->getalluser(); $data["users"] = $users; $this->load->view("login/allusers",$data); /// view has : foreach($users $user){ echo "username : ".$user->getusername()." time : ".$user->gettimepost()."<br>"; } question : $user->gettimepost() generating error during echo here small code can use you. controller function viewallusers() { $data['users'] = $this->loginmodel->getallusers(); $this->load->view('login/allusers',$data); } model function getallusers() { $this->db->select('*'); $this->db->from('tblname'); $query = $this->db->get(); return $query->result(); } view foreach($users $u) { echo "username : ".$u->user_name; echo " time : ".$user->time_stamp; echo ...

ios - Crashing error after cleaning up after saving FBO to camera roll? Swift 2.0 selector syntax -

so have code save bound fbo camera roll. first part of code works perfectly! if dont try clean buffer or image reference works fine, , picture placed inside of camera roll. unfortunately there 4mb memory leak result. so apparently need clean of data. the first place thought var buffer = unsafemutablepointer<glubyte>(nil) problem if clear right after uiimagewritetosavedphotosalbum call odd crashing error no stack trace makes sense. so figure takes time data save photo album such need use completion selector. problem have tried couple different ways of using selector block every time crash , message "nsforwarding" in case get: nsforwarding: warning: object 0x16e6bb60 of class 'app.screenshotsaving' not implement methodsignatureforselector: -- trouble ahead unrecognized selector -[app.screenshotsaving methodsignatureforselector:] for reference class instantiated inside of static class so class storage { static var ssave = screenshotsaving() } ...

mod wsgi - Python Falcon on Webfaction -

i'm trying falcon , running on webfaction. i'm not network guru, i'm having tough time wrapping head around how these applications served. my webfaction app set mod_wsgi 4.5.3/python 2.7 to understanding, falcon run on wsgi server. when swet mod_wsgi server, automatically configured falcon run on? or still need install gunicorn? when set webfaction app, received directory structure this: app/htdocs/index.py and inside index.py file, put example found @ falcon tutorial import falcon class thingsresource(object): def on_get(self, req, resp): """handles requests""" resp.status = falcon.http_200 resp.body = 'hello world!' # falcon.api instances callable wsgi apps wsgi_app = api = falcon.api() # resources represented long-lived class instances things = thingsresource() # things handle requests '/things' url path api.add_route('/things', things) i understand there instructions ...

asp.net - Posting data to a SQL Table via vb.net Form with an onClick Submit button -

i'm new vb.net , i'm working on project in visual studio 2015. in 1 of application's tab i'm trying insert new records sql table via form post, once click button nothing happens , no new records added. current code below, great! thanks: contact.aspx <%@ page title="contact" language="vb" masterpagefile="~/site.master" autoeventwireup="true" codefile="contact.aspx.vb" inherits="contact" %> <asp:content runat="server" id="bodycontent" contentplaceholderid="maincontent"> <head> <meta charset="utf-8"> </head> <body> <br /> <p style="font-size: 15px;">fill out form below , click submit once completed:</p> <form id="submitdata" method="post"> <fieldset> <p><label for="term">term:</label> <input type="text" name="term" re...

How To Display Japanese Characters in ColdFusion With <cfoutput> -

i creating coldfusion page japanese characters. included following in top of page. <meta http-equiv="content-type" content="text/html; charset=utf-8" /> if explicitly include japanese characters in output, fine. however, if output them using, say: <cfoutput>#variables.titleinjapanese#</cfoutput> the output garbled though encoding not recognized. have tried <cfcontent> , <cfprocessingdirective> tags no avail. if open .cfm source file, japanese characters assigned variables should in text editor. it's content generated using <cfoutput> giving me trouble. suggestions welcome. thanks! correction: page have created not display japanese characters, explicit or referenced. however, other files using <cfinclude> within page have japanese characters render fine.

How to configure different ExpireTimeSpan for persistent and non-persistent cookies in ASP .Net Identity Core -

i have sign-in page remember me option. want configure remember me cookie expiry quite longer, 1 month. i use cookieauthenticationoptions.expiretimespan property doesn't work "only" rememberme option. i want user signed in few minutes, 30 minutes after sign-in, in current browsing session (if user didn't select rememberme option). in case use expiretimespan = timespan.fromminutes(30) . is there way configure "remembermeduration" configure 2 different settings when rememberme selected , when not selected? - out of box (at least not creating whole new middleware such small feature) absolute expiry can used implement remember me (say 30 days) feature. when using identity, set expiresutc during signinasync after password check. var au = new applicationuser() { email = model.email }; var r1 = await _usermanager.checkpasswordasync(au, model.password); if (r1) { await _signinmanager.signinasync(au, new authenticationproperties() { expiresu...

Jenkins not installing Xvfb in Windows -

Image
i have several selenium ide tests i'm trying run in jenkins (it running on windows server 2012 r2). i've followed steps described @ running selenium tests in jenkins , issue have jenkins not install xvfb - attempts use "install automatically" option don't seem work (i can click "apply" xvfb won't appear); have been unable find exe anywhere (jenkins asks "directory in find xvfb executable"). is there way install xvfb in windows? know it's easy in linux have use windows. please check below solution.it worked me in windows 7. jenkins configuration 'manage jenkins'- provide name 'default' , did not select 'install automatically' check box.check image 1. manage jenkins settings install xvfb plugin manage plugins of manage jenkins - select xvfb plugin available plugins list , click install. plugin download jenkins set build environment details in configure window - select 'start xvfb before ...

python - How to include non PyPi packages for virtualenv requirements file? -

is there way include packages/modules not available through pip in requirements file project portable? the default version of lxml seems have issues pypy need use custom fork . the problem need heroku (where deploy application) use custom version of lxml , not 1 that's available via pip. there way this? you can using the listed git packages syntax , need add following line requirements.txt -e git://github.com/aglyzov/lxml.git#egg=lxml

angular - When would you surround routerLink in square brackets? -

the angular 2 cheat sheet shows examples of routerlink both , without square brackets in templates: <a routerlink="/path"> <a [routerlink]="[ '/path', routeparam ]"> <a [routerlink]="[ '/path', { matrixparam: 'value' } ]"> <a [routerlink]="[ '/path' ]" [queryparams]="{ page: 1 }"> <a [routerlink]="[ '/path' ]" fragment="anchor"> what's difference in functionality? when put square brackets around routerlink (or angular 2 binding) evaluate pass javascript expression. if don't put square brackets around routerlink take pass literal string. so if want pass array routerlink or evaluate variable have use square brackets. if want pass string either do <a routerlink="/path"> or <a [routerlink]="'/path'">

osx - How to enable MKMapView 3D view? -

i have mkmapview in window, , pitchenabled true (and i've confirmed in debugger). "3d" thingy in middle of compass grayed out, , clicking or dragging nothing. option-dragging map (like in maps.app) doesn't anything, either. from interpretation of docs, setting pitchenabled should let me use 3d view, maps.app does. mistaken? there else need allow users 3d map view? you can close experience of 3d mode adjusting camera angle view map , making buildings visible. example below allows view eiffel tower in 3d: viewdidload() { super.viewdidload() mapview.maptype = mkmaptype.standard mapview.showsbuildings = true // displays buildings let eiffeltowercoordinates = cllocationcoordinate2dmake(48.85815, 2.29452) mapview.region = mkcoordinateregionmakewithdistance(eiffeltowercoordinates, 1000, 100) // sets visible region of map // create 3d camera let mapcamera = mkmapcamera() mapcamera.centercoordinate = eiffeltowercoordina...

How can I set large amounts of HTML code with POST variables to a variable in PHP? -

$content = '<div id="contact" style="display:''; border-radius: 5px; padding: 20px;" class="center"><br><!--spacing--><br><!--spacing--></div> <div id="contact" style="display:''; border-radius: 5px; background-color: #ebebeb; padding: 20px;" class="center"> <form> <center><h4><b>' . $_post['email1'] . " " . $_post['email2'] . '</b></h4></center> <br><!--spacing--> <center>' . $_post['email4'] . '<center> <br><!--spacing--> <center>' . $_post['email3'] . '<center> <br><!--spacing--> <center>' . $_post['email5'] . '<center> <br><!--spacing--> <center><img src="rushforms/profile_images/' . $_post['file_number'] . '.png"/>...

arrays - Javascript number data grouping and outlier removal -

i have array follows: var myarray = [3, 6, 8, 9, 16, 17, 19, 37] i needing remove outliers group remaining data distinctive groups appear. in case 37 removed outlier , [3, 6, 8, 9] returned first group , [16, 17, 19] returned second. here second example var mysecondarray = [80, 90, 100, 200, 280, 281, 287, 500, 510, 520, 800] 200 , 800 removed outlier, [80, 90, 100] first group, [280, 281, 287] second , [500, 510, 520] third. i have written code works remove outliers on outside simple enough using first , third quartile. in other words have no problem removing 800 mysecondarray outlier. not remove 280 outlier. i suppose outlier defined group less n members real issue what efficient method divide data appropriate number of groups ? any appreciated! jsfiddle demo this simple implementation, may not perfect solution set of problems should suffice example - may work beyond well. by looking @ average distance between numbers, , comparing distanc...

javascript - How do you make JQuery WebTicket full-screen width? -

basically, webticket goes little on 2/5ths of screen, i'm trying figure out how can stretch width out covers entire screen's width. fiddle: http://fiddle.jshell.net/wf43x/56/light/ javascript: /*! * webticker 1.3 * examples , documentation at: * http://jonmifsud.com * 2011 jonathan mifsud * version: 1.2 (26-june-2011) * dual licensed under mit , gpl licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * requires: * jquery v1.4.2 or later * */ (function($) { var globalsettings = new array(); var methods = { init: function(settings) { // settings = jquery.extend({ travelocity: 0.05, direction: 1, moving: true }, settings); globalsettings[jquery(this).attr('id')] = settings; return this.each(function() { var $strip = jquery(this); $strip.addclass("news...

amazon - Cognito User Pool: How to refresh Access Token Android -

how refresh access token using cognito android? documentation suggest following ( https://docs.aws.amazon.com/cognito/latest/developerguide/using-amazon-cognito-user-identity-pools-android-sdk.html ): // implement authentication handler authenticationhandler handler = new authenticationhandler { @override public void onsuccess(cognitousersession usersession) { // authentication successful, "usersession" have current valid tokens // time awesome stuff } @override public void getauthenticationdetails(final authenticationcontinuation continuation, final string userid) { // user authentication details, userid , password required continue. // use "continuation" object pass user authentication details // after user authentication details available, wrap them in authenticationdetails class // along userid , password, parameters user pools lambda can passed here // validation parameters ...

java - Creating documents on Lotus Notes 9 or 8.5 with multiple users -

i've been making tool create dummy documents on lotus notes using java api. so far i've been successful creating documents using notesfactory create session method notesfactory.createsession(serverurl, username, password); and later creating document using database class createdocument() method. however, regardless of user put when i'm creating session, created document has "administrator" document originator. is there way override behavior? edit 8/24/2016: here code i'm using create documents session session = notesfactory.createsession(serverurl, username, password); database db = session.getdatabase(session.getservername(), "doclibra.nsf"); document doc = db.createdocument(); // set document properties doc.replaceitemvalue("subject", "sample subject"); richtextitem bodyitem = doc.createrichtextitem("body"); bodyitem.appendtext("sample content"); doc.save(); doc.recycle(); db.recycle();...

javascript - angularjs app to redirect after login -

currently, when users logs in, login page does't redirect homepage. 'use strict'; angular.module('myapp').service('auth', function auth($http, api_url, authtoken, $state, $window, $q) { function authsuccessful(res) { authtoken.settoken(res.token); $state.go('main'); } this.login = function (email, password) { return $http.post(api_url + 'login', { email: email, password: password }).success(authsuccessful); } this.register = function (email, password) { return $http.post(api_url + 'register', { email: email, password: password }).success(authsuccessful); } however, have set $state.go redirect main. problem? why not redirecting? annex here login.js controller, how looks: angular.module('myapp').controller('loginctrl', function ($scope, alert, auth, $auth) { $scope.submit = function () { $auth.login({ email: $scope.email, pas...

ios - How to update swift Layout Anchors? -

trying find solution update multiple constraints multiple ui elements on event. have seen examples of deactivating, making change, reactivating constraints, method seems impractical 24 anchors working with. one of sets of changes: ticketcontainer.translatesautoresizingmaskintoconstraints = false ticketcontainer.topanchor.constraintequaltoanchor(self.topanchor).active = true ticketcontainer.leftanchor.constraintequaltoanchor(self.rightanchor, constant: 20).active = true ticketcontainer.widthanchor.constraintequaltoconstant(200.0).active = true ticketcontainer.leftanchor.constraintequaltoanchor(self.leftanchor, constant: 20).active = true ticketcontainer.widthanchor.constraintequaltoconstant(100.0).active = true have tried saving relevant constraints created using layout anchors properties, , changing constant? e.g. var tickettop : nslayoutconstraint? func setup() { tickettop = ticketcontainer.topanchor.constraintequaltoanchor(self.topanc...