what I want to get
how make a localisation with NSPredicateEditorRowTemplate
it is not well documented
it was a total pain to figure out.
all is written programmatically
I would like a French, Italian version etc.
https://github.com/thierryH91200/THPredicateEditorSwift
Localizing an NSPredicateEditor is a bit more involved than usual localisation.
First, you'll need to have NSLocalizedString() calls in your code somewhere so that genstrings is able to find them.
Secondly, the key needs to follow a special format that will instruct genstrings to produce all combinations of a given row:
NSLocalizedStringFromTable(#"%[Any, All, None]# of the following are true", #"Predicate", #"localize the compound row template")
NSLocalizedStringFromTable(#"%[property]# %[is, is not, contains, begins with, ends with, like, matches]# %#", #"Predicate", #"localize the string row template")
NSLocalizedStringFromTable(#"%[birthMonth]# %[is, is not]# %[January, February, March, April, May, June, July, August, September, October, November, December]#", #"Predicate", #"localize the selection row template")
In the example above genstrings will look at the options between brackets and generate a localisation string for all combinations in the Predicate.strings file.
Finally, you must let your NSPredicateEditor instance know which strings file to use by setting the formattingStringsFilename property.
See this blog post for more information.
the blog is a few years old.
xcode has improved over the years.
the question is duplicate but the answers may be different a few years later.
the answer is simple. it is the localization of the xib file and it works perfectly
Related
I'm trying to make a table using asdoc that will include both the value labels and the variable labels in the output. When I run the following line of code in Stata
asdoc list progname progtype progterm publicprivate cohortsize grereq, label
I get this in the console (no variable labels):
But in the word doc, it comes out looking like this (has variable labels but no value labels in the table cells):
How do I get both the variable and value labels in the table?
The last update of asdoc was on April 10, 2021. I announced the following in that update.
It is now almost three years that I have been developing asdoc and constantly adding features to it. With the addition of _docx and xl() classes to Stata, it is high time to add support for native docx and xlsx output to asdoc. Also, given that there exists a significant number of LaTeX users, asdoc should be able to create LaTeX documents. It gives me immense pleasure to announce asdocx that is not only more flexible in making customized tables, but also creates documents in native docx, xlsx, html, and tex formats. If you have enjoyed and find asdoc useful, please consider buying a copy of asdocx to support its development. Details related to asdocx can be found on this page.
I am still committed to fixing bugs / issues in asdoc. However, I think it makes more sense to me to add features to asdocx than asdoc, given that asdocx supports all latest developments in Word, Excel and LaTeX.
The requested feature is already available in asdocx. See the following example.
sysuse nlsw88
asdocx list industry age race married grade south in 1/20, replace label
For date ranges, I currently use this format (until precise specifications come up):
<time datetime="2012-11">November 2012</time> - <time datetime="2013-01">January 2013</time>
I was wondering if there is, or will be, a way to indicate today's date. I mean, I know we can do this:
<time datetime="2013-03-05">Today</time>
but I would like to have something like this:
<time datetime="now">Today</time>
If not, I plan to leave the "Today" word with no extra markup. Would you recommend a better solution?
Thanks!
EDIT: To add bit of context, I am building an online resume, hence the date ranges as well as the ones that involve: <time datetime="yyyy-mm">[Month] [Year]</time> - Present.
Thanks everyone for your efforts.
Just to clarify things, I was not looking for ways to dynamically update the content of the datetime attribute. I just wanted to know if there was a way to semantically indicate the "present" day or time.
The answer is: no, there is no way to do that.
I do believe that there might be a change someday. Some of you wondered when this could be useful. I agree that currently there is no need for that, but there might be ways to indicate date ranges in the future specs (the <time> element is still in draft, after all). If so, there could be ranges that start at a precise point and that are still going, giving a use case for a "present"/"now"/... keyword, IMO.
Try using php or JavaScript to get the local time from the user's computer, then output that as text. See http://php.net/manual/en/function.localtime.php for instructions on doing it with php.
EDIT: It gets the server time, not the user's time. To get the user's time, you have to use javascript.
surfing the web i found this question, i thought it would be cool to answer since today we have an answer to that.
<time datetime="P4DT4H3M">four days, and three minutes</time>
To better understand you can see here:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time
assuming that I know nothing about everything and that I'm starting in programming TODAY what do you say would be necessary for me to learn in order to start working with Natural Language Processing?
I've been struggling with some string parsing methods but so far it is just annoying me and making me create ugly code. I'm looking for some fresh new ideas on how to create a Remember The Milk API like to parse user's input in order to provide an input form for fast data entry that are not based on fields but in simple one line phrases instead.
EDIT: RTM is todo list system. So in order to enter a task you don't need to type in each field to fill values (task name, due date, location, etc). You can simply type in a phrase like "Dentist appointment monday at 2PM in WhateverPlace" and it will parse it and fill all fields for you.
I don't have any kind of technical constraints since it's going to be a personal project but I'm more familiar with .NET world. Actually, I'm not sure this is a matter of language but if it's necessary I'm more than willing to learn a new language to do it.
My project is related to personal finances so the phrases are more like "Spent 10USD on Coffee last night with my girlfriend" and it would fill location, amount of $$$, tags and other stuff.
Thanks a lot for any kind of directions that you might give me!
This does not appear to require full NLP. Simple pattern-based information extraction will probably suffice. The basic idea is to tokenize the text, then recognize/classify certain keywords, and finally recognize patterns/phrases.
In your example, tokenizing gives you "Dentist", "appointment", "monday", "at", "2PM", "in", "WhateverPlace". Your tool will recognize that "monday" is a day of the week, "2PM" is a time, etc. Finally, you can find patterns like [at] [TIME] and [in] [Place] and use those to fill in the fields.
A framework like GATE may help, but even that may be a larger hammer than you really need.
Have a look at NLTK, its a good resource for beginner programmers interested in NLP.
http://www.nltk.org/
It is written in python which is one of the easier programming languages.
Now that I understand your problem, here is my solution:
You can develop a kind of restricted vocabulary, in which all amounts must end witha $ sign or any time must be in form of 00:00 and/or end with AM/PM, regarding detecting items, you can use list of objects from ontology such as Open Cyc. Open Cyc can provide you with list of all objects such beer, coffee, bread and milk etc. this will help you to detect objects in the short phrase. Still it would be a very fuzzy approach.
I am saving all my notes in a log file. Each line is a note, suffixed by tags, and prefixed by a date and time marker, which currently looks like this: [12.20.09:22.22] ([date:time].
I am planning to have this a long-living format. Notes will be logged willy-nilly with this format 20-30 times a day for years to come. I foresee numerous kinds of parsing for analytics, filtering, searching ...
I am worried about the [ ]s though. Could they possibly trip some parsing code (someone else's if not mine)? What would be the most non-confrontational marker?
If you end up going with your own format, can I recommend ISO 8601 for your date and time format.
In summary, the basic format is:
yyyy-mm-dd hh:mm:ss
You can extend this with timezone and microsecond info if you wish. Timezone is recommended or assume UTC.
With the date/time in this format there's no confusion over which is the month and the day. And it has the bonus of sorting using a basic string sort.
I'd consider using either XML or JSON as the format for the file.
In particular your date/time marker is ambiguous. Is it mm/dd/yy or dd/mm/yy? Or even yy/mm/dd? And in what timezone is the date and time?
Both XML and JSON define a way to have dates that are culture and timezone independent, and (best of all) there's masses of tooling available for both formats.
XML datetime format is defined here: for example, 2000-01-12T12:13:14Z.
JSON datetime format is defined as the number of seconds since Jan 1, 1970, so it's a bit uglier: { currentDate: "#1163531522089#" }
If you want everything to last in a long-lived format, then the metadata needs to be as explicit as possible. If it's intended to be long-lived, then many others will need to read it, as easily as possible.
I agree with Jeremy McGee: XML is an excellent choice. Even if no other data lives, then having it be in the format:
<note>
<datetime>
<year>
2009
</year>
<month>
12
</month>
. . .
</datetime>
<message>
Foo bar baz quox
</message>
<note>
cannot be misunderstood.
This depends on your data. However, if you escape them with a special character of some sort, (i.e. \]) and code accordingly to look at the previous character when finding a "[" or "]", you should have no problem.
Also, if you're open to a new format, I'm a fan of JSON as it's light weight and very useful.
Using '[]' as the markers would be ok provided that you allow the DSL the ability to escape the characters. This is typical of operations on text which need parsing.
As an example check out the typical regular expression syntax which enables '/' as the seperator, whilst letting the user specify an escape character such as '\'. You may get some more ideas from the likes of such Unix tools as; awk, sed and grep
I would tend to think a standardized format is the way to go, with JSON being my personal choice because of it's simplicity. Not only does that help to avoid parsing issues since others have already though about it, you are also given a lot more tools to work with over the life of the project.
"A centenarian is a person who has attained the age of 100 years or more." - Wikipedia
There are several ways to prompt a user for Date of Birth, but let's say we've chosen the drop down method.
How would you handle the oldest selectable date? Do you pick an arbitrary year (such as 1875) and populate to present?
Or, do you consult some resource for a record breaking age (Jeanne Calment, age 122), add a couple of years, and populate backwards?
Why not a text input box where they type in "1899" or whatever? When it is received you can validate that it is a legitimate number based on whatever criteria you use. I get annoyed by listboxes to select year of birth, because listboxes should not have that many values in them.
Rereading the question, you are assuming that listbox is the only option. In that case, 130 years ago seems like a good enough cutoff to me. If you're worried that the next world-record breaker will happen to be using your system, why not go with something like 200 years ago. Although I'd still say you should just use a text box.
As you're going to have to perform server-side validate the input regardless of the control used, why not use a standard text input?
`<input type="text" maxlength="4"/>
This:
Eliminates the centenarian problem.
Easier to use, especially for older individuals (Assuming the list is in descending order).
Smaller page size (don't need to include 100+ <option>....</option> tags.
If you must use a <select> box, I agree with your Wikipedia methodology. Ceiling the age of the oldest recorded person (126 -> 130 or 140) would be fairly risk-free.
It depends I think. Are you creating an application for young people?
If the application needs to be accessible for everyone, just create a configurable check and update it now and then. Look at http://en.wikipedia.org/wiki/Oldest_people#Ten_oldest_people_currently_living for the oldest possible date.
A date picker is preferable, don't use irritating listboxes with 100+ values.
My opinion on data entry like this is to cater to the user, not the programmer.
While, yes, a drop-down causes the least error handling, it's also tedious for the users.
Go for text entry that you need to validate. More code is needed in the back [allowing for both 2 digit years and 4 digit], but it's an easier experience for the user
If you want to stick to drop downs, just pick an old enough date. Personally I think drop downs are bad both for the user and you. I find selecting my birthday from a list of hundred numbers annoying (even though firefox lets me select the date by typing it). But also I think a selection makes people tend to input fake years more than if they had to type it in.
If you can live with Javascript, a Combobox might be the best of both worlds. You can list 100 years in the list, and let older people type. This only has minor ethical problem, i.e. you purposefully make elderly people type =)