Posts

Showing posts from August, 2015

java - Using jar file in another project -

i have 1 jar file, named pwd.jar , want use in project named sample . how can that? steps should perform? note: using eclipse ide right click project-> properties->java build path -> libraries tab -> add external jar, , browse jar cheers

php - How to remove p tag from wordpress -

i trying remove p tag wordpress automatically adds p tag in images.also center images wordpress becomes so tried adding code function filter_ptags_on_images($content){ return preg_replace('/<p style=".*?">\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iu', '\1\2\3', $content); } add_filter('the_content', 'filter_ptags_on_images'); this removes style p tag , become <p><img src=...><p> can me how remove p images only. try below code: function filter_ptags_on_images($content) { return preg_replace('/<p>(\s*)(<img .* \/>)(\s*)<\/p>/iu', '\2', $content); } add_filter('the_content', 'filter_ptags_on_images'); or try modify own code: function filter_ptags_on_images($content) { $content = preg_replace('/<p style=".*?">\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*...

c - Is branch predication used in gcc for ARM and how can we disable it? -

i compiling binaries armv8 , armv7 devices , want disable branch predication . know question has been asked once ( here ) target x86 machine. i'm using linaro gcc arm. i'm doing experiment sake , don't recommend practice. i have used perf measure branch instructions / branch misses count. so have 2 questions: is branch predication utilised gcc/g++ arm? how can disable it? i have tried following options: fno-branch-target-load-optimize(2) - no effect on binary size generated different assembly. branch statistics identical without using option. -fno-if-conversion(2) - binary size identical, assembly different. increased number of branches being executed , branch miss rate. appears option dose something. -fno-guess-branch-probability - same above had lower impact. so can sure using -fno-if-conversion , -fno-guess-branch-probability disabling branch predication ? after doing more research , tests have answer. in armv7 isa there predicat...

xml - Android Studio rendering problems with version 1.2.1.1 -

Image
i using latest version of android studio 1.2.1.1. facing rendering issue when try view xml design, can tell me should ? here screenshot change android api level in preview, in 22 , set 21 . work.

python - Generating a count of shared IDs between a tuple of item numbers -

i have group object converted in dataframe : item id's 1 100,101,102 2 101,103,104 3 100,201,202 now want generate 2-tuples/ordered pairs, gives me count of ids shared in each pair of items. desired output is: item item id's 1 2 5 1 3 5 2 3 6 the columns correspond every ordered pair of items such (1,2),(1,3),(2,3) , on , third column tells me how many ids both items have in original table. if structure have like: data = { 1: [100, 101, 102], 2: [101, 103, 104], 3: [100, 201, 202], } then help: res = {} items = data.keys() n, in enumerate(items, start=1): j in items[n:]: res[(i, j)] = len( set(data[i]).union(set(data[j])) ) output: res {(1, 2): 5, (1, 3): 5, (2, 3): 6}

mysql - php edit TABLE A, display into textbox then save it into TABLE B -

table crew(a) - user_id, name, username, status table data(b) - user_id, name, username, password, month, status records came table a . idea solve this: search record table a , edit record add new textbox password , month save table b . i have pullout record table unable save table b. it's able save record save user_id , month, rest of columns missing. updateform.php: <?php $sql = "select * crew user_id = $sel_record"; $result = mysql_query($sql, $con) or die (mysql_error()); if(!$result) { print "<h1>something has gone wrong!</h1>"; } else { while ($record = mysql_fetch_array($result)) { $user_id = $record['user_id']; $lname = $record['lname']; $username = $record['username']; $status = $record['status']; } <form id = "myform" method="post" action = "...

oauth - iOS LinkedIn API error -

Image
i trying implement this linkedin library in project, seems error while try present linkedin screen: authorization failed linkedin1: error domain=lialinkedinerror code=1 "the operation couldn’t completed. (lialinkedinerror error 1.)" you can find code using here . may information - api terms of use transition guide

jquery - Get content type of 'File' object using javascript -

i have 2 files same extensions follows: 1) test_audio_file.mp4 (consist of audio content) 2) test_video_file.mp4 (consist of audio , video content) after uploading file, creating file object of uploaded file. i want check content type of file object. i.e. audio/mp4 first file , video/mp4 second file. when print file type using file_object.type method, getting video/mp4 in both cases. my assumption audio/mp4 first file , video/mp4 second file. i putting line of code here: loadfile: function(file) { console.log(file.type); }; is there method or way content type audio first file , video second file. any ideas great. thanks! the browser assume mime-type file extension in both cases here mp4. to sure, can check binary content of file. example assuming have loaded file in arraybuffer first create flexible view (uint32array cannot used length of buffer must 4-bytes aligned not case file, , dataview big-endian little-endian swapping you):...

