How can I semantically define within the <time> tag 'the present' - date

I am using time tag to define a time—seemed like the right approach ;-)
My problem however is the value I want to place within the time tag is NOW: the present. I get this validation error:
The text content of element time was not in the required format:
The literal did not satisfy the time-datetime format."
Looking at the spec, it doesn't seem possible to define 'NOW'. That's a nuisance. Any ideas on how to approach this?

You cannot. The time element in HTML5 is defined as markup for specific moments or periods or durations of time or for time offsets, not for all concepts related to time.
You can write e.g. <time datetime="2013-04-06T13:53">now</time>, thereby associating a fixed moment of time with the text content “now”. I don’t see how this could be useful, and the usefulness of the time element in general is questionable (it looks like markup for markup’s sake), but things like this are all you can do to “define ‘NOW’” with time.

I'm using this markup for now:
<time datetime="2013">Present</time>
No more errors, and it's symatic. It's just a shame there is no accepted variable for NOW.

Related

sap.m.Input allow only positive integer values

I need reject for sap.m.Input control any input except integer values. So in input may be inputted only 0-9, without any sign symbol(+-) or any decimal separators. I Can't find good solution. View declared in XML format, and preferable way is just change this XML with additional parameters, if it possible.
Possible solutions:
The first one - write custom formatter.
The second one - try to find some standard solution with types. I found internal data types and they settings, but it seems that they not working well.
A custom formatter won't help you in this case as its only used oneway (model->view).
But data types are your friend here. I would suggest sap.ui.model.type.Integer with a minimum constraint of 0.
<Input value="{path: '/value', type: 'sap.ui.model.type.Integer', constraints:{minimum:0}}" />
However this does have two prerequisites:
You need to enable complex databinding. This can be done in the bootstrap tag in index.html with the data-sap-ui-compatVersion attribute. Version 1.26 is needed at least. You can use the value edge to specify the newest version:
<script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-libs="sap.m"
data-sap-ui-compatVersion="edge">
Alternatively you can use data-sap-ui-bindingSyntax="complex".
If the user enters invalid data the datatype throws a ValidationException. The error will be silently ignored but the model won't be updated. To get some feedback for the user you can register the control or the whole view at the MessageManager:
sap.ui.getCore().getMessageManager().registerObject(this.getView(), true);
You can also enable handleValidation in the Component or when instantiating the component.
Example on JSBin.
Regex is your friend here.
Here is a pretty simple jsbin I re-used from someone validating text only and modified the regex to accept numbers only.
You could wire the validation into the change event so it would fire and set the state to error if text entered.
Let us know how this works out.
Cheers,
Nigel

How does one get the total number of slides?

In Articulate's Storyline product, how does one retrieve the total number of slides (or pages) in a storyfile or project?
There's not much documentation so it's kind of hard to figure out how to query common environment values like this. If we can get the total number of slides then we don't have to manually set a value for it.
One must manually set and update a variable to store the number of slides.
The most lengthy conversation on the matter seems to be found here at the Articulate forums.
In that thread the users and staff describe the need to manually define such a variable.
I asked the question on the official forum more directly here, and so far have not received a response.
Another poster at that forum mentioned using PHP to solve this problem, but unfortunately we can't add the requirement of PHP to the final product. I'm sure some server side language tricks might be used to solve this issue, but that also adds the dependency of a particular server-side language.
The Answer Mark gave is correct. So if you want to track the number of question slides in a quiz you would either hard code the value in a variable such as totalQuestions, or increment it as you go through each slide using adjust variable trigger. To call that value and display it on screen you would just add it to a text field and surround it with "%".
EG. "You have answered %Results.ScorePoints% out of %totalQuestions% questions correctly."
I find it rather pointless to hard code it since it's just as easy to put the value in the text field at the end. Using the increment method seems more logical because then you can add more question slides without having to adjust the variable or results screen each time.
I usually load frame.xml, browse for all slidelink tags and sort all slides by their Id.
Usually you get something like slideid=_player.5xoxGTW6QCh.6bmeRt3tCqP, where 5xoxGTW6QCh is the scene id and 6bmeRt3tCqP is the slide id. displaytext also gives you the slide title.
If you browse for slidetranscript and match the Id for each transcript you also get the slide notes.
Articulate 360 now has an internal (Built-in) variable for this and other counts. See Project.TotalSlides and Menu.TotalSlides
See https://community.articulate.com/series/articulate-storyline-360/articles/storyline-360-add-slide-numbers

