Explanation of W3C TTML timing attributes - specifications

In W3C TTML dfxp standard, a div element can contain begin, end and duration attributes.
How to interpret the value of these timing attributes?
Example:
<div begin="00:00:22.0 end ="00:00:30.0">
<p begin="0s" end="1s">Hi,</p>
<p begin="3s" end="5s">Hello</p>
<p begin="5s" end="10s">there?</p>
</div>
When to present p elements?
Any pointers to TTML spec/implementation would be helpful.

The latest TTML spec is at http://www.w3.org/TR/ttml1/
Many of the timing semantics come from SMIL 2.1.
There are two parts to your answer: first, how do you compute the times for any particular content element; second, how do you relate those times to some other timeline for playback.
Computing time values
The computation of times depends on several things. First, can we assume that you are working in a timeBase and markerMode that allow for time calculations? This applies in all but one scenario, so if you have timeBase="media" or timeBase="clock" then you can. Also if you have timeBase="smpte" and markerMode="continuous". The exception is if you are in smpte discontinuous.
Second, you need to know the value of the timeContainer attribute on the parent element. By default it is par which means that times are computed relative to the parent element's time. If it is seq then times are computed relative to their siblings, or to the parent for the first child.
In your example, let's assume the default of a par timeContainer with a continuous markerMode. Then the computed time of each p is its time added to the begin time of the parent div and clipped by the parent div's end time, giving:
<div begin="00:00:22.0 end ="00:00:30.0">
<p begin="0s" end="1s">Hi,</p> <-- 00:00:22 -> 00:00:23
<p begin="3s" end="5s">Hello</p> <-- 00:00:25 -> 00:00:27
<p begin="5s" end="10s">there?</p> <-- 00:00:27 -> 00:00:30 (cut off by parent)
</div>
Relating times to playback
The best part of the spec to look at here is probably Appendix N. The interpretation of your computed time values depends on the value of ttp:timeBase:
clock means they relate to some real clock somewhere, e.g. a UTC or GPS clock.
media means they relate to the time in some other media like a video file. Time 0 relates to the beginning of the media generally, and if you need to map to frame values then you need to know the frame rate etc.
smpte means they relate to time code in some other media. If you have a discontinuous ttp:markerMode then all times are just event markers: in that case when you see the time code value in the media, you begin or end the content element as needed.
Other stuff
I haven't mentioned evaluating the time expressions themselves - there are several syntaxes available including ticks at a tickrate, frames at a framerate, hours minutes and fractions of minutes etc.
Local times are also allowed.
In seq timeContainers siblings cannot overlap in time; in seq timeContainers they can.
It's not required to put times on both the div and the p in the example given. Also you can put times on body and span if you like.

Here is how it works:
TTML is bound to a specified audio/video clip
The audio/video clip starts at 00:00:00.0
The text nodes in the TTML are shown at a specified times
begin="0s" tells the player to show the text Hi, at 00:00:00.0
end="1s" tells the player to hide the text Hi, at 00:00:01.0
begin="3s" tells the player to show the text Hello at 00:00:03.0
end="5s" tells the player to show the text Hello at 00:00:05.0
begin="5s" tells the player to show the text there? at 00:00:05.0
end="10s" tells the player to show the text there? at 00:00:10.0

