Posts

Showing posts from April, 2014

postgresql - PG_restore. What does it do? -

i read these docs: description pg_restore utility restoring postgresql database archive created pg_dump in 1 of non-plain-text formats. issue commands necessary reconstruct database state in @ time saved. archive files allow pg_restore selective restored, or reorder items prior being restored. archive files designed portable across architectures. pg_restore can operate in 2 modes. if database name specified, pg_restore connects database , restores archive contents directly database. otherwise, script containing sql commands necessary rebuild database created , written file or standard output. script output equivalent plain text output format of pg_dump. of options controlling output therefore analogous pg_dump options. obviously, pg_restore cannot restore information not present in archive file. instance, if archive made using "dump data insert commands" option, pg_restore not able load data using copy statements. bu

ruby on rails - rack::proxy does not work to specific path -

got stuck not sure happening. if not specify path , run perform request works fine. def perform_request(env) env["http_host"] = "node:8765" super(env) end however when want proxy if match path not work. def perform_request(env) request = rack::request.new(env) if request.path =~ %r{^/api/check} #puts "weird!!!!!" env["http_host"] = "node:8765" super(env) else @app.call(env) end end configured middleware(config/application.rb): config.middleware.use nproxy, {ssl_verify_none: true}

Routing Issues in React-Redux -

i'm new react-redux ecosystem, learning trying out simple applications. in case i'm trying out how routing works in react-redux application. basically, idea : navigate new page clicking link( react-router component) navigate new page upon successful completion of dispatched async action. here's code import react 'react' import {link} 'react-router' import {routeractions} 'react-router-redux' import {connect} 'react-redux' class app extends react.component { render() { // , have access selected fields of state too! return ( <div> <header> links: {' '} <link to="/">home</link> {' '} <link to="/foo">foo</link> {' '} <link to="/bar">bar</link> </header>

javascript - Knockout foreach binding not rendering anything -

i have, thought straightforward knockout situation. have model comes in webapi has array of things success element. need value of success determine of properties render. i've validated data coming down webapi ok nothing table shell renders. there no errors in dev console. the html <div id="model1wrapper"> <table class = "table"> <thead > <tr > <th >stuff</th><th>things</th> </tr> </thead> <tbody data-bind = "foreach: $data.historyarray" > <!--ko if: success --> <tr class = "success" > <td data-bind = "text: $data.thinga" > </td> <td data-bind = "text: thingb" > </td> </tr> <!-- /ko --> <!--ko ifnot: success --> <tr class = "danger" > <td colspan="

angularjs - Angular JS - Sending data from a directive to a parent controller -

i have app use ngcart directive in order store items added basket. problem directive has functionality of sending information items added user, need send information form. so in order send in single object, need first extract data stored in directive main scope, , merge data form. for need modify ngcart.js directive. tried make service, adviced here , don't get working. code added directive this .service('ngcartdata', ['ngcart', function(ngcart){ return { data:ngcart; }; }]) , error saying module 'ngcart' not available! i'm totally new services , factories in angular, don't know make work. made plunkr code (i tried modifying ngcart.js file code above, plunkr shows directive without modification). need able send data stored in directive in scope ngcart can listen in parent controller (see checkout section in plunkr). any appreciated. thanks! you had right idea in mind, , i'm surprised didn't work

Javascript Create Json -

i'm trying create , post json message in following format: var listobjects = []; $.each(results, function(index, value){ var item = new object(); item.title = value.title; item.code = value.code; listobjects.push(item); }); var jsonresult = json.stringify(listobjects); basically create json this: [{"title":"product 1","code":123456789012}, {"title":"product 2","code":123456789012}, {"title":"product 3","code":123456789012}, {"title":"product 4","code":123456789012}, {"title":"product 5","code":123456789012}, {"title":"product 11","code":123456789012}, {"title":"product 12","code":123456789012}, {"title":"product 13","code":123456789012}] how can if want add metadata json not repeat each item @ top ... this: category: x type:

c++ - custom painting over QGraphicsView -

i want put text information scene on qgraphicsview . so i've inherited qgraphicsview i've overrided paintevent , drawings there. it seemd fine i've realized drawings being updated when there item moving near them. comes mind there clipping, cannot find set , how can obey it. my painting routine: void objectsview::paintevent(qpaintevent* event) { qgraphicsview::paintevent(event); const int fps = m_controller->fps(); const qstring info = qstring(tr("information simulation: fps: %1")) .arg(fps); qpainter painter(viewport()); const qrect inforect = painter.boundingrect(qrect(), 0, info); painter.setpen(qt::black); painter.drawtext(inforect.bottomleft(), info); painter.drawline(qpoint(), viewport()->rect().bottomright()); }

