websql ios7 how to increase size? - ipad

as described here: http://www.mobilexweb.com/blog/safari-ios7-html5-problems-apis-review
I want to take advantage of the workaround described.
I tried:
var size = 4, db = openDatabase("db", "v1.1", "db", size * 1024 * 1024);
then I tried:
var size = 40, db = openDatabase("db", "v1.1", "db", size * 1024 * 1024);
And this, I've tried over thousand times the last 24 hours.
Sometimes a prompt appears: "increase up to 5MB?" .. but never one with "increase up to 10 or 25 or 50 …………"
Some time at the beginning of this, it worked! … Crazy. It really worked. But I wasn't sure about how I came to this point .. that's why I started to do it again (and again …) .. but it never worked again :( :(
… 23 hours later …
I have to show it to the client tomorrow, but it doesn't work. damn! That is why you are my last hope!
So If anybody has experience with websql-cache-limit on ios7 … please tell me what I'm doing wrong …
Thx!

I am editing the answer, as i didn't noticed you already saw that link. but, the same work around works for me. I am initially asking for 1 MB of space and then it works properly.
var db=openDatabase('PermissionDatabase', '1.0', 'PermissionDB', 1 * 1024 * 1024);
As per your answer, it worked initially, try resetting safari to delete all the previous permissions granted and then try again.

Initial request database size has no meaning in iOS.
Workaround is, dump garbage data of your desire storage size in temp db. This should cause to request quota. Then you delete temp db, and create your db.

Related

How to calculate checksum (for DFPlayer mini)

For a while now I've been trying to calculate the checksum for my DFPlayer mini (which will still be delivered). Since I don't have that much experience with the subject, I don't really know how to do it, so I tried to help myself with the data sheet.
Unfortunately, this didn't bring me much and I started to search through forums. And that's when I came across the exact same question that was answered. But I was surprised that in the example in the forum a different checksum came out, than with the data sheet I found. A data sheet was attached to the forum contribution, which contains the same example but with different checksums (see pictures). Example from (my) data sheet ; Example from the data sheet from the forum ; Forum post.
I have already tried to analyze the code of the library which one could use (but I do not want to use it if possible). But since I'm still a beginner, I couldn't rely on my results, partly because the same examples with the different checksums confuse me a lot.
I would be happy if someone could help me here
most of the DFPlayer mini clones use this method:
/*
DFPlayer data frame format:
0 1 2 3 4 5 6 7 8 9-byte
START, VER, LEN, CMD, ACK, DH, DL, SUMH, SUML, END
-------- checksum --------
*/
int16_t checksum = 0;
checksum = checksum - _dataBuffer[1] - _dataBuffer[2] - _dataBuffer[3] - _dataBuffer[4] - _dataBuffer[5] - _dataBuffer[6];
_dataBuffer[7] = checksum >> 8;
_dataBuffer[8] = checksum;

After end of daylight saving time, no CRON triggers occur except one

In our .NET application, we have several hourly job triggers:
XX:00
XX:05
XX:10
XX:15
During the end of DST (25 October 2020 at 03:00) the triggers stopped working except the first trigger (XX:00).
Hour 00 did well. Hour 01 also did well. But starting with hour 02 only the trigger at 02:00 worked. The three other triggers never got triggered, even later during the day it didn't work. They completely stopped working except the trigger for XX:00 kept working.
I can't clarify why it behaved like this, because DST ended at 03:00 so I think 02:00 should have worked normally until 03:00. Probably after 03:00 I should have seen some misbehaviour but the misbehaving happened at hour 02 as I mentioned earlier.
I'm very flexible in solving this issue. I can change the schedules to semi-hourly or to 2-hourly if it solves the issue. The 4 triggers just have to keep triggering instead of stopping completely... It doesn't matter when they run, as long as they trigger approximately every hour continuously. But SimpleTrigger isn't the one that I want to use, because then all the jobs start immediately in parallel when service starts and I don't want that...
I know there are similar questions here on SO, but in most of those questions the timing is stubborn. In my case, I'm very flexible and I'm looking for the easiest workaround.
Is there any quick workaround to solve this issue? Can I for example completely ignore DST and just use UTC?
Using library version: 3.0.7
The CRON triggers:
0 0 * ? * * *
0 5 * ? * * *
0 10 * ? * * *
0 15 * ? * * *

Why Does This Animation Last So Little Time?

Here is my code,
self.play(AnimationGroup(
Write(quadSolution[0]),
Write(quadSolution[1]),
Write(quadSolution[2]),
Write(quadSolution[3]),
Write(quadSolution[4]),
Write(quadSolution[5]),
Write(quadSolution[6]),
Write(quadSolution[7]),
Write(quadSolution[8]),
Write(quadSolution[9]),
lag_ratio = 1
),
AnimationGroup(
Animation(Mobject(), run_time = 4),
Write(text2),
run_time = 4,
lag_ratio = 6
)
)
I don't know any better ways to do that list of animations, I would be thankful if anyone could tell me how to do that, but what I really want to know is why the Write(text2) doesn't have a run time of 4 seconds as it should, but instead has a run time of around a second. I don't know what is wrong with what I am doing.
You might have already found the answer you were looking for. But I think the solution to your problem would be to place the run_time parameter within the Write.
So it should look something like Write(text2, run_time=4). I hope this helps.

Xcode iOS: how to find position of one audio file (snippet) inside another?

I have audio files, with different durations. They have common content and unique content. E.g. two files, 70 seconds each, last 10 seconds of the first file is the same as first two seconds of the second file. How can I find the exact position of common content (e.g. 60.0 of the first file)?
Sounds a little bit messy, hope the following image can help https://drive.google.com/file/d/0BzBE2Kfw8uQoUWNTN1RXOEtLVEk/view?usp=sharing
So, I'm looking for the red mark - common content starts at 60.0 sec of the first file.
The problem is that I have files with different durations. Sometimes it's 70 seconds long, sometimes one file is 70 seconds, the other is 80 seconds long, etc. Most likely they have 60.0 seconds of unique content, but I'm not sure (it could be 59.9 of unique content, etc.).
Thus, I assume I need to get a short snippet of the second file from first 10 seconds and find it in the first file:
For example, output: 2.5 sec of the second file = 62.5 from the first file - works for me, as well.
THE MAIN GOAL IS TO PLAY FILE AFTER FILE GAPLESS. If I get the values, I'll be able to do this. Sometimes the values can be: 2.5 = 63.7, that's why I need the exact match.
Can anybody help with the code or at least some information of how to compare two snippets of audio content? Thanks in advance!
Wow, that is quite a problem to solve. And I must confess that i've not done anything exactly like this or have any code based suggestions.
All I will say is that if I were looking to try and solve this problem, then I would try and save the audio file as some kind of uncompressed and fixed size (as in a known number of bytes per second) format.
Then you could take a section of one file and byte match it with another, then you would know how many bytes inwards that snippet occurred. Then, knowing the bytes per ms (sort of frame size), you could work out the exact time position.
It's a bit hair brained, but i've used that technique with images before but at least audio is linear!
Here is an approximate example of how I would go about doing the comparison of a sample within a sound file.
- (int)positionOf:(NSData*)sample inData:(NSData*)soundfile {
// the block size has to be big enough to find something genuinely unique but small enough to ensure it is still fast.
int blockSize = 128;
int position = 0;
int returnPosition = INT32_MAX;
// check to see if the block size exceeds the sample or data file size
if (soundfile.length < blockSize || sample.length < blockSize) {
return returnPosition;
}
// create a byte array of the sample, ready to use to compare with the shifting buffer
char* sampleByteArray = malloc(sample.length);
memcpy(sampleByteArray, sample.bytes, sample.length);
// now loop through the sound file, shifting the window along.
while (position < (soundfile.length - blockSize)) {
char* window = malloc(blockSize);
memcpy(window, soundfile.bytes + position, blockSize);
// check to see if this is a match
if(!memcmp(sampleByteArray, window, blockSize)) {
// these are the same, now to check if the whole sample is the same
if ((position + sample.length) > soundfile.length) {
// the sample won't fit in the remaining soundfile, so it can't be this!
free(window);
break;
}
if(!memcmp(sampleByteArray, soundfile.bytes + position, sample.length)) {
// this is an entire match, position marks the start in bytes of the sample.
free(window);
returnPosition = position;
break;
}
}
free(window);
position++;
}
free(sampleByteArray);
return returnPosition;
}
It compiles, didn't have time to setup the scenario to check your exact case, but i'm quite confident this may help.

ActiveRecord limit(7) - should always pull 7

I have the following rails query:
#related_products = #taxon.products.offset(rand(Spree::Product.count)).limit(7)
And sometime it outputs 7 and sometimes it will output less, but when it outputs less it messes up the styling. Anyway to make it always output 7 and only 7?
Thanks!
That's because the offset that you are choosing has the possibility of being less than 7 away from the last record. Instead force the offset to max out at 7 below the maximum:
#related_products = #taxon.products.offset(rand(Spree::Product.count - 7)).limit(7)

Resources