This question already has answers here:
Decrypt from SHA256
(3 answers)
Closed 2 years ago.
I want to decode the below hash value to text.
bb37497f9b8cdcccf20ff6eee342bc1f76f72f35a7305af28a81b75d3967ea2f.
I tried below function but gives me the output in special characters
select UTL_I18N.RAW_TO_CHAR('bb37497f9b8cdcccf20ff6eee342bc1f76f72f35a7305af28a81b75d3967ea2f', 'AL32UTF8') from dual;
output
�7I����v�0Z]9g
any other function would give me the text value?
Hash functions are deliberately one way. So you cannot get the original value from the hash value. (You could use brute force and hash all possible original values and see which yields the given hash value. But that's likely not finishing in your lifetime and will produce false positives because of collisions. So you'd even need some second criteria.) Not in Oracle, not anywhere else...
Related
I have a column containing user entry descriptions, these descriptions can be anything however i do need them sorted into a logical order.
The text can be anything like
16 to 26 months
40 to 60 months
Literacy
Mathematics
When i order these in sql statement the text items return fine. However any beginning with numbers come back in an order not logical
i.e.
16 to 26 months
will be before
8 to 20 months
i understand why as it takes first character etc but don't know how to alter sql statement (using sqlite) to improve the performance without messing up the entries beginning with text
When i cast to numeric the numbers are fine the items beginning with text go wrong
Thanks
What you need is sorting the values in "natural order". To achieve this you will need to implement your own collating sequence; SQLite doesn't provide one for this case.
There are some questions (and answers) regarding this topic here on SO, but they are for other RDBMS. The best I could find in a quick search was this:
http://wiki.ozanh.com/doku.php?id=python:database:sqlite:how_to_natural_sort
You should think about improving your table schema, e. g. splitting the period into separate integer columns (monthsMin, monthsMax) instead of using text, which would make sorting much easier. You can always build a string from this values if necessary.
I guess this is a very naive question but could not goolge it.
I see in various pages on sqlite site that mention a type-name can have up to 2 signed numbers
https://www.sqlite.org/lang_createtable.html
https://www.sqlite.org/datatype3.html
In the later there is an example DECIMAL(10,5)
What this mean? I suppose it is a kind of magnitude/precision, what would 2 numbers mean for both integer and text?
Thanx in advance.
Phi
Please Look at this question for more clarification.
How to use SQLite decimal precision notation
It says, the declared data type has no effect on the values that can be stored in the column.
DECIMAL(10, 5) column has a numeric affinity so It stores Text '2' as integer 2.
This question already has answers here:
Matching multiple patterns
(6 answers)
Closed 7 years ago.
I am trying to understand how R deals with string manipulation and comparisons.
To this end I have set up two data frames, one which is my raw data and the other which is my reference data to which I would like to compare. I'm trying to understand the different ways of comparing strings and how to compare data frames in general (it seems far easier in SQL where you can just use the key word contains).
For the example below, the first item is the reference data and the second is the raw data.
grepl ("1845","UN1845")
Will return TRUE
any ("1845"=="UN1845")
Will return FALSE (I assume here because the word has to match fully)
is.element ("1845","UN1845")
Will return FALSE (same reason as the the any)
If I wanted to check the entire data reference table against each and every item in the raw table, how would I go about this?
From playing around I could do something like
grepl(Raw$Contents, Ref$desc)
Where the Raw data is basically strings and the ref data is strings. However when I run something like this, I get the message:
In grepl(Raw$Contents, MyCode$desc)
argument 'pattern' has length > 1 and only the first element will be used
I assume this is related to the fact that the table size for the reference table is different to the table I'm running comparisons against.
Sample data:
rawdata = data.frame(A=c("UN1845","FROZEN FOOD DRY ICE","LTD QTY8000"))
refdata = data.frame(A=c("1845","8000"))
The errror message means: your pattern argument has more than one element, but grepl and its family only accept one pattern at a time. You will have to loop (or *apply) over each pattern in your refdata collection.
EDIT: to clarify: grepl only accepts one pattern, but if that pattern contains the complete search set, e.g. via the OR operator, grepl will function as desired. thanks to David Arenburg for his comments.
This question already has answers here:
Regular expression to enforce complex passwords, matching 3 out of 4 rules
(4 answers)
Closed 8 years ago.
I would like to use a regular expression in the ASP.NET membership. What is a regular express for the below?
at least 8 characters long
include at least one upper case letter
one lower case letter
one number
try this..
^((?=.*\d)(?=.*[A-Z])(?=.*[a-z]).{8,})
You could use something like that:
^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d=:;<>,~!##\\$%/^&)(\[\]+-]{8,}$
Test it here.
You may also want to learn about the "?=" thing, which is called "positive lookahead" here.
In short, when all three lookaheads (.*\d and .*[a-z] and .*[A-Z]) are matched (and are discarded), the main regex [a-zA-Z\d=:;<>,~!##\\$%/^&)(\[\]+-]{8,} can be matched too.
Do you have to do this in one regex? I would make each of those rules one regex, and test for them individually. I suspect you code will end up being simpler, and you'll save yourself and whoever has to maintain your application several headaches.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
What is the most efficient way to reach a spot on sight on VIM?
With the code like this:
[caret here]create_stage :pay_deposit, due: deposit_due_date, actual: deposit_paid_date, action: 'Deposit', status: status
I want to jump right to/before/after the Nth comma (or at least around) of actual: deposit_paid, [need to be here], action: 'etc'
What is the most efficient way of doing it? (I currently just w-w-w which sucks, also could start counting number of words to use something like 12w but that just distracts too much).
I don't want search since I do want to keep current search and highlighting.
You can combine the f motion with a [count], so for your example, 3f, would be the shortest way. (And if you have miscounted, you can correct with ; and ,.)
f,;;; or use easymotion and probable dupe of What is the most efficient way to reach a spot on sight on VIM?
What about searching the comma character?
/, and then input a number, say 3 and then type n or N to locate all commas in the doc?