xml - export multiple (nested) layers of inkscape svg via xslt -

i want export multiple layrs inkscape svg. the structure this: like: background layera layer1 layer2 layerb layer3 layer4 and there more (sub) groups, because imported other svg objects had svg:g nodes. i want export 1 png background , layera (including sublayers) , 1 png background , layer3 (including sublayers) . i tried way described here: http://daniel-albuschat.blogspot.de/2013/03/export-layers-from-svg-files-to-png.html (second example) <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:svg="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" > <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xs

directory - How to checkout a folder from git using a chef recipe -

i trying setup continuous integration git, chef on aws-opworks. to checkout particular folder in git node "node_path" . can use destination: tag destination directory cannot find out how specify source directory in git. node_path = "/my/home/myprj/node" git node_path repository "https://something.com/myco/myprj.git" reference "prod" action :sync destination : node_path end here destination folder node symbolic link. can git check out folder, identify modified code pieces , copy new files over. want done automatically action :sync - how can done? references have used are: https://docs.chef.io/resource_git.html https://github.com/aws/opsworks-cookbooks/ http://docs.aws.amazon.com/opsworks/latest/userguide/cookbooks-101-basics.html you use git resource , link resource: git '/srv/myprj' repository 'https://something.com/myco/myprj.git' branch 'prod' end link '/my/ho

google maps - Xpath for getting latitude and longitude -

i confused on how latitude , longitude values under "location" @ this url using 2 separate xpath's. i using extract these 2 values coordinates of given zip code. coords.csv file empty when run "scrapy crawl latlng -o coords.csv -t csv" xpath or method have yielding coords must not correct here code: use googlemaps api find location given zip , extract latitude(lat) & longitude(lng) 'latlng' spider zipcode = raw_input('zipcode: ') latlngurl = 'http://maps.googleapis.com/maps/api/geocode/json?address=%s' % (zipcode,) latitude = 35 longitude = -79 class coordinates(scrapy.item): latitude = scrapy.field() longitude = scrapy.field() class latlngspider(scrapy.spider): name = "latlng" allowed_domains = ["googleapis.com"] start_urls = ( latlngurl, ) def parse(self, response): latitude = response.xpath('/geocoderesponse/result/geometry/location/lng').extract()

ios - How to get the current animation step from a CAKeyframeAnimation -

i'm creating small button 2 different states. every state represented 2 cashapelayer s , transition between states animated series of cakeyframeanimation s/ cabasicanimation s, change path property of shape layers. question how animate state starting current animation (i.e. button pressed while animating). normally, ask presentation layer current property value , use additive animation (as described here ), since multi-step animation have figure out step animating , chain appropriate animation reverse previous state. rather tricky (i wanted have animation removeoncompletion=false , query time offset of animations figure out animation active , how far). unfortunately, setting layer speed 0.0 , animating timeoffset , forth doesn't work either, since have secondary animations behave differently in opposite direction. using custom layer property shape layers seems cumbersome, match progress property more current animation step. so after trial , error come follo

outlook - List up-coming events from my Calendar in Office 365 -

this scenario: i'm in corporate intranet sharepoint site in home page. i want see up-coming events outlook calendar. the big question is: if logged in office 365 account, need special authentication/authorization show data using javascript? you can create calls using outlook calendar rest api reference , , authentication/authorization can have middleware hosted sharepoint app hanldes security constraints before calling these apis.

AWK split string then deliminate it as well -

need splitting below. 100gb@sdb,100gb@sdc into this sdb sdc everything i've tried keeps giving me sdb 100gb for arbitrary number of disks, try: $ echo '100gb@sdb,100gb@sdc,10kb@sdd' | awk -f'[@,]' '{for (i=2;i<=nf;i+=2) printf "%s ",$i; print ""}' sdb sdc sdd answers original question using awk $ echo '100gb@sdb,100gb@sdc' | awk -f'[@,]' '{print $2,$4}' sdb sdc using sed $ echo '100gb@sdb,100gb@sdc' | sed 's/^[^@]*@//; s/,[^@]*@/ /' sdb sdc using bash $ s='100gb@sdb,100gb@sdc'; s=${s#*@}; echo ${s/,*@/ } sdb sdc

