you're welcome :) On Wed, Sep 5, 2012 at 4:10 PM, Alex Soto <[email protected]> wrote: > Nice, thanks Nic thanks a lot :) > > Alex > > El 05/09/2012, a las 09:24, Nic Wise <[email protected]> escribió: > >> Because, in sqlite-net (at least the version _I_ was using, which >> might be old), if I did (unchecked code!!): >> >> var items = from item in connection.Table<Transaction> where >> item.TransactionDate between X and Y select item; >> >> this would get all the items, then do the WHERE. So if I wanted 10 >> lines from this year, but I had 1000 from last year, it would load >> 1010 items, and return 10. >> >> Not good. I changed it to use connection.Query<Transaction>("select * >> from Transactions where TransactionDate between.... etc") and I got >> the 10 back I wanted, in <10ms not 1-2 seconds. >> >> Same goes for summary's (select sum(Price) from....). >> >> For small data sets, or where you usually want ALL of them, the linq >> option is fine. But for getting a subset of a large set, or to get an >> aggregate of a large set, not so much. >> >> Frank might have changed it since I did that tho, to make the WHERE >> affect the sql, not do it after the objects are hydrated. >> >> >> >> On Wed, Sep 5, 2012 at 2:33 PM, Alex Soto <[email protected]> wrote: >>> Hello Nic, something called my attention, why not to use LINQ?? >>> >>> Hope you can elaborate on it >>> >>> Alex >>> >>> >>> >>> El 05/09/2012, a las 04:32 a.m., Nic Wise <[email protected]> escribió: >>> >>>> Yes and no. >>>> >>>> Out of the box: no. HOWEVER, if you add 1000 items into the root, it's >>>> only making >>>> >>>> 5 + 3 + 3 (5 visible, 3 invisible above and below - basically: Visible >>>> + (50% of visible above) + (50% of visible below)) >>>> >>>> actual cells, the rest is just managed objects, so fairly small. I've >>>> loaded 3500 elements into a list without any problem (make sure you >>>> load it OFF the main thread, and if you use Sqlite-net, dont use linq >>>> - use a SQL statement!) >>>> >>>> The YES part: you can work out where the scroll is, and dynamically >>>> load things when you get near the bottom. This doesn't work out of the >>>> box - you would need to work out which cells are visible, and if it's >>>> close enough to the end, load some more at the bottom. >>>> >>>> The other option is the "LoadMoreElement". This is in the >>>> "OldElements" folder, so it might need some work, but this allows you >>>> to put a cell in, the user taps it, and you can do whatever - load X >>>> more is the usual case. >>>> >>>> https://github.com/migueldeicaza/MonoTouch.Dialog/blob/master/MonoTouch.Dialog/OldElements/LoadMoreElement.cs >>>> >>>> You could do the same tho - put a cell at the bottom, and if it's >>>> loaded (GetCell is called), then do the load in a background thread >>>> and insert the new cells above the "bottom" loader cell. >>>> >>>> Lots of ways :) >>>> >>>> N >>>> >>>> On Tue, Sep 4, 2012 at 8:32 PM, Guido Van Hoecke <[email protected]> wrote: >>>>> Hi Nic, >>>>> >>>>> Thanks for your answer. >>>>> >>>>> I should have phrased my question more precisely. Is it possible to not >>>>> instantiate all Elements and add them to the RootElement before the view >>>>> does appear, but rather create them as needed within a kind of >>>>> GetElement method? >>>>> >>>>> Guido >>>>> >>>>> On 4 September 2012 13:08, Nic Wise <[email protected]> wrote: >>>>>> Absolutely :) >>>>>> >>>>>> The default ones already do this >>>>>> >>>>>> https://github.com/migueldeicaza/MonoTouch.Dialog/blob/master/MonoTouch.Dialog/Elements.cs#L271 >>>>>> >>>>>> (and it's in other places too) >>>>>> >>>>>> IF you have made your own element, you are responsible for doing it, >>>>>> but you can, easily, do it. >>>>>> >>>>>> I suggest you split your GetCell into 2 parts: >>>>>> >>>>>> https://gist.github.com/3620212 >>>>>> >>>>>> If you set colors, dont forget to reset it for each one - otherwise >>>>>> you end up with red bits where you want green etc :) >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Tue, Sep 4, 2012 at 11:53 AM, Guido Van Hoecke <[email protected]> >>>>>> wrote: >>>>>>> Hi, >>>>>>> >>>>>>> My app happily uses the Monotouch.Dialog framework. >>>>>>> >>>>>>> Some of its dialogs list values from a database. Basically my approach >>>>>>> is to create a new DialogViewController and wait for the >>>>>>> ViewWillAppear event. >>>>>>> >>>>>>> The corresponding event handler creates a new RootElement and fully >>>>>>> populates it with an Element for each of the retrieved database rows. >>>>>>> >>>>>>> I realise that this would e.g. build 1k cells for 1k rows, so I >>>>>>> probably should dequeue reusable cells and only build the Elements as >>>>>>> requested by the GetCell method. >>>>>>> >>>>>>> Is this possible within the MT.D framework using RootElement, Section >>>>>>> and Element objects? >>>>>>> >>>>>>> Thanks in advance >>>>>>> >>>>>>> Guido >>>>>>> >>>>>>> -- >>>>>>> It is the nature of extreme self-lovers, as they will >>>>>>> set a house on fire, and it were but to roast their eggs. >>>>>>> -- Francis Bacon >>>>>>> >>>>>>> http://vanhoecke.org ... and go2 places! >>>>>>> _______________________________________________ >>>>>>> MonoTouch mailing list >>>>>>> [email protected] >>>>>>> http://lists.ximian.com/mailman/listinfo/monotouch >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Nic Wise >>>>>> t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise >>>>>> b. http://www.fastchicken.co.nz/ >>>>>> >>>>>> mobileAgent (for FreeAgent): get your accounts in your pocket. >>>>>> http://goo.gl/IuBU >>>>>> Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa >>>>>> Earnest: Self-employed? Track your business expenses and income. >>>>>> http://earnestapp.com >>>>>> Nearest Bus: find when the next bus is coming to your stop. >>>>>> http://goo.gl/Vcz1p >>>>>> London Bike App: Find the nearest Boris Bike, and get riding! >>>>>> http://goo.gl/Icp2 >>>> >>>> >>>> >>>> -- >>>> Nic Wise >>>> t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise >>>> b. http://www.fastchicken.co.nz/ >>>> >>>> mobileAgent (for FreeAgent): get your accounts in your pocket. >>>> http://goo.gl/IuBU >>>> Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa >>>> Earnest: Self-employed? Track your business expenses and income. >>>> http://earnestapp.com >>>> Nearest Bus: find when the next bus is coming to your stop. >>>> http://goo.gl/Vcz1p >>>> London Bike App: Find the nearest Boris Bike, and get riding! >>>> http://goo.gl/Icp2 >>>> _______________________________________________ >>>> MonoTouch mailing list >>>> [email protected] >>>> http://lists.ximian.com/mailman/listinfo/monotouch >> >> >> >> -- >> Nic Wise >> t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise >> b. http://www.fastchicken.co.nz/ >> >> mobileAgent (for FreeAgent): get your accounts in your pocket. >> http://goo.gl/IuBU >> Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa >> Earnest: Self-employed? Track your business expenses and income. >> http://earnestapp.com >> Nearest Bus: find when the next bus is coming to your stop. >> http://goo.gl/Vcz1p >> London Bike App: Find the nearest Boris Bike, and get riding! >> http://goo.gl/Icp2 >
-- Nic Wise t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise b. http://www.fastchicken.co.nz/ mobileAgent (for FreeAgent): get your accounts in your pocket. http://goo.gl/IuBU Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa Earnest: Self-employed? Track your business expenses and income. http://earnestapp.com Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2 _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