MS Word 2007 - How to set up placeholder text to mimic text but not formatting

I'm probably biting off more than I can chew with this particular problem, but I'll try to be as specific as possible in case it's within my scope. Disclaimer: I'm not terribly experienced with MS Word, beyond simple data entry/some formatting, and I have absolutely zero experience working with macros or VBasic. Unfortunately, I'm afraid the solution to my problem will come in the form of one of those last two.
THE GOAL:
What I want to do is to have placeholder text throughout my template document that will change content but not formatting when the first instance of it is changed. Basically, I'm writing a template for support manuals for a software suite. Each app has certain similar features like the menu bar, data entry screen, diagnostic log screen, transaction history, etc., so I am pre-writing those sections and using placeholders when I need to insert certain app specific properties.
I started off using the Insert->Quick Parts->Document Property->Subject tool which I used as a placeholder for the app name. I set the Property to [Subject] and then used Insert->Quick Parts->Field->Subject throughout the document, wherever I needed to include the app name. This worked fine in this case because the app name will always be capitalized. I simply change the text in the first [Subject] (which is content controlled) and update the fields throughout the document, and they all match nicely, easy-peasy, work done, go home and drink beer, right?
Not quite.
Our software handles part tracking via scanners and SQL Server, so while the interface and menu in the apps remains largely unchanged, the parts they track change from app to app. Because of this, I need to change the part name when I reference it within the text of the manuals; for example, if I'm working in ToiletPap.app and our TP is tracked by the roll, I need every mention of [Component] to be changed to roll. If I'm working in LightBulbs.app, I need [Component] to say bulb.
My first efforts went toward creating a custom doc property called Component using the Advanced tab under the Document Properties dropmenu. I then created a plaintext content control around my first [Component] titled Component and made my next [Component] a field with modified code: {COMPONENT * MERGEFORMAT}. This comes from copying what I can find when [Subject] works. This didn't work at all; updating the text in the first CC doesn't change the Content doc prop, and my fields return "!Undefined Bookmark, COMPONENT".
I got close to what I need by using the [Comments] doc property, set initially to [Component]. I used it just like [Subject], but (this is when I realized that capitalization was going to be an issue) when I mention my [component] in-text, as often as not, I need to to be lowercase instead of upper.
I've looked on MS's forums and a few others as well as here on SO, and I can't find anyone who's trying to do the same thing, much less an answer to how. Please keep in mind when answering, it would be a great help to me if you would include step-by-step instructions on how to enter/implement the code you provide because, as I mentioned, I have no idea how to go about editing macros/VBasic for MS Word.
To restate and summarize my overall question: How can I use a placeholder that displays the text "[Component]" so that, when I change the first instance of [Component] to something else, say "hopper", every subsequent instance of [Component] is updated to hopper but maintains its current capitalization and formatting scheme?
Apologies for the length of the request, but I wanted to make sure I explained the situation as accurately as possible. Thanks in advance for your consideration and responses.
I managed to solve this one after a couple extra hours of tinkering. I didn't need macros or VBasic, either.
On the first instance of [component] I created a plain-text content control to act as a container (not a necessity, but it makes it look nicer. Will likely cause a problem eventually, but for now, it's working as intended) and bookmarked it. Then, for all other instances of [container] I selected each and used Insert->Quick Parts->Field->Ref with the following field code:
REF Text1 \*Lower
Where "Text1" is my bookmark and "*Lower" indicates all lower case. The *Lower can be replaced with *Upper or *FirstCap to indicate all upper case or capitalize the first letter respectively. Now, each field reflects the text of the first with the capitalization appropriate to each field's location within the document. Just like using the doc prop with [Subject], ^a -> f9 is needed to update all fields within the document.

Is it allowed to use <label> tag without labeled control?

I need to show in a page a list of, let's say, person's properties that should be rendered more or less as follow:
name: Name
date: 1/1/2000
other: Other
Reading the doc they say:
The LABEL element may be used to attach information to controls.
So, is it the right tag to encompass the names of the properties like name, date...
even if there's not an <input> to associate with?
Nope, as per Quentin’s answer.
However, in HTML5, <dl> can be used for generic associations where <label> isn’t appropriate.
No.
It says that it can associate information with controls.
It does not say that it can associate information with anything else.
See also the newer (but draft) specification:
Some elements, not all of them form-associated, are categorized as
labelable elements. These are elements that can be associated with a
label element.
button input (if the type attribute is not in the hidden state) keygen
meter output progress select textarea
No, it is not correct to use the label element like that.
The important thing here is the meaning of may.
The LABEL element may be used to attach information to controls.
RFC 2119 (which the HTML4 spec follows) defines may:
May: This word, or the adjective "OPTIONAL", mean that an item is truly optional
So here, may does not mean the label element can be used for other purposes; it just means that it is not required to use a label element with controls.
As far as alternatives go, it depends what you want to achieve. If you are just trying to follow the spec closely, then I suggest using p and a strong element for each pair. If you want the data to be more meaningful to computers, you could consider using one of the Microformat specifications.
I partially agree with the answers so far but want to add that if you want to use labels for some reason, then I would display the property values in read-only controls, and then your labels will be valid.
I've done this using appropriate styling to differentiate the read-only controls from the functioning controls to avoid confusing your users. This was on a sequence of pages which built up the information gathered from the user in a wizard.
I have this link to W3C - the "Editor's Draft" as opposed to the link above which is the "Working Draft", which states that you can associate it with any element - as long as it's 'labelable' - even though this is a subsection of the Form section. It states earlier that a labelable element does not have to be within a form.
http://dev.w3.org/html5/spec/single-page.html#the-label-element

Get date difference in jstl

I have a date and want to show difference of it with current time as --year--month--days--hours--minutes--seconds. How can I do this jstl? It is sure that the date will be greater than current datetime.
Using JSTL you could do some code gymnastics like:
<jsp:useBean id="now" class="java.util.Date" />
<fmt:parseNumber
value="${(now.time - otherDate.time) / (1000*60*60*24) }"
integerOnly="true" /> day(s) passed between given dates.
But as code suggests, this gives overall difference and hardly could be a "calendar aware" way of doing it. I.e. You could not say: "3 years, 1 month and 2 days passed since otherDate".
Another example for this "days passed..." style, using a JSP tag and using "today/yesterday/days back" presentation:
<%--[...]--%>
<%#attribute name="otherDate" required="true" type="java.util.Date"%>
<jsp:useBean id="now" class="java.util.Date" scope="request"/>
<fmt:parseNumber
value="${ now.time / (1000*60*60*24) }"
integerOnly="true" var="nowDays" scope="request"/>
<fmt:parseNumber
value="${ otherDate.time / (1000*60*60*24) }"
integerOnly="true" var="otherDays" scope="page"/>
<c:set value="${nowDays - otherDays}" var="dateDiff"/>
<c:choose>
<c:when test="${dateDiff eq 0}">today</c:when>
<c:when test="${dateDiff eq 1}">yesterday</c:when>
<c:otherwise>${dateDiff} day(s) ago</c:otherwise>
<%--[...]--%>
Note:
In your software problem domain, if it makes sense to talk about days and months in a calendar way, probably you should have that expressed in your Domain Model. If not, at least you should benefit from using another lower software layer to provide this information (and for example using java.util.Calendar or Joda-Time APIs).
Not sure there are any built in ways of doing this with JSTL. you could write your own tag library or potentially use expression language (EL) like below.
${(dateObj) - (now.time)}
taken from Looking for JSTL Taglib calculate seconds between two dates
Mark I'm uncertain if this is possible using JSTL and one way would be to create your own custom tag to handle this as #olly_uk suggested. Me personally would not use any expression language on my JSP as this might also affect readability and not best practise.
You could also have this calculation/date difference when your page bean is constructed, that way avoiding any EL or a new tag. This also might have its limitations such as I'm not sure if the date you want to check the difference is entered by the user on field where you want to display the result instantly etc if you see what I mean.
Also another you could try depending on your scenario is using jQuery to calculate and display the difference, I thought I'll link this page anyway from SO.
How do I get the number of days between two dates in JavaScript?
JQuery Calculate Day Difference in 2 date textboxes
Hope this helps.