perl - In newer Getopt::Long How do I set default optional values -

in perl's getopt::long version 2.39 use use getopt::long qw( :config gnu_getopt ); getoptions( \my %opts, "codon-view|c:20", # optional value, default 20 "consensus|c:50", ... ) to indicate if use -c default value 20 put in %opts under key codon-view when -c given no explicit value there. on other hand -c or --codon-view not supplied, no value in hash table stored in %opts . in 2.48 no longer works , don't see in getopt::long's documentation $ perl -e' use getopt::long qw( :config gnu_getopt ); $getopt::long::version; getoptions(\my %opts, "codon-view|c:20"); $opts{"codon-view"} // "[undef]" ' -- -c 2.39 20 $ perl -e' use getopt::long qw( :config gnu_getopt ); $getopt::long::version; getoptions(\my %opts, "codon-view|c:20"); $opts{"codon-view"} // "[undef]" ' -- -c 2.48 [undef] how can achieve old behavior? help!

python - Please explain this early termination of multiprocess.Process subclass? -

i have following test code subclassing process multiprocessing : import multiprocessing mp class testprocess(mp.process): def __init__(self,name): super().__init__() self.name = name def run(self): while true: print('{} says "i alive"'.format(self.name)) if __name__ == "__main__" : procs = [testprocess(i) in list('abc')] try: p in procs: print('starting {}'.format(p.name)) p.start() except keyboardinterrupt: print('caught interrupt') except exception e: print(str(e)) finally: p in procs: print('stopping {}'.format(p.name)) p.terminate() for reason terminates without ever sending ctrl + c , process b , c never seem run: host:~ user$ python process_example.py starting starting b starting c says "i alive" [... x 16 lines] says "i ali

mysql - SQL needed to get a subset of locations based on lat/long with a min/max distance constraint -

i have mysql table 500 location records has similar structure to: id, name, lat, long lat & long decimal (float) location values. my need return random 100 record set minimum 200 meters , maximum 500 meters away each other. i'm familiar using great circle formula distance between 2 points. however, have no idea how write select statement compare locations against each other ensure distance requirements random 100 selected? thoughts or appreciated. tools mysql database solution needs written in mysql sql. thank in advance. select * ( select p.latitude1 latitude1, p.longitude1 longitude1, p.latitude2 latitude2, p.longitude2 longitude2, (((acos(sin((latitude2*pi()/180)) * sin((latitude1*pi()/180))+cos((latitude2*pi()/180)) * cos((latitude1*pi()/180)) * cos(((longitude2- longitude1)* pi()/180))))*180/pi())*60*1.1515) distance places p ) distance > 200 , distance < 500 order rand() limit 100

ANDROID: starting activity with button click; the button has a background; excess memory issue -

Image
i think have been able resolve main problem - folks help however, getting following warning / error messages in logcat: 06-03 10:52:25.420 7149-7149/xxx e/dalvikvm: not find class 'android.util.arraymap', referenced method com.android.tools.fd.runtime.monkeypatcher.monkeypatchexistingresources 06-03 10:52:25.420 7149-7149/xxx w/dalvikvm: vfy: unable resolve check-cast 1832 (landroid/util/arraymap;) in lcom/android/tools/fd/runtime/monkeypatcher; 06-03 10:52:25.420 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x1f @ 0x0258 06-03 10:52:25.420 7149-7149/xxx e/dalvikvm: not find class 'android.util.arraymap', referenced method com.android.tools.fd.runtime.monkeypatcher.pruneresourcecache 06-03 10:52:25.420 7149-7149/xxx w/dalvikvm: vfy: unable resolve const-class 1832 (landroid/util/arraymap;) in lcom/android/tools/fd/runtime/monkeypatcher; 06-03 10:52:25.420 7149-7149/xxx d/dalvikvm: vfy: replacing opcode 0x1c @ 0x0058 06-03 10:52:25.435 7149-7149/xxx i

python - NTILE for Sqlite from Pandas gives OPERATIONAL ERROR -

