Tuesday, August 7, 2018

How to increase the number of processes in Oracle DB

The solution to this question is to increase the number of processes :

  1. Open command prompt
  2. sqlplus / as sysdba
  3. startup force;
  4. show parameter processes; -- This shows 150 processes allocated, i will increase the count to 800 now
  5. alter system set processes=800 scope=spfile;

Tried and tested.


Monday, July 2, 2018

How to setup a beyond compare as git mergetool?

How to set up a beyond compare as git mergetool?

git config --global diff.tool bc3
git config --global difftool.bc3.path "c:/program files/beyond compare 4/bcomp.exe"
git config --global merge.tool bc3
git config --global mergetool.bc3.path "c:/program files/beyond compare 4/bcomp.exe"



If the above instructions aren't working on your system, it's possible repository local settings are overriding the global settings.
The contents of the global git config file (c:\users\username\.gitconfig) from my working test system:

[diff]
        tool = bc3
[difftool "bc3"]
        path = c:/program files/beyond compare 4/bcomp.exe
[merge]
        tool = bc3
[mergetool "bc3"]
        path = c:/program files/beyond compare 4/bcomp.exe


Monday, May 28, 2018

How to merge a branch in git

Follow the commands below to do the auto merge the branch in git:

$ git checkout -b {new-branch-name}
$ git merge --no-ff {old-branch-name}
$ git push -u origin {new-branch-name}

Friday, May 25, 2018

Concatenating and combining lists in Python

CODE:
[4, None, 'foo'] + [7, 8, (2, 3)]

or

x = [4, None, 'foo']
x.extend([7, 8, (2, 3)])
print(x)


OUTPUT:
[4, None, 'foo', 7, 8, (2, 3)]



Ternary expressions in Python

A ternary expression in Python allows you to combine an if-else block that produces
a value into a single line or expression. The syntax for this in Python is:

value = true-expr if condition else false-expr

Here, true-expr and false-expr can be any Python expressions. It has the identical
effect as the more verbose:

if condition:
    value = true-expr
else:
    value = false-expr


This is a more concrete example:

CODE:
x = 5
'Non-negative' if x >= 0 else 'Negative'

OUTPUT:
'Non-negative'

What is pass in Python

pass is the "no-op" statement in Python. It can be used in blocks where no action is to
be taken (or as a placeholder for code not yet implemented); it is only required
because Python uses whitespace to delimit blocks:

Eg:

if x < 0:
    print('negative!')
elif x == 0:
    # TODO: put something smart here
    pass
else:
    print('positive!')

How to chain comparisons in Python

CODE:
print(4 > 3 > 2 > 1)


OUTPUT:
True


What are the datetime format specifications (ISO C89 compatible) in Python

Below are the Datetime format specification (ISO C89 compatible) in Python:




Why triple quotes (" " ") are used in Python

For multiline strings with line breaks, you can use triple quotes, either ''' or " " ":

c = """
This is a long string that
spans multiple lines
"""

Standard Python scalar types

Below are the standard Python scalar types:

Type: Description
None: The Python "null" value (only one instance of the None object exists)
str: String type; holds Unicode (UTF-8 encoded) strings
bytes: Raw ASCII bytes (or Unicode encoded as bytes)
float: Double-precision (64-bit) floating-point number (note there is no separate double type)
bool: A True or False value
int: Arbitrary precision signed integer