What is the correct format for denoting that an input parameter is a date/time in Apiary? - apiblueprint

I am editing some Apiary documentation on a project I am working on, and need to denote that a parameter to one of my API calls is a datetime string. Apiary seems to be choking on the formatting of this parameter, so I'm wondering what the suggested approach for documenting this parameter in Apiary would be.
To demonstrate, I took the standard default docs from Apiary and modified the Choice documentation to take a datetime object like so:
## Choice [/questions/{question_id}/choices/{choice_id}/{datetime}]
+ Parameters
+ question_id: 1 (required, number) - ID of the Question in form of an integer
+ choice_id: 1 (required, number) - ID of the Choice in form of an integer
+ datetime: 2015-05-05T12:30:00 (optional, date) - The date/time (ISO8601 format) associated with this choice
The end result of this is the following text:
datetime
05-05T12:30:00 (optional, date) - The date/time (ISO8601 format) that all returned events should be greater than or equal to Example: 2015.
This is clearly wrong, even write down to the example value. The dash (-) is a special character that is causing grief here. What is the recommended approach for doing this right?

You should be able to use backticks as an escaping sequence. Also please note that there is no such type as date. You should use string:
+ datetime: `2015-05-05T12:30:00` (optional, string) - The date/time (ISO8601 format) associated with this choice

Related

How to force Ms Access 2002, installed on French Locale Windows, to use the "." as the decimal separator instead of ","?

I have installed windows 10 64 bit with french localization, and installed Microsoft Office, including ms access.
I have this problem when inserting values to Ms Access 2002 table into Currency field, as the value am trying to insert is a decimal value represented through string, with "." operator as the Decimal Separator, as am getting the error message "datatype mismatch in criteria expression".
Is there a way to tell Ms Access to use the "." as the decimal separator instead of "," and the "," as the Thousands Group Separator instead of " ", as replacing the decimal string value of "." character occurrences to "," characters isn't an option as i have thousands of strings that will need accordingly to have the replace function called upon,
What have tried so far, and didn't bring any results, is:
1. Change the decimal symbol, from control panel, regional and language settings from "," to ".".
2. Switching from OleDB to ODBC, and specifying "Locale Identifier" value to 2057, indicating en-GB, in the connection string.
Please Advise,
Thanks in advance.
First change the comma to a character other than a period ("#")
Then change any remaining periods to a comma.
Lastly change "#" to a period.
dblValue = Replace(Replace(Replace(OriginalValue, ",", "#"), ".", ","), "#", ".")
You mentioned that the values you are passing to access are strings. Why can't you format those strings in a way you wish them to be, and pass the data to MS access?
You did not mention anything specific, so I assume you work in the notepad.exe. In the above program, format the strings you wish to the values you need by replacing appropriate locale symbols to ones you need. After that pass the strings in some way you "better know how" to the MS access.
If you have a millions or billions of rows(columns?!) in your data, you can do a mass replace in the program of your choise(notepad.exe). This is as simple as that.
Use Str, it will never fail:
Str(AnyDecimalValue)
For a generic solution, use my function CSql.
Edit:
The other way around - to convert a text expression to a decimal - use Val:
Val(TextNumberWithDecimalDot)

HTML time tag - correct date format

I am wanting to use the correct format and standards to put the time tag in my html document.
Is this the correct way to do it?
<time datetime="2014-03-26T12:48:42.733Z">26/03/2014</time>
Thanks
The Format is YYYY-MM-DDThh:mm:ssTZD
The date or time being specified. Explanation of components:
YYYY - year (e.g. 2011)
MM - month (e.g. 01 for January)
DD - day of the month (e.g. 08)
T - a required separator if time is also specified
hh - hour (e.g. 22 for 10.00pm)
mm - minutes (e.g. 55)
ss - seconds (e.g. 03)
TZD - Time Zone Designator (Z denotes Zulu, also known as Greenwich Mean Time)
So Yes
Source
The time element as defined in HTML5 must specify time, date, time and date, or other applicable designation in a specific machine-readable format, as described in the draft. This designation may appear as the element content, e.g.
<time>2014-03-26></time>
If it does not (typically, when the content specifies a date or time in human-readable form in some language), the machine-readable designation must appear as the value of the datetime attribute, e.g.
<time datetime="2014-03-26">26/03/2014</time>
The notation in the question is not adequate, as the value of the attribute must be “a representation of the element's contents in a machine-readable format”, and a date and time denotation, down to milliseconds, can hardly be said to represent a date.
Note: There is no evidence of browsers or search engines making any use of time markup, so such markup is only potentially useful.
As per the specs:
A valid date-time as defined in [RFC 3339], with these additional qualifications:
the literal letters T and Z in the date/time syntax must always be uppercase
the date-fullyear production is instead defined as four or more digits representing a number greater than 0
Examples:
1990-12-31T23:59:60Z
1996-12-19T16:39:57-08:00
Yes, see RFC 3339 and input type=datetime
The spec here lays down the format. There's no mention of fractional time, so no - this is not correct.
However, this will be correct:
<time datetime="2014-03-26T12:48:42Z">26/03/2014</time>

Jmeter - how to add prefix to a counter. Similar to a random variable