i'm trying use ntile function querying sqlite database pandas, haven't succeeded, though i've rechecked syntax many times. self-contained example below. setup: import pandas pd sqlalchemy import create_engine disk_engine = create_engine('sqlite:///test.db') marks = pd.dataframe({'studentid': ['s1', 's2', 's3', 's4', 's5'], 'marks': [75, 83, 91, 83, 93]}) marks.to_sql('marks_sql', disk_engine, if_exists='replace') now try use ntile: q = """select studentid, marks, ntile(2) on (order marks desc) groupexample marks_sql""" pd.read_sql_query(q, disk_engine) the traceback long, it's main parts are: operationalerror: near "(": syntax error operationalerror: (sqlite3.operationalerror) near "(": syntax error [sql: 'select studentid, marks, ntile(2) on (order marks desc)\n groupexample marks_sql

Why doesn't C++ find template function? -

why compile error no matching function call `f( __gnu_cxx::__normal_iterator > >)' ? #include <vector> template<typename t> void f(const typename std::vector<t>::iterator &) {} void g() { std::vector<int> v; f<int>(v.end()); // compiles. f(v.end()); // doesn't compile, gcc 4.3 can't find match. } ultimately want write function takes vector iterator, , fails compile (with meaningful error) else. template<typename t>void f(const t&) {} not solution, because compiles other types well. g++ 4.8 gives more complete message: http://ideone.com/ekn3xs note: template argument deduction/substitution failed: note: couldn't deduce template parameter ‘t’ f doesn't directly takes t (like in " const t& ") or type t clear (like in " const std::vector<t>& ") nested dependent type (here std::vector<t>::iterator ) template type t cannot automatically deduced

how to create code shortcuts in adobe brackets -

does know how create quick code shortcut in brackets? e.g. if in javascript, if type "f" , hit tab, editor writes code "function(){}". intellij has called live templates. wonder if exists brackets. thanks!! use extension manager , select available panel in dialog. type "snippet" in search box , install brackets snippets (by edc). come many predefined snippets allow create own in simple syntax.

r - adding rows to data.frame conditionally -

i have big data.frame of flowers , fruits in plant 30 years survey. want add zeros (0) in rows represent individuals in specific months plant did not have flowers or fruits (because seasonal species). example: year month flowers fruits 2004 6 25 2 2004 7 48 4 2005 7 20 1 2005 8 16 1 i want add months not included values of 0 thinking in function recognize missing months , fill them 0. thanks. ## x data frame gave in question x <- data.frame( year = c(2004, 2004, 2005, 2005), month = c(6, 7, 7, 8), flowers = c(25, 48, 20, 16), fruits = c(2, 4, 1, 1) ) ## y data frame provide missing values, ## can replace 2004 , 2005 whatever desired ## time interval y <- expand.grid(year = 2004:2005, month = 1:12) ## final step fills in missing dates , replaces na's zeros library(tidyr) x <- merge(x, y, = true) %>% replace_na(list(flowers = 0, fruits = 0)) ## if don't want use tidyr, can alternatively x

install - Setup service did not respond to the start or control request in a timely fashion error when installing SQL Server 2016 -

how can resolve error received when installing microsoft sql server 2016? title: microsoft sql server 2016 setup service did not respond start or control request in timely fashion the following error has occurred: the service did not respond start or control request in timely fashion. click 'retry' retry failed action, or click 'cancel' cancel action , continue setup. for help, click: http://go.microsoft.com/fwlink?linkid=20476&prodname=microsoft%20sql%20server&evtsrc=setup.rll&evtid=50000&prodver=13.0.1601.5&evttype=0xdc112d1c%25400xdc80c325 buttons: &retry cancel check detail.txt setup log if during starting sql server launchpad service. if yes, : grant long on locally privilege mssqlserver01 mssqlserver20 users (alternatively can add them local administrator group - not recommended) start "sql server launchpad" service sql server configuration manager or services click retry on setup. setup continu

Linking to profile page by username on Ruby -

Image
what want able when clicks on picture see user uploaded pictures username , want them able click username , go persons profile page. here issue have working first post. have multiple users , posts show correct username each one. links fine. post after throws error , user id gets higher each post. this profile page posts know user posts these pics. , when click first picture , username correctly takes me here. now when click 2nd picture this. , if click 3rd pic couldn't find user "id"=2. though post recognizes posted pic having correct username. this code have on show posts <div class="panel-body"> <p><strong><%= link_to(@post.user.username.capitalize, user_path) if @post.user %></strong></p> <p><%= @post.description %></p> <% if @post.user == current_user %> <%= link_to 'edit', edit_post_path(@post) %> <% end %> </div> again works fi

mysql - Update sql row without deleting data -

is possible such thing? update news set article_title="["+id+"]" + article_title; is possible process query every row in news table? want add id of article article title this: [1000] stackoverflow kind regards! yes is: update news set article_title=concat('[',id,'] ',article_title); you add trigger on table news update automatically. this: create trigger trg_news before insert on news each row begin new.article_title = concat('[',id,'] ', new.article_title); end; note trigger work on insert command. because update have parse article_title don't end like: [1] somename[1] somename

elasticsearch - Linux ELK server reading cloudtrail logs - troubleshooting issues -

have built elk server running on rhel 7.2 in aws. plan have ingest cloudtrail logs s3 bucket , magic @ kibana front end it's not working , i've lost days of life trying work out hence why i'm reaching out help. can see logstash.log it's reading files in s3 bucket that's it. nothing else appears happening. my setup: rhel 7.2 kibana-4.5.0-1.x86_64 logstash-2.3.2-1.noarch elasticsearch-2.3.3-1.noarch nginx-1.6.3-8.el7.x86_64 (reverse proxy kibana port 80) /etc/logstash/conf.d looks : -rw-r--r-- 1 root root 574 may 31 14:55 02-cloudtrail-input.conf -rw-r--r-- 1 root root 432 may 31 15:04 30-elasticsearch-output.conf root@elk conf.d]# cat * input { s3 bucket => "xyz..cloudtrail" access_key_id => 'xyz' secret_access_key => 'abc' delete => false codec => "cloudtrail" prefix => "cloudtrail/awslogs/xxxxx/cloudtrail/ap-southeast-2/2016/" t

javascript - How to reload and re-execute an ad network script? -

i'm posting first time after having read through many posts find seemed applicable. i'm amateur dev of found here on head. if have time , willingness @ problem i'd appreciate it. i have image gallery layout on site. each time user views new image in gallery want re-execute/re-load ad code on page. the ad code on page looks this: <div class="slide-ads row" id="slide-ads-2" style='width: 300px; margin: 0px auto;'> <div class="ad-tag" data-ad-name="rectangle2_newformat" data-ad-size="300x250" ></div> <script src="//tags-cdn.deployads.com/a/mindpause.co.js" async ></script> <script>(deployads = window.deployads || []).push({});</script> </div> on click update content , make call moveads function, causes ad code re-execute (and produce new ad impression) through jquery's detach , appendto functions. relevant code: $('.slide-next, .sl

javascript - Promise running both success and failure callbacks -

i have array of promises , it's running both pass , fail callbacks. can't figure out why. checkforlists: function() { var listcheckpromise = []; $.each(scmap.lists, function(i, list) { listcheckpromise[i] = $().spservices({ operation: "getlist", listname: list.name, }) }) $.map(listcheckpromise, function(listpromise, index){ listpromise.then( pass(index), fail(index) ) }) function pass(index) { var currentlist = scmap.lists[index] console.log("pass:", currentlist.name, 'list created') } function fail(index) { var currentlist = scmap.lists[index] console.log("fail:", currentlist.name, 'does not exist. creating...') scmap.createlist(currentlist) } } " ... can't figure out why. " simple... because you're calling $.map(listcheckpromise, function(listpromise, index){ listpromise.th

oauth 2.0 - Where to enter Facebook login authorized redirect URI? -

Image
where enter facebook app's authorized redirect uri? in past under "product settings" "facebook login". "product settings" have changed "settings" , field authorized redirect uri gone. in developers.facebook.com dashboard app, in left column under products + add product . click , click facebook login . if you've added facebook login you'll see facebook login under products . now down page valid oauth redirect uris :

mysql + show tables and insert a row number for each table -

this command shows tables. mysql> show tables '%xyz%'; +------------------------------+ | tables_in_xyz (%xyz%) | +------------------------------+ | xyz2 | | xyz23 | | xyz23_linuxlineending | +------------------------------+ 3 rows in set (0.00 sec) what command there insert index number each table e.g. +----+------------------------------+ | id | tables_in_xyz (%xyz%) | +----+------------------------------+ | 1 | xyz2 | | 2 | xyz23 | | 3 | xyz23_linuxlineending | +----+------------------------------+ edit1 - close mysql> select (@rn := @rn + 1) id, table_name information_schema.tables table_name '%xyz%'; +------+-----------------------+ | id | table_name | +------+-----------------------+ | null | xyz2 | | null | xyz23 | | null | xyz23_linuxlineending | +------+-----------------------+

angularjs - Google AdSense ads in Angular 2 components? -

i'm trying load responsive ads in adcomponent in app. component dead simple: import { component } '@angular/core'; import { form_directives, core_directives } '@angular/common'; @component({ selector: 'ad', templateurl: 'app/views/ad.html', directives: [ form_directives, core_directives ] }) export class adcomponent {} ad.html : <div class="demo-card-wide mdl-card mdl-shadow--2dp ad-card"> <div class="mdl-card__supporting-text"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-0123456789" data-ad-slot="0123456789" data-ad-format="rectangle, horizontal"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </

Leading zeros are not adding to DataTable columns C# Asp.Net with PadLeft or String.Format -

leading zeros not adding datatable columns padleft or string.format. initially copied user uploaded excel data datatable. i'm trying add zeros in front of datatable column values if length less 8 digits , after have compare table matching records. if don't have leading zeros i'm missing records while matching other datatable columns. want them leading zeros can matched correct results. ex: have column "code" in datatable values 30500, 501080, 5020900, 19010300 etc , have results 00030500, 00501080, 05020900, 19010300 note: change data in datatable not in sql query retrieves data. i don't want code converting int string leading zeros . tried in way didn't fix issue. i tried couple of ways didn't solve. what's wrong code. it's not working. used below how add leading zeros in datatable columns still not changed anything. don't consider post duplicate, tried ways still problem exist, hence posting here. approach 1: foreach (d

mysql - How to count how many days passed from the beginning -

totally edit question. because guess first try unclear. have table 3 columns. need add new column , fill time passed begining || *station_id* || *counter* || *stop* || *time begining* || || 22500 || 0 || 16:15:00 || || || 22710 || 1 || 17:24:00 || || || 22790 || 2 || 18:10:00 || || || 22670 || 3 || 19:43:00 || || || 22800 || 4 || 21:42:00 || || || 22920 || 5 || 22:47:00 || || || 24050 || 6 || 00:53:00 || || || 24010 || 7 || 02:13:00 || || || 24280 || 8 || 02:30:00 || || || 24270 || 9 || 02:57:00 || || || 24250 || 10 || 03:45:00 || || || 24249 || 11 || 06:45:00 || || || 25270 || 12 || 08:06:00 || || || 1190 || 13 || 09:23:00 || || || 25230 || 14 || 10:43:00 || || || 25201 || 15 || 11:23:00 || || || 25215 || 16 || 11:54:00 || || || 24605 || 17 || 13:05:00 || || || 24577 || 18 || 13:44:00 || || || 24580 || 19 || 14:23:00 || || || 24583 || 20 || 15:09:00 || || || 24585 || 21 || 15:40:00 || || || 24610 || 22 || 16:40:00 || || || 24850 || 23 || 17:47:00 || || |

javascript - Private variables in the controller scope -

in angular, following demos, can define controller as: function todoctrl($scope) { $scope.todos = [ {text:'learn angular', done:true}, {text:'build angular app', done:false}, {text:'empty dishwasher', done:false}]; $scope.oldtodos = []; var oldtodos2 = []; ... you'll note have 2 oldtodos . 1 on $scope , 1 local var. think latter approach way go if want encapsulate variable - i.e. no-one other controller has interest in , former if want pass variable model am correct? it looks want keep private copy of oldtodos around in event have either refer them or resurrect 1 of them or something. in case, makes sense not put oldtodos scope. maxim said, scope relevant if want bind values view. if want save oldtodos keep reference them, normal variable fine. then, if want bring 1 of them back, copy $scope.todos , comes. note can abstract of todos service , inject service

ios - TableView scrolls beyond the last cell -

Image
i have 2 tableviews in viewcontroller , setup constraints both of them. have setup constraints , alignments. problem that, when starts, alignments work expected, when push tableview1 above (to come bottom), pushes last cell more (please check screenshots below). here video showing problem and behaviour of horizontal inspector last update: thought of workaround couldn't figure out how apply it. if can y position of last row inside tableview, maybe can force tableview not scroll below 'y position + row height'. there way can that? original question : it's working fine when starts , seems expected last row/cell's bottom attached bottom of tableview (red tableview1 , pink tableview2) but when scrolled , reached bottom, scrolls more bottom cell. instead bottom cell should attached bottom of tableview1. (blue tableview1's background color) what may problem? how can make bottom tableviewcell of tableview1 attach bottom of tableview1, doesn