Timestamps are treated as absolute. In your case you have parent div which will be displayed from 22nd second to 30th second, however, all the child elements have time intervals that are before 22nd second.
So this TTML will not show anything at all.
For the format of time expressions, have a look at this section in the spec - http://www.w3.org/TR/ttaf1-dfxp/#timing-value-timeExpression
Time stamps 00:00:30.0 means 0 hours, 0 minutes, 30 seconds and after "." is the fraction of seconds. Instead of fraction of seconds there could be another ":" which would mean the frame number and if there is "." after the frame number, then it will specify subframe. Frame rate and subframes are defined by ttp:frameRate or ttp:subFrameRate (also see the spec for more details.
Usually there is only either "end" or "duration" attribute. However, one or all of the "begin"/"end"/"duration" might not be specified, and in that case that end will be considered open. So if there is no "begin" then the time interval will start from "0". If there is "begin", but no "end" or "duration", then it will start at the specified time and will be always shown after that.

Related

MS Word mail merge: MERGESEQ and MOD

Field codes:
Data:
Expected result:
Actual result:
I was thinking about where I should tweak the codes to fix the issue that the first column of each has three records as other columns do.
Also, a new class name (i.e. 1A, 1B) should be added to the second sheets (i.e. the second and fourth pages).
Thanks in advance for any help!
You need something more like this:
There were two problems - a change of class causes a page break, so at that point you can't rely on on the { =mod({ MERGESEQ },3) } = 0 to show you the right place to break next. Because a column break can also cause a page break, you also have to keep count of the columns to ensure that you can insert the class name every time you have a new page.
An advantage of doing it this way is that you can easily change the number of columns and rows per page.
(I have put one other thing in there, because strictly speaking you need to initialize Class1 when you start the merge).

delay on_trait_change() when cycling through values - only execute when mouse is unclicked

If you have a Range trait setup how do you make it only carry out the change once the user has stopped moving through the range?
ie. some range is changed:
some_trait_changed(self):
wait for user to finish selection
complex calculation.
Every time the user drags the Range tool, it calculates a new value for every single value in the range. I only want it to run once they have settled on a value... i.e. once the mouse has 'unclicked'.
Use Range(..., auto_set=False). The auto_set keyword gets passed to the RangeEditor which will configure the slider appropriately.

Is it possible to have Access stop automatically resizing the controls on my form after I've adjusted them?

For example, I have a textbox that I need to have a Left property of exactly 18.281cm, but as soon as I hit enter, it automatically changes to 18.282cm.
The biggest problem is that the way it changes the number is unpredictable. For example, it seems to only do this with specific numbers since sometimes it leaves the number alone.
Another thing to mention is that the amount it changes the number by varies, it isn't always an increase of 0.001cm, sometimes it's even a decrease. Occasionally there are times I can trick it, so if it won't let me change it to 18.279cm, I can type in 18.280cm and then it automatically changes it to 18.279cm, but this happens rarely.
This problem happens with different controls as well, not only with Left. It also does this with Height and Width just as two more examples. I've been trying to search for another instance of this happening, but I can't find any records of this problem happening to anyone else. Does anybody know how to fix this?
The reason it does this is because the measurement is actually twips
18.280cm is not an exact number of twips, so it counds to the nearest twip
18.280cm = 10363.464566929 twips
10363 twips = 18.279180556cm
10364 twips = 18.280944444cm

Erratic UIPageControls

I'm using two UIPageControls in a view to reflect chapters and pages. So I have defined one UIPageControl named chapterCount and one named pageCount just to show where the user is. I handle the flipping of the pages with swipes rather than using the UIPageControls (so no methods defined for them).
I change their values as the user change pages with the following code:
chapterCount.numberOfPages = chapters;
chapterCount.currentPage = chapterNumber;
pageCount.numberOfPages = pages;
pageCount.currentPage = pageNumber;
[chapterCount updateCurrentPageDisplay];
[pageCount updateCurrentPageDisplay];
Where chapters, chapterNumber, pages and pageNumber all are integers.
The first time I flip through the pages it normally works fine, but when I go to a previous chapter or start a new chapter, the first (or last depending on direction) dot is not showed. Please see picture (upper half is missing a dot, lower one OK).
alt text http://img80.imageshack.us/img80/3339/pagecontrol.png
Its the same code updating the controls and sometime I get a dot, sometimes not. When I check the variables with NSLOG they are correct (eg the same for both pictures above).
I have checked Apple's documentation and tried their example but no luck.
Where should I start troubleshooting? I'm getting crazy!!
I finally found the problem :-)
An UIPageControl that is given a value 0 for number of pages will not show correctly the next time it is updated. I was reading chapter and page numbers from an array and in the beginning (let's say cover of the book) there are no pages and no chapters to show, so I happily set these to 0. Since I did not want to change the source data in my array I used MAX(pages , 1) for numberOfPages, so now it's working like clockwork.
Are you sure your chapterCount and pageCount views are not nil? You can have valid values all day, a message to nil does nothing and returns nil. Double check your view and controller wiring/unwiring when you change chapters.
EDIT:
confirm the size of the control is big enough to hold all your pages, and the view bounds is not clipped. For example, if you had 10 pages, and the "current" page was 10, but there were only 9 dots visible, it would appear as though nothing is highlighted because the white dot would be clipped from the visible area by being outside the viewable bounds. You can adjust the size dynamically using this:
- (CGSize)sizeForNumberOfPages:(NSInteger)pageCount

How to slice text or html string into pages with iPhone SDK?

How to slice some text (html) string into number of pages to be possible read text as a book?
Thanks for suggestions.
Assuming you are happy recognising only a subset of HTML markup without CSS (here I assume <p/><b/><i/><br/> tags only plus <font size=/> for font size changes (with other attributes ignored), <img> tags for images with all but src,width,height ignored and accurate width and height mandatory with all other tags/attributes ignored):-
TidyLib seems to have an MIT license - http://tidy.sourceforge.net/#source
SAX parse the XHTML output of TidyLib using NSXmlParser into a custom object model (unless you are exclusively using later versions of iPhone OS with public builtin DOM parser API in which case just use a DOM object model).
Set up a state machine with a caret position at top left of page and initial font size and formatting, page number of 1, maximum height of glyphs/images in current line of zero, and empty list of page boundaries.
For each run of text or image in object model, apply pre-ceding font size/format modifications, measure text using iPhone text measurement calls, reducing text length (trim to nearest space or hyphen) until it fits on current line, and resetting caret to line beginning and continuing for line wraps, and apply following font size and formatting changes. Over-count the width and height of text by some factor in cases where this is found to be required to prevent page overflow in the actual page rendering engine (UIWebView; you will have to experiment to see what the factors in the rendering engine are). Record page boundary in list.
Convert objects between page boundaries to simplified XHTML for each page. You may wish to add some CSS at this point for example to format link colours. You will need to convert local references to anchors on another page to load the correct other page. Perhaps add page footer/header with page numbers (subtract size of these from page height in earlier steps).
Save XHTML as set of files.
In essence this will work as long as the source HTML is specially prepared to use a subset of HTML for your app. Any old HTML will not do, though it might perhaps not be completely useless to give a rough idea for previews in some instances for some files.
The description above assumes you throw away formatting like ALIGN= and tables. It really is a very basic approach and will not reproduce complex pages as originally designed! It might well not suit you!
Perhaps the files should be pre-processed before reaching the iPhones in the field but if the iPhone OS / WebView line-wrapping/test positioning behaviour changes, the best position for page breaks may change. So you may need to cut your pages smaller than you think they need to be to allow for some unexpected growth when the rendering engine changes. Hmm. Perhaps not an easy task!
I haven't even tried to analyse HTML tables... HTML is of course, in its non-restricted full glory enormously probably unmanageably complex.