adobe analytics - how to track the social media icons using DTM (Dynamic tag manager) -

i have below code in web site. i want track each anchor tag using dtm. know how track single element. since here have bunch of different elements, can how track them using dtm? don't want create separate rule each element. in single rule how can track these elements. here example of can do. for element tag or selector put " a.at-share-btn " (no quotes). target relevant links first. can in next step, "pre-qualifying" improve performance rule not evaluated against every single a click. then, under rule conditions , add criteria of type data > custom . in custom box, add following: var sharetype = this.getattribute('class').match(/\bat-svc-([a-z_-]+)/i); if (sharetype&&sharetype[1]) { _satellite.setvar('sharetype',sharetype[1]); return true; } return false; this code looks class (e.g. "at-svc-facebook") , puts last part of (e.g. "facebook") data element named sharetype . then, can ref...

hadoop - Reading compressed (.xz) file in Apache pig -

i trying read .xz file compressed using hadoop-xz codec using pig script. the sample code tried is, register hadoop-xz-1.4.jar set output.compression.enabled true; set output.compression.codec io.sensesecure.hadoop.xz.xzcodec; msg = load 'pigtest/newxz.xz' using pigstorage(); store msg 'pigtest/output' using pigstorage(); dump msg; the result still in compressed format. doing wrong or have use xzinputstream inside pig? the running environment hortonworks sandbox 2.2 (hue) depends on want do. it seems want read xz file assume need setup input codec not output one. i'm not pig user gather cannot handle custom compression (unlike hive , streaming example).

c - How to add a blue selection rectangle to ListView? -

Image
does windows api listview supports selection rectangle? update i stand corrected. if lvs_ex_doublebuffer added extended list view style, control performs alpha blended marquee selection. documentation says: lvs_ex_doublebuffer version 6.00 , later. paints via double-buffering, reduces flicker. extended style enables alpha-blended marquee selection on systems supported. thanks @andlabs pointing out. does windows api listview supports selection rectangle? no. image in question comes private list view control, directuihwnd. control used in variety of microsoft software , visible in explorer. third party programs don't have access control. if want functionality have implement yourself. system list view control, syslistview32, has no such functionality.

css - Jquery datatables fixed columns issue in IE 9 -

Image
i using jquery ui tabs display 2 grids side side within same div. grid displayed using jquery datatables plugin. have added feature of fixed columns in both of grids, makes ie 9 behave weirdly @ random. behavior happen @ total random on 1 of 2 grids not on both. ie 9 display fixed column portion on horizontal scroll-bar . looks below: other grid display fine below: funny thing if sort out affected table or enter characters in search textbox , overlapping portion got fixed automatically. search on , came know draw() function called on these actions tried call function manually on tab selection event didn't solve problem . below js code tab selection event: $('#diveamountdismountgridstabs, #currentspec').tabs( { select: function(event, ui) { // stuff here var tempdismount = $('#tbldismountatt').datatable(); tempdismount.draw(false); var tempcurrentspec = $('#tblcurrentspec...

java - How to store and mark all mouse-clicked-point on an Image loaded in JPanel? -

