Is it possible into Kaltura referenceId length <2, while I am passing referenceId length <2 its showing error like this
"KalturaMediaEntry::referenceId" must have a min length of 2
characters
referenceId is limited to 2 characters.
See:
For insert: https://github.com/kaltura/server/blob/Naos-14.3.0/api_v3/lib/types/entry/KalturaBaseEntry.php#L541
For update: https://github.com/kaltura/server/blob/Naos-14.3.0/api_v3/lib/types/entry/KalturaBaseEntry.php#L696
You can append a constant character to your Reference Ids (like _) when you insert or update and remove it when you need to do the look up in your own system.
Related
Examples:
1.99 --> $1.99
1.9 --> $1.90
1 --> $1.00
1.005 --> $1.01
1.004 --> $1.00
I am using {{num | currency:'USD':true}} but it does not show trailing 0s.
Use this code. Here is a working example http://plnkr.co/edit/xnN1HnJtTel6WA24GttR?p=preview
{{num | currency:'USD':true:'1.2-2'}}
Explanation :
number_expression | number[:digitInfo]
Finally we get a decimal number as text. Find the description.
number_expression: An angular expression that will give output a number.
number : A pipe keyword that is used with pipe operator.
digitInfo : It defines number format.
Now we will understand how to use digitInfo. The syntax for digitInfo is as follows.
{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}
Find the description.
minIntegerDigits : Minimum number of integer digits. Default is 1. (in our case 1)
minFractionDigits : Minimum number of fraction digits. Default is 0. (in our case 2)
maxFractionDigits : Maximum number of fraction digits. Default is 3. (in our case 2)
well you got the correct answer but still i think i can elaborate more this answer so posting it as answer:
First of all there are number of pipes available of the angular2 to use in our project some of them are listed below
CurrencyPipe , DatePipe, UpperCasePipe, LowerCasePipe, and PercentPipe and many more.
Here as your question you have problem related to currency pipe. so i want to explain bit more as other answers.
CurrencyPipe :
A pipe may accept any number of optional parameters to fine-tune its output. We add parameters to a pipe by following the pipe name with a colon ( : ) and then the parameter value (e.g., currency:'EUR'). If our pipe accepts multiple parameters, we separate the values with colons (e.g. slice:1:5).
{{number | currency:'your_type':true:'1.2-2'}}
here...first parameter is currency type which is either EUR,USD or anything, Second parameter is true/false for the symbolDisplay which is false byDefault. then Third one is range limit basically a range limit . You can set a min and max length after the decimal point and a fixed number (or leave it blank for default) for the places before the decimal point.
I have found some good tutorials for the pipes in the angular2 which i am posting here..
http://voidcanvas.com/angular-2-pipes-filters/
https://angular.io/docs/ts/latest/guide/pipes.html
Hope it Helps and clarify more about pipes !!
#Pardeep !!
You are using the correct pipe. You just need to add the digit info to the output.
{{num | currency:'USD':true}} should be...
{{num | currency:'USD':true:'1.2-2'}}
For reference: 'USD' represents the type of currency, true represents whether to show the currency symbol ($), and '1.2-2' represents the digit info.
The digit info is {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}.
minIntegerDigits is the minimum number of integer digits to use and defaults to 1.
minFractionDigits is the minimum number of digits after fraction and defaults to 0.
maxFractionDigits is the maximum number of digits after fraction and defaults to 3.
Source for the digit info can be found here: https://angular.io/docs/ts/latest/api/common/index/DecimalPipe-pipe.html
If, like me, you're trying to do this in the typescript/javascript rather than HTML, you can also use toLocaleString
So to convert a number to a currency string:
ppCurrency(number) {
return number.toLocaleString('en-US', { style: 'currency', currency: 'USD' });
}
Following will convert with 2 decimal digits
{{num | currency : '$' : 2}}
angular 2
{{num | currency:'USD':true:'1.2-2'}}
<input type="number" [(ngModel)]="myModel" (keyup)="onBlurMethod()">
<br>
<br> The formatted currency is :
<br> {{myModel | currency:'USD':true:'1.2-2' }}
Here is the working example.
http://plnkr.co/edit/pSK8p7u3oo4WsAB9aFBS?p=preview
If any body gets a warning and wanted to resolve it, please find below the fix I used.
Following is the warning Angular displays in browser console:
Warning: the currency pipe has been changed in Angular v5. The
symbolDisplay option (third parameter) is now a string instead of a
boolean. The accepted values are "code", "symbol" or "symbol-narrow".
The format that causes the warning: currency: "USD":true:"1.2-2"
Fix: currency: "USD":'symbol':"1.2-2"
Reference: https://angular.io/api/common/CurrencyPipe
I have a string called indicators, that the original developer of this application used to store single characters to indicate certain components of a model. I need to change the 7th character in the string, which I tried to do with the following code:
indicators[6] = "R"
The problem, I discovered quickly, was that the string is not always 7 characters long. For example, I have one set of values with U 2, that I need to convert to U 2 R (adding an additional space after the 2). Is there an easy way to force character count with Ruby?
use String.ljust(integer, padstr=' ')
If integer is greater than the length of [the receiver], returns a new String of
length integer with [the return value] left justified and padded with padstr;
otherwise, returns [an unmodified version of the receiver].
indicators = indicators.ljust(7)
indicators[6] = "R"
I have a string of words and I must determine the longest substring so that the latest 2 letters of a word must be the first 2 letters of a word after it.
For example, for the words:
star, artifact, book, ctenophore, list, reply
Edit: So the longest substring would be star, artifact, ctenophore, reply
I'm looking for an idea to solve this problem in O(n). No code, I appreciate any sugestions on how to solve it.
The closest thing to O(n) I have is this :
You should mark every word with an Id. Let's take your example :
star => 1st substring possible. Since you're looking for the longest substring, if a substring stars with ar, it's not the longest, because you can add star in the front.
let's set the star ID to 1, and its string comparison is ar
artifact => the two first character matches the first possible substring. let's set the artifact ID to 1 as well, and change the string comparison to ct
book => the two first character don't match anything in the string comparisons (there's only ct there), so we set the book ID to 2, and we add a new string comparison : ok
...
list => the first two character don't match anything in the string comparisons (re from ID == 1 and ok from ID ==2 ), so we create another ID = 3 and another string comparison
In the end, you just need to go through the IDs and see which one has the most elements. You can probably count it as you go as well.
The main idea of this algorithm is to memorize every substring we're looking for. If we find a match, we just update the right substring with the two new last characters, and if we don't, we add it to the "memory list"
Repeating this procedure makes it O(n*m), with m the number of different IDs.
First, read in all words into a structure. (You don't really need to, but it's easier to work that way. You could also read them in as you go.)
Idea is to have a lookup table (such as a Dictionary in .NET), which will contain key value pairs such that each two last letters of a word will have an entry in this lookup table, and their corresponding value will always be the longest 'substring' found so far.
Time complexity is O(n) - you only go through the list once.
Logic:
maxWord <- ""
word <- read next word
initial <- get first two letters of word
end <- get last two letters of word
if lookup contains key initial //that is the longest string so far... add to it
newWord <- lookup [initial] value + ", " + word
if lookup doesn't contain key end //nothing ends with these two letters so far
lookup add (end, newWord) pair
else if lookup [end] value length < newWord length //if this will be the longest string ending in these two letters, we replace the previous one
lookup [end] <- newWord
if maxWord length < newWord length //put this code here so you don't have to run through the lookup table again and find it when you finish
maxWord <- newWord
else //lookup doesn't contain initial, we use only the word, and similar to above, check if it's the longest that ends with these two letters
if lookup doesn't contain key end
lookup add (end, word) pair
else if lookup [end] value length < word length
lookup [end] <- word
if maxWord length < word length
maxWord <- word
The maxWord variable will contain the longest string.
Here is the actual working code in C#, if you want it: http://pastebin.com/7wzdW9Es
Please consider the following XML--
<table class="rel_patent"><tbody>
<tr><td>Name</td><td>Description</td></tr>
<tr><td>A</td><td>Type-A</td></tr>
<tr><td>B</td><td>Type-B</td></tr>
<tr><td>C</td><td>Type-C</td></tr>
<tr><td>AC</td><td>Type-C
Type-A</td></tr>
<tr><td>D</td><td></td></tr>
</tbody></table>
Now I want to select and display all values of "Name" with corresp. values of "Description" element...even when Description element has null values viz element with name=D, and also, when description element has values separated by enter then I want those values (of Description) in separate rows- viz Type-C and Type-A for element with name=AC
This is the type of query I have written--
let $rows_data:= $doc//table[#class="rel_patent"]/tbody/tr[1]/following-sibling::tr
for $data_single_row in $rows_data
return
let $cited_name:= $data_single_row/td[1]
let $original_types_w_return:= $data_single_row/td[4]
let $original_types_list:= tokenize($original_types_w_return, '(\r?\n|\r)$')
for $cited_type_each at $pos2 in $original_types_list
return concat( $cited_name, '^', $original_type_each, '^', $pos2)
However, I am getting the following type of response--
A^Type-A^1
B^Type-B^1
C^Type-C^1
AC^Type-C
Type-A^1
Now, I need to get the following correct in the above code+response---
(1) The data for "AC" should be 2 separate rows with "Type-C" and "Type-A" being in each of the 2 rows along with corresp. value for last field in each row as 1 and 2 (because these are 2 values)
(2) The data for "D" is not being shown at all.
How do I correct the above code to conform with these 2 requirements?
This works:
for $data_single_row in $rows_data
return
let $cited_name:= $data_single_row/td[1]
let $original_types_w_return:= $data_single_row/td[2]
let $original_types_list:= tokenize(concat($original_types_w_return, " "), '(\r?\n|\r)')
for $cited_type_each at $pos2 in $original_types_list
return concat( $cited_name, '^', normalize-space($cited_type_each), '^', $pos2)
(The first change was to replace $original_type_each with $cited_type_each and [4] with [2] which may ).
The first problem can be solved by removing the $ at the end of the tokenize parameter, since in the default mode $ only match the end of the string.
The second one is solved by adding an space $original_types_w_return, so it is not empty and tokenize returns something, and then removing it again with normalize-space (in XQuery 3.0 it could probably be solved by using 'allowing empty' in the for expression)
Dim str as String
str = "30 40 50 60"
I want to count the number of substrings.
Expected Output: 4
(because there are 4 total values: 30, 40, 50, 60)
How can I accomplish this in VB6?
You could try this:
arrStr = Split(str, " ")
strCnt = UBound(arrStr) + 1
msgBox strCnt
Of course, if you've got Option Explicit set (which you should..) then declare the variables above first..
Your request doesn't make any sense. A string is a sequence of text. The fact that that sequence of text contains numbers separated by spaces is quite irrelevant. Your string looks like this:
30 40 50 60
There are not 4 separate values, there is only one value, shown aboveāa single string.
You could also view the string as containing 11 individual characters, so it could be argued that the "count" of the string would be 11, but this doesn't get you any further towards your goal.
In order to get the result that you expect, you need to split the string into multiple strings at each space, producing 4 separate strings, each containing a 2-digit numeric value.
Of course, the real question is why you're storing this value in a string in the first place. If they're numeric values, you should store them in an array (for example, an array of Integers). Then you can easily obtain the number of elements in the array using the LBound() and UBound() functions.
I agree with everything Cody stated.
If you really wanted to you could loop through the string character by character and count the number of times you find your delimiter. In your example, it is space delimited, so you would simply count the number of spaces and add 1, but as Cody stated, those are not separate values..
Are you trying to parse text here or what? Regardless, I think what you really need to do is store your data into an array. Make your life easier, not more difficult.