I am trying to log values for a meter at one minute intervals. In lieu of entering the full value each time, I want to be able to enter just the numbers that are different: as opposed to entering the difference of the values or the entire number.
I have a rather cumbersome formula for doing this and it's good for new digits greater than zero but less than ten, after that, it just adds the number to the total.
If I could just enter the new digits, that would be ideal, whether they be .65, 1.25, 35.95, or 501.69 etc.
Thank you!
I attacked it from the other direction and it now does what I want with a few less backflips.
It still removes the decimal so a trailing zero doesn't get lost in LEN().
Whatever the number of digits that are in the new number, it replaces that number of digits out of the original number with zeroes.
It adds the new number to the modified number.
It divides by 100 to get the decimal back.
I have no doubt there is a much more elegant way of doing this.
Thank you!
Related
I tried using xdmp:random(999999) but it sometimes generates a 5 digit value and sometimes a 6 digit value - Is there any way of getting the every time unique 6 digit value?
Simplest is to pad with zeros using fn:format-number:
format-number(xdmp:random(999999), '000000')
Alternatively, you could also look at sem:uuid-string, which gives better random results with a fixed string-length.
HTH!
If leading zeroes don’t work, make sure your base value is 100,000 and go up to 999,999.
xdmp:random(899999) + 100000
Find near duplicate string. Hi, I know there is a match, unique, duplicated function in R, but none of these does wha I'm really need. I've a unique column in my dataset that I need to go trough it to check if the number are nearly the same. For instance, the first element compared with the second has nearly equal pattern, except for the number '9'. The second compared with the third is nearly equal, except for the last number o the sequence, one is ending with 6 while other ending with 5. Lastly, the two last numbers are 100% equal. If I've used unique() function, only the last case would be correctly excluded.
I'm wondering if there is a function that I can flag nearly equal, maybe calculating the percentage of equality, so I can drive my attention to those cases with highly equality rate.
dat <- data.frame(text = c("87775956",
"987775956",
"987775955",
"987481732",
"987481732"))
I am currently working on particular algorithm, but I face with a problem that I'm not sure what I have to do to resolve it. I appreciate if anyone helps me out.
There are some objects{O1,O2,O3,.....}, each of them has a value that we don't know about its amount, we call them {V1,V2,V3,....} also there is another element we call it w(w1,w2,w3.....) which shows the difference between values, I mean w1=v2-v1, w2=v3-v2,w3=v4-v3 and so on. I'm wondering if there is any way to get value of v1,v2,v3...etc without having the value of V1?
Looking forward for your reply guys,
Thanks.
Not in general. Knowing the differences between successive numbers in a list of numbers under-determines the set of numbers. This is particularly obvious in the case when w1 = w2 = w3 = ... = wk = 1. That would tell you that the viare consecutive numbers, but nothing else could be inferred. You wouldn't be able to distinguish 3,4,5,6,7 from 10,11,12,13,14 (for example).
Having said that, it would of course be possible if you know one of the numbers, and the known number wouldn't need to be the first one. Knowing any single one of the numbers would suffice. Furthermore, knowing something like the sum of the vi would be sufficient since you could express the sum as a function of the unknown number v1 and solve the resulting equation.
I was wondering if there is an easy way in SAS to count sentences in a string?
In pseudo code I would search for the index of every ., ?, and !, and check if the index before that (-1 or -2) is a character.
Any better ideas?
Assuming that your sentences are correctly punctuated, there should be exactly 1 sentence per ?!., so in that case you can use countc(my_string,'?!.'). The main exceptions are probably interrobangs (?!,!?) and ellipses (...).
If your string contains lots of sentences with missing stops or double stops, one option is simply to cross your fingers and hope they more or less cancel out.
If there are lots of double stops but not so many missing ones, you could apply a regex to replace any run of consecutive stops with a single . before counting those, e.g. countc(prxchange('s/[\.!\?]{2,}/./',-1,string),'?!.').
I am trying to convert an entry using a numeric stepper in flex into words to display in a textarea.
i.e a user uses the stepper to enter "89" as a value and in the text area the words "Eighty nine" are displayed.
After much searching i haven't found anything that helps - a few javascript functions but that is all.
any help sample code would be much appreciated.
thanks in advance.
I would suggest you make a hash table with the numbers "0" to "99" as indices (enclosed in quotes) and the values being the word names for those numbers. That will make localization possible without out a lot of complicated code to determine, for example, the difference between "eleven" and "juu ichi" (ten one) in Japanese or between "ninety-nine" and "quatre vingt dix neuf" (eighty-nineteen) in French, "twenty-two" and "zwei und zwanzig" (two and twenty) in German, etc.
Let's name that hash table myNumberWords. Then you would simply convert your digits as follows:
function getWordsFromNumber(num:Number) : String {
return myNumberWords[num.toString()];
}
If you want to go higher than 99, add a hash for the words hundred, thousand, million, billion, etc., then split your whole number into an array and place the appropriate units after every 3rd number, counting from the top of the stack. You'll also have to have zero values and double-zero values counted as empty strings ("") except when there is only one digit and it is a zero, etc.