up till have used code given below load image in new new jframe , coordinates of pixels of image hard-coded in code itself. however, wish dynamically i.e mark points clicked mouse , store coordinates in array or so. the code running properly, image chosen using jfilechooser in class , path passed parameter class. please me out. public class graphicsset extends jframe{ font f ; bufferedimage baseimage ; file file ; string gimage; jframe imageframe; public graphicsset(string image) { super("frame") ; // imageframe = new jframe("click on select points"); file = new file(image) ; gimage = image; try { baseimage = imageio.read(file) ; } catch(ioexception e) { system.out.println(e) ; } int imagewidth = baseimage.getwidth(); int imageheight = baseimage.getheight(); system.out.println(imagewidth); setbounds(0,0,imagewidth,imageheight) ; setvisible(true) ; //setdefaultcloseo...

Error when creating linked server in SQL Server 2008R2 -

when create linked server in sql server, causes error cannot create instance of oledb provider sqlncli10 linked server 'linked server name '(microsoft sql server error 7302) how can rectify error? the oledb provider may not installed. chose sql server native client. have ssms installed on server? should come sql native client ole db.

python - JSON Object parsing: Loop through dynamic data -

i have json object follows: {u'2015-05-11': 2, u'2015-05-04': 1} here dates can vary, i.e., can query multiple dates. i want extract numbers in object , add them. in example want extract 2 , 1 , them result 3 . another example: {u'2015-05-11': 6, u'2015-05-04': 0} here answer 6 + 0 = 6 . another example of json object multiple dates: {u'2015-04-27': 0, u'2015-05-11': 2, u'2015-05-04': 1} here answer be: 0 + 2 + 1 = 3 i want loop through json object , extract numbers. i've read answers provided here , here . problem the, json object have not have fixed key can query. how go this? these python dicts, not json objects. since don't seem care keys @ all, can values , sum them: result = sum(data.values())

css - asp.net navigation menu style not correct when page loads -

i have asp.net navigation menu on page. when page loads style doesn't seem applied second. become okay in second. solution issue ? <asp:menu id="navigationmenu" runat="server" cssclass="menu" enableviewstate="false" includestyleblock="false" orientation="horizontal" skiplinktext=""> <items> <asp:menuitem navigateurl="~/main.aspx" text="home" value="public-item"> </asp:menuitem> <asp:menuitem navigateurl="~/about.aspx" text="about" value="public-item"> </asp:menuitem> </items> <staticselectedstyle backcolor="#9999ff" /> </asp:menu> put css style sheet towards top of html document. if not in style sheet, make (and add @ top). problem caused page content loading before styles loaded.

javascript - JS Accordion open first tab by default -

i want open first tab default on accordion. have been trying different solutions, nothing worked me. here js , html: $('.accordion').each(function () { var $accordian = $(this); $accordian.find('.accordion-head').on('click', function () { $(this).parent().find(".accordion-head").removeclass('open close'); $(this).removeclass('open').addclass('close'); $accordian.find('.accordion-body').slideup(); if (!$(this).next().is(':visible')) { $(this).removeclass('close').addclass('open'); $(this).next().slidedown(); } }); }); <div class="accordion"> <div class="accordion-head"> title here <div class="arrow down"></div> </div> <div class="accordion-body"> copy goes...

jquery - how to get length of 2d array in javascript and show data in dynamic div created from js -

what need i need show count on icon . i need make dynamic div input using array using javascript. array structure array ( [0] => array ( [id] => 50615 [des] => pharma pro&pack expo 2015 organized ipmma , held @ mumbai, economic capital of india. show helps exhibitors ove [membership] => 0 [name] => pharma pro&pack expo [abbr_name] => pharma pro&pack expo [paid] => 0 [event_wrapper] => 33587 [event_samll_wrapper] => http://im.gifbt.com/industry/27-350x210.jpg [event_url] => pharma-propack-expo [website] => http://www.pharmapropack.com [eventtype] => 1 [venue_name] => bombay convention & exhibition centre (bcec) [startdate] => 2015-05-13 [enddate] => ...

php - How to use database for mail settings in Laravel -

i'd keep users away editing configuration files, i've made web interface in admin panel setting mail server, username, password, port, encryption.. working in laravel 4.2, when app has been rewritten laravel 5, error occurs: class 'settings' not found in <b>f:\htdocs\app\config\mail.php</b> on line <b>18</b><br /> for purpose i've created service provider, made facade, put them in config/app.php, settings::get('var')/settings::set('var') work perfectly, not mail settings. config/mail.php: <?php return array( 'driver' => settings::get('mail_driver'), 'host' => settings::get('mail_host'), 'port' => settings::get('mail_port'), 'from' => array('address' => settings::get('mail_from_address'), 'name' => settings::get('mail_from_name')), 'enc...

javascript - call java script function on page load in asp.net using c# -

i wants call java script function on page load in asp.net using c#, code is, asp.net code: <%@ page language="c#" autoeventwireup="true" codebehind="lat_log_record.aspx.cs" inherits="lat_log.lat_log_record" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body onload="getloc();"> <form id="form1" runat="server"> <script src="http://maps.google.com/maps/api/js?sensor=false"> </script> <script type="text/javascript"> function getloc() { if (navigator.geolocation) { navigator.geolocation.getcurrentposition(function(position) { var latitude = position.coords.latitude; var longitude = position.coords.longitude; do...

templatetags - Django template tags with same name -

for example have 2 templatetags app1 templatetags app1_tags.py def custom_tag() app2 templatetags app2_tags.py def custom_tag() if load in template both templatetags {% load app1_tags %} {% load app2_tags %} i have 2 tags name custom_tag . how can use them in template? must rename them? i know not best solution depending on needs can helpful. this only works if apps made or if overwrite template tags this option give different names each tag: app1_tags.py @register.filter(name='custom1') def custom_tag(): # code app2_tags.py @register.filter(name='custom2') def custom_tag(): # code usually if register tag without telling name, django use function filter name, if passes arg 'name' when registering filter, django use templatetag name. django: custom template tag if give them different names when register tag, name use load tags {% load custom1 %} {...

ruby on rails - How to load precompiled images using jquery? -

in rails application changed navbar icons using jquery, when images precompiled image name 'nav1_completed-0d81e4b2c254459e456870960fa480c2.png', how load image using jquery? $('#nav1').find('img').attr('src', "/assets/nav1_completed.png"); when load above function doesn't load image since names different, how load images using jquery? you can try below check if image name starts nav1 $('#nav1').find("img[name^='nav1']").attr('src', "/assets/nav1_completed.png");

c# - LINQ to Entities does not recognize the method 'System.String ToString(Int32)' -

hi using linq query throwing error linq entities not recognize method 'system.string tostring(int32)' method, , method cannot translated store expression. list<string> resultmap = (from item in mapresult select convert.tostring(item.resultde)).tolist(); error throwing in below statement list<result_de> resultlist = (from result in db.result_de result.isactive == "1" && resultmap.contains(convert.tostring(convert.toint32(result.id))) select result).tolist(); please tell me proper way of writing query. you cannot use these conversion functions in linq entities statement, cannot translated sql, need conversions in memory. don't think need @ all. if using resultmap resultlist , filtered results of id present in mapresult , following: var resultlist = db.result...

ruby - Undefined method bson_type for model in Rails and MongoId -

i'm having issues mongoid when adding elements embeds_many relation: undefined method bson_type #<discount:0x007f3c599747e8> in advance. here code: class discount include mongoid::document embedded_in :discountable, polymorphic: true end class user include mongoid::document embeds_many :discounts, as: :discountable field :client_ids, type: array end class userscontroller < applicationcontroller def review ... current_user.push discounts: like_discount current_user.push client_ids: params[:client_id] ... end end i have tried approach without success; (works embeds_many not normal array). class userscontroller < applicationcontroller def review ... current_user.discounts.push like_discount current_user.client_ids.push params[:client_id] ... end end

R - A column from multiple tables needs to be changed from factor to character -

i have vector c("d1","d2","d3") in d1, d2,d3 data tables. each of them has column called id factor variable. need convert id columns factor character in d1,d2,d3 tables. i have tried following: d<-c("d1","d2","d3") #[1] invisible(lapply(d,function(x){get(x)[["id"]]<-as.character(get(x)[["id"]])})) #[2] invisible(lapply(d,function(x){get(x)[,list(id)] <- as.character(get(x)[,list(id)])})) please note don't want convert other factor columns d1,d2,d3 character columns except id. any appreciated here's approach can try. uses list2env (which many people wisely recommend against) replace objects in .globalenv . the approach work data.frame s , data.table s, though better use different approach if using data.table s. d1 <- d2 <- d3 <- data.frame(id = c("a", "b"), num = 1:2) library(data.table) d3 <- as.data.table(d1)[, id := fa...

Haskell Sieve of Eratosthenes with list of composites -

i have implement classic problem of sieve of eratosthenes in haskell project. rather computing each prime have compare numbers between lists. instance pass list of potential primes (parameter 1) , list of composites (list 2). sieve [2..10] [] results list [2,3,5,7] . i think close , compiles, appends every item prime list rather throwing out composites. thinking take list x of numbers 2..10 or whatever , list y of composites use elem see if head of list x found in list y , if append list z , print. in advance! currently code returns in first list , refuses sort. sieve [2..10] [] results in [2,3,4,5,6,7,8,9,10] sieve ::[int]->[int]->[int] z = [] sieve [] [] = [] sieve x [] = x sieve [] y = y sieve xs ys = if ((elem (head xs)) ys) (sieve (tail xs) ys) else ((head xs):z) what call sieve called minus , subtracting second list first, assuming both ordered, increasing lists of numbers. enough compare 2 head elements, without elem calls. but still work, h...

python - Django with text editor -

so, i'm going through django tutorial01 off website, , i'm stuck stupidest thing there is: don't know how 'connect' text editor code i'm working with. realize that, resemble command line, should using python's idle (or mistaken?). is, of course, more convenient typing first django project in command prompt... can tell me what-to-open-with-what work? :) ... obliged. solution: code snippets written in separated boxes header. in it, path , file name displayed. open file in text editor. my personal best python/django ide far pycharm. https://www.jetbrains.com/pycharm/ note: professional version supports django.

r - shiny The application unexpectedly exited -

i made shiny application on local machine working. face pop-up error message "the application unexpectedly exited. diagnostic information has been dumped javascript error console." when deployed app on server shiny-server. i checked javascript error console. nothing special message. normal message like, listening on http://127.0.0.1:46683 loading required package: dbi attaching package: ‘dplyr’ following object masked ‘package:stats’: filter following objects masked ‘package:base’: intersect, setdiff, setequal, union i tried edit solve problem. found 'observe()' , 'updateselectinput()' function may cause error. error pop-up appears when server.r has observe({ vars <- input$input1 * 1:100 updateselectinput(session = hoge, inputid = "input2", choices = vars, selected = vars[1]) }) the pop-up error not appear when function not in server.r is bug of shiny-server? if not, how can avoid pop-up error message? if have solution problem,...

java - Deprecated methods in Android Studio (AS) 1.1.0 (and Eclipse Luna) "Settings Activity" -

Image
my app have couple of checkboxes i'd rather user didn't have re-check each time app chased memory. i've been reading preferences. i'm not sure i've seen complicated "a modern fragment-based preferenceactivity", looking guidance/example 1.1.0, got code total of 9 references in 4 hunks of code addpreferencesfromresource , getpreferencescreen , , findpreference , of carry blurb: this method deprecated in api level 11. function not relevant modern fragment-based preferenceactivity. to have code presented deprecated code 2 ides 1 thing; there's no indication of each method has been replaced (but there's nothing replacing it, happens). would hard produce "a modern fragment-based preferenceactivity"? if so, guess i'm right complexity. am missing something? supposed write/extend deprecated code? turn off compiler checking of deprecated stuff? does know of nice tutorial (or example of) simple (like 2 checkboxes) "modern fr...

java - Wait for a thread to finish before continuing the current thread? -

so have in method: runnable task = new postloadrunnable(tool, archive); swingutilities.invokelater(task); but want make current method not continue until task thread has completed. want join() can't work out how it. task.join() , thread.task.join() doesn't work , thread.currentthread().join() doesn't give me options join thread want. how stop method until task finished? you don't want @ all. state in comments code runs in event dispatcher thread. must not block thread. otherwise freeze entire ui , user unhappy. what probably should disable relevant parts of ui until task has completed. without knowing actual wider requirement isn't possible sure.

Laravel 5 Eloquent, double one-to-one save (get Id before save) -

$profile = new profile; $user = new user; $user['profile_id'] = $profile['id']; $profile['user_id'] = $user['id']; $profile->save(); $user->save(); so have relationships setup using "hasone" in both models files. these not null foreign keys need define id relationship immediately. ['id'] not available until after save. how can these 2 save operations @ same time? you should have foreign key in 1 of tables, , define other relationship belongsto edit if keep user_id in profiles table, add user model public function profile() { return $this->hasone('app\profile'); } then can this $user = new user; $user->save(); $user->profile()->save(new profile());

python - How to compare two versions of same file (old and new), and detect if there were some changes? -

i new @ both, python , stackoverflow, please have on mind. tried myself , manage it, works if hardcode hash number of previous version 1 in hash1, , compare hash number of version. wolud program every time save hash number of version , every run compare newer version, , if file changed something. this code import hashlib hash1 = '3379b3b9b9c82650831db2aba0cf4e99' hasher = hashlib.md5() open('word.txt', 'rb') afile: buf = afile.read() hasher.update(buf) hash2 = hasher.hexdigest() if hash1 == hash2: print('same version') else print('diffrent version') just save hash file file.txt , when need compare hash read file.txt , compare 2 strings. here example of how read , write files in python. http://www.pythonforbeginners.com/files/reading-and-writing-files-in-python

How can I improve the response time on my query when using ibatis/spring/mysql? -

i have database 2 tables, must run simple query ` select * tablea,tableb tablea.user = tableb.user , tablea.email "%user_input%" where user_input part of string of tablea.email has match. the problem: the table carry 10 million registers , taking while, cache of ibatis (as far know) used if previous query looks same. example: user_input = john_doe if second query john_doe again cache willt work, if john_do not work(that is, said, far know). current, tablea structure this: id int(11) not_null auto_increment email varchar(255)not_null many more fields... i dont know if email , varchar of 255 might long , take longer time because of that, if decrease 150 characters example, response time shorter? right query taking long... know upgrade more memory servers know if there other way improve code. tablea , tableb have 30 fields each , related id on relational schema. im going create index tablea.email. ideas? i'd recommend run...

java - OnClickListener will not detect click on rectangle? -

i have 2 rectangles each rectangle taking half of screen , trying detect clicks on rectangles. what tried: i tried set onclicklistener on both rectangles when click either rectangle click not detected. sure wasn't detecting click logged inside listeners , confirmed suspicions; listeners weren't being entered , therefore no click being detected. here declare listeners in activity: toprectangle = new rectangle(this, 0, 0, mscrwidth, mscrheight/2, 0xc757ff57); bottomrectangle = new rectangle(this,0, mscrheight /2, mscrwidth, mscrheight, 0xdeff5845 ); mainview.addview(mline); mline.invalidate(); mainview.addview(toprectangle); toprectangle.invalidate(); mainview.addview(bottomrectangle); bottomrectangle.invalidate(); view.onclicklistener toplistener = new view.onclicklistener() { @override public void onclick(view v) { if (toprectangle.getcolor() == 0xc757ff57 /*green*/) { if (!isgamestarte...

javascript - Loop through all the elements of select and add a blank option if the either of the items is null -

i have 2 drop downs select1 , select2. select item1 of select1 , click ok button ( case in need help) then if selectedindex 0 ( ie first option )then loop through items of both drop downs. if same index elements ( eg 3rd element of both drop downs)are not null execute code , if either of them null execute other code, how can achieve this? <select name="select1" id="select1" multiple size="10"> <option>1<option> <option>null<option> <option>null<option> <option>2<option> <option>3<option> </select> <select name="select2" id="select2" multiple size="10"> <option>4<option> <option>5<option> <option>6<option> <option>null<option> <option>10<option> </select> i tried code fiddle become unresponsive. http://jsfiddle.net/678hmujh/13/ ...

asp.net mvc - How do I validate only certain strings in C# MVC? -

how validate string in c#? example if have 4 colors red, blue, green , black wants user enter these colors. if user enters other color such white than, code throws error " how use in model validation in mvc c#? for example: model: public int id {get; set;} public string color {get; set;} controller: [httppost] public actionresult create( [bind(include = "id, color")] tblcolor mycolor) { try { if (modelstate.isvalid && modelstate != modelstate) if(mycolor == red, green, blue, black) { db.projects.add(mycolor); db.savechanges(); return redirecttoaction("index"); } else { // error == "you allow insert 1 of red, blue, green, black"; } } } catch (exception) { // error message } return view(mycolor); } i recommend usi...

angularjs - Properly clear and send input inside each loop in Protractor -

so i'm running issue i'm trying loop through of input fields on page, clear input them, , update them value. here's essential code: element.all(by.model('part.quantity')).each(function(part_q){ part_q.clear().then(function(){ part_q.sendkeys("1"); }); }).then(function(){ ... } this issue varies in scope (i don't mean angular kind), have 7 <input ng-model='part.quantity'> 's on page i'm testing. when run test code above goes through each input , clears of them , updates them value 1, except first 2 input fields. in first 2 fields clears value, adds 1 twice. have these values before running test: <input ng-model='part.quantity' value="4"> <input ng-model='part.quantity' value="4"> <input ng-model='part.quantity' value="4"> <input ng-model='part.quantity' value="4"> <input ng-model='part.quantity...