Currently in the random variable I can put a prefix or suffix in the output format of the variable. However this nice feature is not available for a simple counter controller. Concatenating string+${counter} every time when i use the variable is not a good option form me since i do this a lot.
Is there any way to achieve prefix+counter in a way random variable do this?
Thanks.
Are you talking about Counter Config Element ?
If so it is possible using Number Format attribute:
http://jmeter.apache.org/usermanual/component_reference.html#Counter
See:
Format Optional format, e.g. 000 will format as 001, 002 etc.
This is passed to DecimalFormat, so any valid formats can be used.
If there is a problem interpreting the format, then it is ignored.
[The default format is generated using Long.toString()]
On 'Number format' field of Counter, write your pattern with 0...0 represents for value count up.
Example:
'Number format' pattern: prefix_000_suffix
Real value: prefix_001_suffix, prefix_002_suffix, prefix_003_suffix,...
Hope this helps!

How do I concatenate string in Pentaho spoon?

I am a newbie to Pentaho (installed today). I was able to do basic transformation in Spoon. Now I need to do some stuff, which I can't figure out how.
my input looks like
2012-09-17|garima|fbhjgjhgj87687jghgj88jgjj|garima#1347868164626|::ffff:120.56.132.137
3rd field is an ID, for which I need to get some information from a REST API
http://api.app.com/app/api/v1/feature/fbhjgjhgj87687jghgj88jgjj
What do I need to do in Spoon to get this done?
Also, data return will be in json format. how do I parse that?
You should first get your input with a CSV File Input using | as delimiter. Then you can get the 3rd field as a string.
Next you probably need to remove all spaces from this string with a String operations step. Look at the Remove special character column, and select space.
Then you need to concatenate it with your http address http://api.app.com/app/api/v1/feature/. For this you'll use a Calculator step. At this step first create a new temporary field tmpAddr, with operation Define a constant value for ... (or something like this, sorry my spoon is in portuguese). At the Field A column you'll write your http address. It's a good practice, after you make this work, to set your address as a system variable so if it changes you don't need to replace it everywhere on your transformations (look at menu Edit -> System Variables).
Now on the same Calculator step create another field, let's say MyAddress, with operation A+B. Choose for Field A the field tmpAddr you just created, and for Field B the 3rd field from your input.
Now on your stream you should have the full address as a field MyAddress. Connect a REST client step. Mark Accept URL from field and choose field MyAddress as URL Field Name. Set Application Type to JSON. Set Result Fieldname as MyResult.
If you need further JSON parsing you can add a Json input step. Set Source is defined in a field and select field MyResult as Get Source from field.
An alternate approach is to use the "Replace in String" step to append the string.
Set 'use RegEx' to Y
Set 'Search' to (.*)
Set 'Replace with' to http://api.app.com/app/api/v1/feature/$1
Set 'Whole Word' to Y
The parentheses in the regex set up a capture group that you can then insert into your replacement string with the $X syntax

Local Currency String conversion

I am maintaining an app for a client that is used in two locations. One in England and one in Poland.
The database is stored in England and uses the format £1000.00 for currency, but the information is being gathered locally in Poland where 1000,00 is the format.
My question is, in VB6 is there a function that takes a currency string in a local format and converts to another, or will I just have to parse the string and replace , or . ?
BTW I have looked at CCur, but not sure if that will do what I want.
The data is not actually stored as the string "£1000.00"; it's stored in some numeric format.
Sidebar: Usually databases are set up to store money amounts using either the decimal data type (also called money in some DBs), or as a floating point number (also called double).
The difference is that when it's stored as decimal certain numbers like 0.01 are represented exactly whereas in double those numbers can only be stored approximately, causing rounding errors.
The database appears to be storing the number as "£1000.00" because something is formatting it for display. In VB6, there's a function FormatCurrency which would take a number like 1000 and return a string like "£1000.00".
You'll notice that the FormatCurrency function does not take an argument specifying what type of currency to use. That's because it, along with all the other locale-specific functions in VB, figures out the currency from the current locale of the system (from the Windows Control Panel).
That means that on my system,
Debug.Print FormatCurrency(1000)
will print $1,000.00, but if I run that same program on a Windows computer set to the UK locale, it will probably print £1,000.00, which, of course, is something completely different.
Similarly, you've got some code, somewhere, I can't tell where, in Poland, it seems, that is responsible for parsing the user's string and converting it to a number. And if that code is in Visual Basic, again, it's relying on the control panel to decide whether "." or "," is the thousands separator and whether "," or "." is the decimal point.
The function CDbl converts its argument to a number. So for example on my system in the US
Debug.Print CDbl("1.200")
produces the number one point two, on a system with the Control Panel set to European formatting, it would produce the number one thousand, two hundred.
It's possible that the problem is that you have someone sitting a computer with the regional control panel set to use "." as the decimal separator, but they're typing "," as the decimal separator.
What database are you using? And what data type is the amount stored in?
As long as you are always converting from one format to another, you do not need to do any parsing, just replace "." with "," or the other way around. You may need to remove the "£"-sign as well if that is stored in your string.
There's probably a correct answer dealing with culture objects and such, but the easiest way would be to taken the input from the polish input, and replace the , with a ., and then store it in your database as type "money" or "decimal". If you know they (possibly configurable per user) are always entering numbers in either Polish or English, you could have a function that you run all the input numbers through to convert the string to a proper "decimal" typed variable. Also, for display purposes you could run it through another similar function to ensure that the user always sees the number format they are comfortable with. The key here is to switch it to a decimal as soon as you get it from the user, and only switch it back to a string at the last step before sending it out to the user.
#KiwiBastard yes i would think so. Are you storing your amount in an "(n)varchar" field or are you using a currency/decimal type field? If the latter is the case, the currency-symbols and separators are added by your client, and there would be no need to replace anything in the database.

Resources