Requirement Analysis
Learn Oracle Applications Tech-Stack
Sunday 26 September 2021
Tuesday 24 August 2021
trapping-rain-water
https://leetcode.com/problems/trapping-rain-water/
brute-force
water at any x = min( max_left_of_x, max_right_of_x) - height_of_x
two-pointer solution
when keeping
1)
- p_start, at 0
- p_end at 11 [length-1] of array
- check,
- p_start height is less. => 0
- p_end height is less => 1
- answer: p_start => 0 is lesser
- height at 0 is less
- p_start becomes our p_current pointer.
- with respect to p_current
- we check
- max_left
- max_right
- whenever we check which is lesser p_start, p_end, we are actually evaluating min(p_start, p_end)
- by checking min, of two, we get the level, which water can be filled.
formula
Level => check min of p_start, p_end
current_level = min(p_start, p_end)
if p_start is less, we start from left, and
- make max_left = height_at_p_start
- make max_right = height_at_p_end
- we consider level = max_left
-
***incomplete post
Friday 16 April 2021
Bit Byte and Binary
Ref: https://www.quora.com/What-is-the-relationship-between-binary-and-bytes
Binary is a numbering system. Bytes is an arbitrary grouping of digits.
In particular: Binary is a numbering system where each digit can hold one of two values (0 or 1). As opposed to the normal numbering system we humans tend to use, decimal where each digit can hold one of ten values (0123…9). It works pretty similar in all positional numbering systems, it’s just the base which differ. E.g. the position means the digit is multiplied by a power of the base, position 0 is base^0, position 1 (2nd) is base^1, and so on. Thus the 5th position in decimal is multiplied by 10^4 = 10000, similarly the 3rd position in binary is multiplied by 2^4 = Bx10000 = 16. Same can happen with other bases too, e.g. in octal the base is 8 (012..7), hexadecimal (sometimes just called hex) it’s 16 (012..89AB..EF).
In computers binary is used because it maps onto the way a computer works very nicely. I.e. each electrical signal can be either on or off - mapping onto a 1 or a 0.
A byte is just grouping consecutive signals so they can be seen as individual values with more possibilities than two. There used to be computers with bytes ranging from 6 through 20, but since around the 1960s the 8bit long byte started to become popular and has since become the standard.
This means each byte contains 8 binary digits (bits)
capable of holding values ranging from Bx00000000 = 0 through to Bx11111111 = 255 (i.e. 2^8=256 possible values).
Usually a byte maps onto a character used in text. Depending on what encoding the computer (and the operating system) uses, each of those values could mean a different character glyph. E.g. ascii decimal binary hex conversion chart
It’s thus become a useful way of defining sizes. Meaning the number of bytes maps pretty closely to the number of characters you can store. Not always, since some encodings use more than one byte per character (e.g. UTF8 can use one byte or it could use several). Also, not all data is in character form, e.g. storing a number is more efficient to store it directly in binary instead of just the characters which would represent each digit - so you get integer values which could be 16bits (2 bytes), 32bits (4 bytes), 64bits (8 bytes) or many other combinations. Also fractional numbers as in a double precision floating point using 32bits (4 bytes) to hold a sign, exponent and value to define the number.
Monday 12 April 2021
How to attach or assign request set to responsibility
DECLARE
l_request_set_code VARCHAR2(40) := 'XX_REQ_SET_CODE';
l_appl_short_name VARCHAR2(3) := 'XXCOM';
l_request_group VARCHAR2(40) := 'XXCOM Receivables Billing';
l_req_appl_short_name VARCHAR2(40) := 'AR';
BEGIN
IF NOT fnd_set.set_in_group(request_set => l_request_set_code,
set_application => l_appl_short_name, --REQUEST SET APPLICATION SHORT NAME
request_group => l_request_group,---REQUEST GROUP NAME
group_application => l_req_appl_short_name--REQUEST GROUP APPLICATION SHORT NAME
) then
DBMS_OUTPUT.PUT_LINE ('Request Set not found, adding..');
fnd_set.add_set_to_group(request_set => l_request_set_code,
set_application => l_appl_short_name, --REQUEST SET APPLICATION SHORT NAME
request_group => l_request_group,---REQUEST GROUP NAME
group_application => l_req_appl_short_name--REQUEST GROUP APPLICATION SHORT NAME
);
else
dbms_output.put_line('"XX_REQ_SET_CODE" already added to request group ');
END IF;
dbms_output.put_line('"XX_REQ_SET_CODE" attached to request group Succesfully ');
COMMIT;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error in attaching "XX_REQ_SET_CODE" to Request Group ' || sqlerrm);
END;
Monday 20 April 2020
VB Macro Programming
Tabs: data, reason, prod
Sub ValidateData()
Dim x As Integer
'set error status and error message columns as Null
Range("Data!CQ:CQ") = vbNullString
Range("Data!CR:CR") = vbNullString
'convert complete sheet to text format so that there are no scientific numerics
Worksheets("Data").Activate
Worksheets("Data").Range("A:CP").Select
Selection.NumberFormat = "#"
'Count Number of Rows in Sheet.
Range("Data!A3").Select
maxrow = 0
Do Until ActiveCell.Value = vbNullString
maxrow = ActiveCell.Row
ActiveCell.Offset(1, 0).Select
Loop
'update number of rows in A1
Cells(1, 1) = maxrow
maxrow = maxrow + 1
Range("Data!A1:CQ" & maxrow).Interior.ColorIndex = 15
'Trx Date Validation Started ############################################
Range("Data!E3").Select
Do Until ActiveCell.Row = maxrow
' Check if the Trx Date is of Length 11 (DD-MON-YYYY)
If Len(ActiveCell.Value) <> 11 Then
ActiveCell.Interior.ColorIndex = 6 'Highlight with Yellow Color
'update the flag = E
Cells(ActiveCell.Row, 95).Value = "E"
Cells(ActiveCell.Row, 96).Value = Cells(ActiveCell.Row, 96).Value & "- Trx Date has to be of Length 11"
Else
ActiveCell.Interior.ColorIndex = 15 'Retain Grey Color
End If
ActiveCell.Offset(1, 0).Select
Loop
'Trx Date Validation Completed '#############################################
'##########GL Date Validation Started ############################################
Range("Data!F3").Select
Do Until ActiveCell.Row = maxrow
' Check if the GL Date is of Length 11
If Len(ActiveCell.Value) <> 11 Then
ActiveCell.Interior.ColorIndex = 6 'Highlight with Yellow Color
'update the flag = E
Cells(ActiveCell.Row, 95).Value = "E"
Cells(ActiveCell.Row, 96).Value = Cells(ActiveCell.Row, 96).Value & "- GL Date has to be of Length 11"
Else
ActiveCell.Interior.ColorIndex = 15 'Retain Grey Color
End If
ActiveCell.Offset(1, 0).Select
Loop
'#######GL Date Validation Completed '#############################################
'##########Amount Validation Started ############################################
Range("Data!AQ3").Select
Do Until ActiveCell.Row = maxrow
If IsNumeric(ActiveCell.Value) = True Then
Dim av_pos As Integer
av_pos = InStr(InStr(Cells(ActiveCell.Row, 8).Value, "_") + 3 _
, Cells(ActiveCell.Row, 8).Value _
, "_")
Dim av_trxType As String
'extract CN, DN, GINV from trx type
av_trxType = Mid(Cells(ActiveCell.Row, 8).Value, av_pos + 2, Len(Cells(ActiveCell.Row, 8).Value) - av_pos + 1)
'MsgBox ("amount validation " & av_trxType)
If av_trxType = "CN" And ActiveCell.Value > 0 Then
ActiveCell.Interior.ColorIndex = 6 'Highlight with Yellow Color
'update the flag = E
Cells(ActiveCell.Row, 95).Value = "E"
Cells(ActiveCell.Row, 96).Value = Cells(ActiveCell.Row, 96).Value & "- for CN Amount should be < 0"
Else
ActiveCell.Interior.ColorIndex = 15 'Retain Grey Color
End If
If (av_trxType = "DN" Or av_trxType = "INV") And ActiveCell.Value < 0 Then
ActiveCell.Interior.ColorIndex = 6 'Highlight with Yellow Color
'update the flag = E
Cells(ActiveCell.Row, 95).Value = "E"
Cells(ActiveCell.Row, 96).Value = Cells(ActiveCell.Row, 96).Value & "- for DN/inv Amount should be > 0"
Else
ActiveCell.Interior.ColorIndex = 15 'Retain Grey Color
End If
End If
ActiveCell.Offset(1, 0).Select
Loop
'#######Amount Validation Completed '#############################################
'##########UNIT PRICE Validation Started ############################################
Range("Data!AQ3").Select
Do Until ActiveCell.Row = maxrow
If IsNumeric(ActiveCell.Value) = True Then
Dim vup_pos As Integer
vup_pos = InStr(InStr(Cells(ActiveCell.Row, 8).Value, "_") + 3 _
, Cells(ActiveCell.Row, 8).Value _
, "_")
Dim vup_trxType As String
'extract CN, DN, GINV from trx type
vup_trxType = Mid(Cells(ActiveCell.Row, 8).Value, vup_pos + 2, Len(Cells(ActiveCell.Row, 8).Value) - vup_pos + 1)
'MsgBox ("unit price validation " & vup_trxType)
If vup_trxType = "CN" And ActiveCell.Value > 0 Then
ActiveCell.Interior.ColorIndex = 6 'Highlight with Yellow Color
'update the flag = E
Cells(ActiveCell.Row, 95).Value = "E"
Cells(ActiveCell.Row, 96).Value = Cells(ActiveCell.Row, 96).Value & "- for CN Unit Price should be < 0"
Else
ActiveCell.Interior.ColorIndex = 15 'Retain Grey Color
End If
If (vup_trxType = "DN" Or vup_trxType = "INV") And ActiveCell.Value < 0 Then
ActiveCell.Interior.ColorIndex = 6 'Highlight with Yellow Color
'update the flag = E
Cells(ActiveCell.Row, 95).Value = "E"
Cells(ActiveCell.Row, 96).Value = Cells(ActiveCell.Row, 96).Value & "- for DN/inv Unit price should be > 0"
Else
ActiveCell.Interior.ColorIndex = 15 'Retain Grey Color
End If
End If
ActiveCell.Offset(1, 0).Select
Loop
'#######UNIT PRICE Validation Completed '#############################################
'##########Reason ############################################
Range("Data!AA3").Select
Dim xRow, yCol As Integer
Do Until ActiveCell.Row = maxrow
'xRow = ActiveCell.Row
'yCol = ActiveCell.Column
If Len(ActiveCell.Value) <> 0 Then
' Check if the Reason Code exists in list
Dim vfound, vTrxTypefound As String
vfound = vbNullString
vTrxTypefound = vbNullString
For Each c In Range("ReasonList!A1:A200")
If c.Value = vbNullString Then
Exit For
End If
If c.Value = ActiveCell.Value Then
vfound = vbNullString
vTrxTypefound = vbNullString
vfound = "Y"
Dim trxTypeRef As String
trxTypeRef = Range("ReasonList!B" & c.Row)
'check if reason code is valid with doc type.
Dim pos As Integer
pos = InStr(InStr(Cells(ActiveCell.Row, 8).Value, "_") + 3 _
, Cells(ActiveCell.Row, 8).Value _
, "_")
Dim trxType As String
'extract CN, DN, GINV from trx type
trxType = Mid(Cells(ActiveCell.Row, 8).Value, pos + 2, Len(Cells(ActiveCell.Row, 8).Value) - pos + 1)
'MsgBox ("trxtype " & trxType)
'MsgBox ("trxTypeRef " & trxTypeRef)
If trxType = "INV" Then
trxType = "DN"
End If
If trxType = trxTypeRef Then
vTrxTypefound = "Y"
'MsgBox ("matched trx types")
Else
'MsgBox ("no match trx types")
vTrxTypefound = "N"
End If
Exit For
End If
Next c
If vfound = vbNullString Then
ActiveCell.Interior.ColorIndex = 6 'Highlight with Yellow Color
'update the flag = E
Cells(ActiveCell.Row, 95).Value = "E"
Cells(ActiveCell.Row, 96).Value = Cells(ActiveCell.Row, 96).Value & "- Reason Code Not Found"
Else
ActiveCell.Interior.ColorIndex = 15 'Retain Grey Color
End If
If vTrxTypefound = "N" Then
ActiveCell.Interior.ColorIndex = 6 'Highlight with Yellow Color
Cells(ActiveCell.Row, 95).Value = "E"
Cells(ActiveCell.Row, 96).Value = Cells(ActiveCell.Row, 96).Value & "- Reason Code for Trx Type Not Found"
End If
End If
ActiveCell.Offset(1, 0).Select
Loop
'#######Reason Code Validation Completed '#############################################
'##########ProductLine Code Validation Started ############################################
Range("Data!AB3").Select
Do Until ActiveCell.Row = maxrow
If Len(ActiveCell.Value) <> 0 Then
' Check if the prodline Code exists in list
Dim vProdLinefound As String
vProdLinefound = vbNullString
For Each c In Range("ProdList!A1:A1000")
If c.Value = vbNullString Then
Exit For
End If
If c.Value = ActiveCell.Value Then
vProdLinefound = "Y"
Exit For
End If
Next c
If vProdLinefound = vbNullString Then
ActiveCell.Interior.ColorIndex = 6 'Highlight with Yellow Color
'update the flag = E
Cells(ActiveCell.Row, 95).Value = "E"
Cells(ActiveCell.Row, 96).Value = Cells(ActiveCell.Row, 96).Value & "- ProductLine Not Found"
Else
ActiveCell.Interior.ColorIndex = 15 'Retain Grey Color
End If
End If
ActiveCell.Offset(1, 0).Select
Loop
'#######ProductLine Code Validation Completed '#############################################
End Sub