Best way to loop through indexDb using ydn-db - ios

I'm using ydn-db as a shim for mobile dev but am experiencing some poor performance with IOS and record retrieval.
My question is, what is the best way to loop over a data store?
Right now I use
db.values() and set the limit to the number of items in the list ( usually about 200, but it has a hard limit at 100 )
Anyhow was just wondering what the best way to go about looping over the results might be.
I have read the docs, and while they are extensive they are also confusing, hence why I'm posting here.
Anyhow, any help would be appreciated.

The best way to loop through is db.open. It iterate one record at a time and very memory efficient.

Related

Is there a way to make this url work for all pages?

I was doing web scraper but then I got blocked for too much commands and someone said I should retriev the json itself with this url and try play with it :https://steamcommunity.com/market/search/render/?query=&start=1490&count=10&search_descriptions=0&sort_column=price&sort_dir=desc&appid=730&norender=1
and I changed it to this :https://steamcommunity.com/market/search/render/?query=&start=0&count=100&search_descriptions=0&appid=730&norender=1 but when I try to do more than 100 it doesn't give me more outputs is there a way to fix this? Btw Iam new to programing and stuff, so I dont know much.
Short answer: no.
These query parameters are most likely limited by Valve itself. Also, WebScraping / Crawling has the huge disadvantage that many or even most providers are actually blocking requests after a determined amount of requests / after a distinct use pattern whatsoever.
The only way to counteract this is to use an official API. By now, there's no such thing though.

Pure Data chord selection based on input MIDI note scale causes crash

I'm working on a patch in Pure Data which uses an 8 number scale to decide which chords can be played. E.g. if a chord uses a note that is not in the scale, re-roll. Obviously this isn't the most musical soultion as we usually expect accidentals and such, but here we are looking at a primitive method for procedural music. Here is the problem patch:
CreateChords patch
As soon as I attempt to use a new scale, pure data freezes and requires an immediate restart.
Any suggestions would be greatly appreciated.
Thanks,
Liam
It would be massively more efficient and easier to use an object like [coll] or [textfile] to store your chord patterns. Instead of having each pattern in a message object, which you then need to feed individually through all of the processing, you would just have one object, and feed your random number generator into it, which will then spit out the corresponding code. something like this
your patch reworked
there you have it. A spaghetti mess of wires and boxes reduced to 11 objects and 11 cables. There are several other ways to accomplish similar things, but this was the first to come to mind. If this one works for your purpose, cool, or else lemme know and I'll show you other ways.
Ah, yea, I suspected a stack overflow as the cause of the crash. It's easy to make that mistake with so many wires so close together, as it's hard to see what all has been connected or mis-connected. Accomplishing this idea using only vanilla objects is quite a bit more challenging, now that you mention it. Here's something that could possibly work.

Big SQLITE database in iOS

In my ios app I have got an sqlite database with more then 800.000 rows. More or less only text in the rows. At the moment my select statement needs more than a minute to perform. Is that normal or do I something wrong.
Is there any possibility to speed that task up?
My problem is, that I cant do it with a webservice or something else. It should be performed right on the iPad without any connection to the internet.
Any idea is highly appreciated.
It's difficult to offer advice in the abstract, but in general:
Measure. Find where and why there are bottle necks
Improve code / database scheme
Go to 1
The best tool for (1) is the "explain plan" feature of SQLite. This tells you how it's going to get your results. If it's taking over a minute I think you'll see lots of full table scans.
The answer for (2) depends on what you find on (1). You might be able to improve the query; you might need index(es).
Point (3) is important. Don't guess at what makes the best performance improvemets. Measure.

Ideal method for storing hierarchical data in HDF5

Hello Oracles of StackOverflow,
First time I managed to ask a question on stack overflow, so feel free to throw your cabbages at me. (or correct the way I should be asking my question)
I have this problem. I'm using HDF5 to store massive quantities of cookie information.
My Data is structured in the following way:
CookieID -> Event -> Key_value Pair
There are multiple events for each cookieID. But only one key_value pair per event.
I'd like to know what the best way I should store this in a HDF5.
Currently, I'm storing each cookie as a seperate table within a group in the HDF5, using the cookieID as the name of the table. Unfortunately for me, with 10,000,000 cookies, HDF5 (or specifically PyTables) doesn't approve of this type of storage.
Specifically throwing this error:
/CookieData`` is exceeding the recommended maximum number of children (16384)
I'm wondering if you could recommend the best way of storing this information.
Should I create a flat table? Should I keep this method? Is there something else I can do?
Help is appreciated. Thanks for reading.
Several hours of research later, I've discovered that what I was attempting to do was categorically impossible.
The following link gives details as to the impossibility of using HDF5 with variable-length nested children.
I've decided to go with a flat file for the time being and hope that this is more efficient than a database store. The problem with a flat file in the end is that I have to replicate values in the file, which otherwise should not exist.
If anyone else has any better ideas it would be appreciated.

Current road's speed limit

Is it possible to get the current speed limit of a road? I’m not sure if this would be done using the ‘Maps' app as I don’t think its holds speed limit data.
Is anyone able to point me in the right direction?
There is no functionality in MapKit for retrieving speed limits.
You may be able to get it by querying Google directly, or by querying some other third-party speed-limit database. However, it's probably unlikely that you'd find a service offering that kind of data for free.
Figure out where from where you going to get the data and then someone can likely help with how you'd retrieve it.
I have found an open data project that might be of help to you as well as many others:
http://en.wikipedia.org/wiki/Wikispeedia

Resources