Is there any good way how to estimate Realm file size on iOS and what is the highest safe Realm DB size? I am doing an app that gathers time series data and I am now elaborating which granularity to choose.
Let's say that I would like to keep following amount: Set of 15 doubles, saved each 5 seconds for 2 hours in a day, kept for 10 years.
This makes approx 15x(60/5)x60x2x365x10 = 78 mil. of double entries. I suppose this amount is too big to be stored in iPhone thus I should always keep data let's for 1 year max?
Let's check the math
You said
Set of 15 doubles, saved each 5 seconds for 2 hours in a day, kept for
10 years.
here's that in numbers
8 Bytes in a double * 15 doubles * 1440 samples per day (see below) * 3650 Days
= 630720000 Bytes
Now take 630720000 Bytes * 0.00000095367432 = 601Mb (in Binary) or 640Mb in Decimal
That could easily be done in Realm and on a phone. 650Mb is a lot less than a 64Gb phone can hold.
I am sure there is more overhead involved so the numbers may vary but it seems possible unless I missed something.
Samples Per Day = Two hours is 7200 seconds / 5 = 1440
Related
I am working on creating a spreadsheet template for a video observation tool that my organization will use. Specifically, we will watch ~20-minute long videos, and record the rate (occurrences per minute) of certain behaviors within subsections of the video. For example, "in the clip from 2:06 to 4:30, the speaker asked the audience an average of 2.5 questions per minute."
I think it would be easiest for users to denote individual clips by providing start and end times (e.g. Start: 22:40 End: 23:02). Users should be able to input a count of certain occurrences, and then the spreadsheet will divide that number by the time elapsed and calculate a rate per minute. That is to say, if the speaker asked 8 questions between the timestamps 22:40 and 24:20, the spreadsheet should return a value of 8/(1.67 minutes) = 4.8 questions per minute.
I'm having trouble figuring out a way to enter time values in Google Sheets without it treating them as actual times in a 24-hour day. For example, 22:40 shouldn't refer to 00:22:40am nor to 10:40pm; I just mean 22 minutes and 40 seconds. I guess in theory, I would need it to treat the End Time as x-many minutes (or fractions of a minute) after a given Start Time, so it would need to calculate the total number of seconds elapsed between two mm:ss values and divide that sum by 60 to get the time elapsed in minutes. Then, I could simply divide the count of occurrences (e.g. 8 questions) by that number (1.67 minutes), and get my answer.
Does anyone have any tips about how this could be done? Thank you so much for your help!!
Current State:
Start Time: 22:40
End Time: 24:20
Questions Asked: 8
When I enter =8/(End Time - Start Time), I get 0:00 for some reason. I want it to return 4.8.
Format those durations as Format > Number > Duration. Enter durations complete with elapsed hours, minutes and seconds, as in 0:22:40 and 0:24:20.
You can then calculate events per minute like this:
=E2 / 24 / 60 / (T2 - S2)
...where E2 is the total number of events, S2 is the start moment, and T2 is the end moment.
Format the formula cell as Format > Number > Number.
See this answer for an explanation of how date and time values work in spreadsheets.
I am trying to detect speed of my internet using NSURLConnection. What I do is, I start downloading a file, in delegates of NSURLConnection, I start a time and then when the download finishes, it gets the time frame as well as the data received and then I calculated to get the mb/sec using the below code.
if (startTime != nil) {
elapsed = NSDate().timeIntervalSinceDate(startTime)
NSLog("\(length) -- \(elapsed)")
var d = (Double(length) / elapsed)
var result = CGFloat( d/1024)
result = result * 0.0078125
result = result * 0.0009765625
return result
}
My question is why I am dividing 1024 here because If I don't do I get something is bits/bytes...
I am assuming I am getting seconds from NSDate().timeIntervalSinceDate(startTime) and bytes from Nsdata length
I think I am getting right value however I am not sure. Let me know why it's necessary to divide 1024!
I was dividing by 1024 in the example you took this from simply because I think looking at bytes per second yields a number that is too large to make sense of (and it suggests a misleading degree of accuracy given the variability in that number).
By dividing by 1024, you get kilobytes per second. To get megabytes per second, you'd divide by 1024 * 1024. The 1024 in that original code sample was a mistake, as that would yield kilobytes per second.
So, use whatever measurement you want. Bytes per second, kilobytes per second, megabytes per second. Or you can multiply megabytes per second by 8 and get megabits per second (another common measure of speed). Just divide the bytes per second by the appropriate factor.
In my project, I need to store the clusters as snapshots by means of pyramidal time frame . I have already referred many sites but i couldn't understand how it works. Please can anyone explain this with an example ?
Hierarchical aggregation of different time frames.
Say your lowest granularity is 1 minute, then 15 minutes, 60 minutes, 6 hours, 1 day, 1 week...
You can draw them like a pyramid. 1 week is 7 days is 28 6hour frames, is 24*7hours, ...
I have an iPad app that gets X,Y and Z coordinates from the gyros every 10 ms. What I need to do is store these in the ram until they can be persisted at a convenient time. What is an efficient way of doing this. My first thought was to use a NSMutableArray, but I don't know if calling [array addObject] every 10ms is a good idea in terms of performance. Would it be better to create a linked list or use some other storage method?
Let's be specific.
3 float x 100 per second x 60 seconds per minute x 1 save opportunity in 60 minutes = 4320000
It's only 4.2 MB per hour and mean nothing to the capacity and processing power of iPad.
Just NSMutableArray will do.
I would take a look at this link: a C array that plays nicely with NSObject pointers
It should be right up your alley....
That said, I would use an NSMutableArray until you decide it is not providing the performance you desire.
I am making a iOS app where the size of some files is diplayed in MB. My question is if it is correct to calculate 1000 byte = 1kb or 1024 byte = 1kb ? I have seen that Finder on the mac calculates with 1000b, but an iOS file manager called iFile calculates with 1024b. The wikipedia article didn't really answer my question. I am just askig speifically for file size not HD capacity etc.
My question is if it is correct to calculate 1000 byte = 1kb or 1024
byte = 1kb ?
Both are correct, and both are used in different situations.
1024 is more common for file sizes, while 1000 is more common for physical disk sizes, but neither is always used that way. As you mentioned, some programs uses 1000 for file sizes, and for memory cards 1024 is often used rather than 1000.
An example of how inconsistently the units are used is the 1.44 MB floppy disk. It's neither 1.44 * 1000 * 1000 bytes nor 1.44 * 1024 * 1024 bytes, but actually 1.44 * 1000 * 1024 bytes.
An effort was made to introduce the kibibyte unit, which is always 1024 bytes. It never was a hit, but you can see it used sometimes.
A kilobyte was, and sometimes (usually?) still is, 1024 bytes. And a megabyte is 1024 KB, a gigabyte is 1024 MB, and so on. But lately, those decimal-lovers have redefined them to powers of 1000, making a kilobyte 8000 bits instead of a nice power of two. They renamed the old units to "kibibites" and "mibibytes" or KiB and MiB.
So, if you want to please both crowds1, you can use KiB and powers of 1024. However, I'd suggest that, if you think it's worth the effort, make it a setting you can change that defaults to binary KB.
1 This isn't really pleasing both crowds, though. I personally hate seeing KiB. It shouldn't matter. When you need an exact measurement, measure in bytes and don't abbreviate.
1024b = 1kb
This 1000b stuff is metric... ;)
basic units(Physic, math...) :
K = 10^3,
M = 10^6
so...
1Km are 1000m.. but no 1km are 1024m
So...
A lot of programs using not good units 1024Kb = 1Mb
Historical bug. :)
Windows using normal 1kb = 1024
But if you buy disc 1GB you buy 10^9 B
The true unit of measurement for 1KB is 1024B: http://oxforddictionaries.com/definition/kilobyte?q=kilobyte
However, some manufactures of software and hardware, in an effort to decieve consumers in order to make themselves look better, may calculate it as 1000B. This is actually a pretty recent trend.
Kilo- denotes multiplication by one thousand (not 1024). Modern terminology reflects this fact:
1 kilobyte = 1000 bytes = 8000 bits
1 kibibyte = 1024 bytes = 8192 bits
Previous use of kilo (with bytes) was based on the approximation that 210 (1024) is merely close to 1000.
Imagine being tasked with coming up with a word that means 1000 bytes after some "loose approximation" had already taken the most obvious term you'd want to use. This lead to the corrected meanings listed above.
This terminology has been standardized. The following is a quote from page 143 of the The International System of Units:
The SI prefixes refer strictly to powers of 10. They should not be
used to indicate powers of 2 (for example, one kilobit represents 1000
bits and not 1024 bits). The names and symbols for prefixes to be used
with powers of 2 are recommended as follows:
kibi Ki 210
mebi Mi 220
gibi Gi 230
tebi Ti 240
pebi Pi 250
exbi Ei 260
zebi Zi 270
yobi Yi 280
The bi in the prefixes above are based on the word "binary". When you append "bit" or "byte" onto them, you get the units listed here (where conversions are also provided).