DronaBlog

Thursday, December 13, 2018

What are the features of Python Programming

Are you interested to know what are the features of the Python language? Would you like to start programming in Python and would be interested in knowing more about Python? If so, then you reached the right place. This article provides detailed information about the advantages of Python Programming.

Python Advantages:

  • Easy to learn
  • Object Oriented Programm
  • Portable (Cross-platform)
  • Expressive (Understandable and Readable)
  • Interpreted
  • GUI Programming
  • Free and Open source

1. Easy to learn:

Python is easy to learn compared to other programming languages such as Java, .NET or C++.  Python programming syntax is simple and easy to read and write. The concepts such as function, structures, expression can be easily understood by the beginner with ease. No exhaustive list of software is required to learn and work on Python programming. A simple editor such as notepad or development IDE such as PyCharm is enough to start with Python. If you are first time learning any programming language then Python is the best language to start with. Along with its simplicity, Python is also a very strong and robust language which can be used to developing enterprise applications.

2. Object Oriented Programming

Python is Object Oriented language. i.e. all features of Object Oriented programming such as inheritance, polymorphism, abstraction, and polymorphism are supported in Python. In Python class acts as the blueprint and it will be model for the objects. Every real-time entity such as human being, trees, non-living things can be represented as the object.
e.g. In the example below, the class for 'Cat' is presented using Python language.

class Cat:

    def __init__(self, cat_name, cat_age):  
        self.cat_name cat_name
        self.cat_age cat_age



3. Portable (Cross-Platform)

Python is a portable language. It is also known as cross-platform language. It means we can run the same program on different Operating Systems such as Windows or Mac or Unix as long as we have Python interpreter installed on these operating systems. We do not need to write program specific to any operating system. However, we need to keep in mind that there are some features which are dependent on the Operating System. Such features need to be handled properly if your program is going to run on multiple systems. 

4. Understandable and Readable

The breadth of ideas that can be represented and communicated using the Python language is quite better than other programming languages. There are some features in the Python language using which we can build the business functionalities extensively. These extensive features may not feasible in other languages. Programming in the Python language is easily understandable and readable which help us to build better and extensive programming functionalities. Hence, the Python language is expressive and it is one of the great features.

5. Interpreted language

Python is interpreted language. The source code in Python is executed line by line, unlike Java language where the complete code is compiled first and then it is executed. Python using an interpreter to interpret Python code. The interpreter converts Python source code to bytecode which operating system can understand and execute step by step.



6. GUI Programming

Python provides GUI programming framework by using which we can develop user interfaces. The framework TkInter can be used to build the user interface for Python. 

7. Free and Open Source

Python software is open source and it is freely available. No additional cost is required for the licensing. Python software and custom modules are freely available for download over the internet. The Python module communities provide a good number of Python useful utilities in the form of Python modules.




The video below provides detailed information about Python language -







Wednesday, December 12, 2018

Important MDM SQL Queries

This article provides important queries used for daily activities in the Informatica MDM. This article will continuously keep updating for interesting and important SQL queries which are used in day to day activities in MDM.




Survivorship Verification

Order of survivorship is a very important concept in the Informatica MDM. As per Informatica below is the order of precedence, 

1. By trust score (only if a column is trust-enabled). The data with the highest trust score wins. If the trust scores are
equal, or if trust is not enabled for a column, then proceed to the next comparison.
2. By SRC_LUD in the cross-reference(XREF) record. The data with the more recent cross-reference SRC_LUD value
wins. If the SRC_LUD values are equal, then proceed to the next comparison.
3. By ROWID_XREF in the cross-reference. ROWID_XREF values are evaluated in numeric descending order. The
data with the highest ROWID_XREF wins.

In order to verify the order of precedence working correctly or not, use below query -

select P.party_name, x.party_name as party_nm, x.rowid_object, x.orig_rowid_object, x.rowid_system,x.src_lud, x.rowid_xref, x.LAST_UPDATE_DATE,
rank() over (partition by x.rowid_object order by x.rowid_system desc , x.src_lud desc, cast(x.orig_rowid_object as decimal) desc , cast(x.rowid_xref as decimal) desc)) as r1 
from 
    CMX_ORS.C_BASE_PARTY P, 
    CMX_ORS.C_BASE_PARTY_XREF X 
where p.rowid_object = x.rowid_object


Monday, December 10, 2018

Issues noticed during Materialized View Creation - ORA-23413: table "CMX_ORS"."C_B_CUST" does not have a materialized view log



Did you encounter with ORA-23413 the Oracle database error while creating a Materialized view? Are you also noticing ORA-01031: insufficient privileges error? If yes, then refer below article about explanation and solution to these database errors?

SQL Error: ORA-23413: table "CMX_ORS"."C_B_CUST" does not have a materialized view log

Explanation: This type of error occurs if you try to create a Materialized view on table C_BO_CUST without creating the Materialized View Log. It is mandatory to create log definition first before creating actual Materialized View.

Error Message:
SQL Error: ORA-23413: table "CMX_ORS"."C_B_CUST" does not have a materialized view log
23413. 00000 -  "table \"%s\".\"%s\" does not have a materialized view log"
*Cause:    The fast refresh cannot be performed because the master table does not contain a materialized view log.

Solution: Use the sample below to create the Materialized View Log -
CREATE MATERIALIZED VIEW LOG ON C_B_CUST
   PCTFREE 5
   TABLESPACE CMX_TEMP
   STORAGE (INITIAL 5K NEXT 5K);



SQL Error: ORA-01031: insufficient privileges

Explanation: ORA-01031 - insufficient privileges is the generic message which normally occurs if required privileges are not available for given operation. In the case of Materialized view, if user does not have "CREATE MATERIALIZED VIEW" privileges then 'ORA-01031: insufficient privileges'  error message will be reported.

Error Message:
SQL Error: ORA-01031: insufficient privileges 01031. 00000 -  "insufficient privileges"
*Cause:    An attempt was made to change the current username or password 
           without the appropriate privilege. This error also occurs if
           attempting to install a database without the necessary operating
           system privileges.
           When Trusted Oracle is configure in DBMS MAC, this error may occur
           if the user was granted the necessary privilege at a higher label
           than the current login.

Solution: In order to get required privileges we need to reach out Oracle DBA. In the current case, we need to ask DBA to provide "CREATE MATERIALIZED VIEW" privileges to given user. Assume that you are using TEST_USER to create Materialized view then ask DBA to provide privileges below -
GRANT CREATE MATERIALIZED VIEW TO TEST_USER

The video below provides a detailed explanation and prerequisites for Material views : 




Friday, December 7, 2018

Important Python Interview Questions and Answers - Part III

Are you preparing for Python interview and looking for questions and answers? Would you also like learn Python concepts? If so, then read this article to prepare for your interview. If you have not read the previous article  then you can read here Important Python Interview Questions and Answers - Part II


Q 1: What is the use of PYTHONPATH environment variable in Python language?

Answer
  • The environment variables PATH and PYTHONPATH are similar. 
  • The variable PYTHONPATH provides information to Python interpreter in order to locate the module files or source code files which are imported in the source code.
  • Normally, PYTHONPATH includes source library directory and the directories which contain source code. 
  • The Python installer normally setup PYTHONPATH variable automatically. If it is not set then we have to manually set it.

Q 2: Explain the purpose of PYTHONCASEOK and PYTHONSTARTUP environment variable in Python?

Answer: The environment variables such as PYTHONCASEOK and PYTHONSTARTUP are important for Python programming and execution as like PYTHONPATH variable. 
  • PYTHONSTARTUP:
  1. This variable contains path of an initialization file containing Python source code.
  2. When we start the Python interpreter, initialization is executed each time.
  3. In the Unix system, it is named as pythonrc.py
  4. The commands are included to load utilities or change PYTHONPATH  
  • PYTHONCASEOK:
  1. It is used in the Windows operating system.
  2. It is used to find the first case-insensitive match in the import statement.
  3. To activate this variable, we can set it to any value.
  • PYTHONHOME:
  1. It is normally used within PYTHONSTARTUP or PYTHONPATH directories.
  2. It is used to make easines in switching module libraries. 


Q 3: How to convert a String value to an integer, a long and a float value in Python?

Answer: Converting String to other data types such as integer, long and float is common practice in Python programming. It is required for the various reason such as to perform arithmetic operations.
1. String to Int -
Use int function to convert the String value to an integer.
Syntax: Here, base specifies the base if x is a string.
int(x [,base])  
Example:
x = "5"
int_value = int(x) 
2. String to long -
Use long function to convert the String value to the long value.
Syntax: Here, base specifies the base if x is a string.
long(x [,base])  
Example:
x = "50000"
long_value = long(x) 
3. String to Float -
Use float function to convert the String value to the float value.
Syntax: Here, base specifies the base if x is a string.
float(x)  
Example:
x = "8.5"
float_value = float(x)

Q 4: What is the use of ** operator Python language?

Answer:  
  • It is an arithmetic operation. 
  • It is known as the Exponent operator.
  • It is used to perform an exponential i.e. Power calculation
e.g.  a = 4  and b = 5
       a **  b =  1024




Q 5: What is the use of // operator in Python language?

Answer:

  • The operator // is called floor division
  • It is the division of operands where the result is the quotient in which the digits after the decimal point are removed.








            



Wednesday, December 5, 2018

Important Python Interview Questions and Answers - Part II



In this article, we will see details on the most important questions which are asked during Python interviews. In the Python interview question and answers part - , we learned some basic questions. In this article, we learn more interesting questions and their answers in order to prepare for the Python interview. Good luck with your interview.



Q 1: What are the differences between List and Tuples?

Answer: The mentioned below is list differences between List and Tuples

List
Tuples
List elements can be changed as they are mutable
Tuples elements cannot be modified as they are immutable.
Normally, lists are slower compared to tuples during execution
Normally, tuples are faster than lists during execution of the program.
The list is created using open and close rectangular brackets
Tuples are created using open and close simple brackets
e.g. country_list = [“US”, “INDIA”, “UK”]
e.g. region_tuple = (“NA”, “APAC”, “LA”)


Q 2: Explain Multithreading concepts in Python?

Answer: The multithreading in Python is explained as below
  1. In order to achieve multithreading i.e. executing the program in parallel, Python has a multi-threading package.
  2. The concept named the Global Interpreter Lock (GIL) is used in Python.  It is the responsibility of GIL to make sure that only one ‘threads’ can execute at any a time. 
  3. The thread acquires GIL for processing business logic. Once processing is completed, it passes the GIL onto the next thread.
  4. This processing happens very quickly so to the human eye. On the surface, it looks like threads are running in parallel, but they are really just taking turns using the same CPU core.
  5. The extra overhead of working with GIL will cause extra processing time.



Q 3: What are the rules or standards for global and local variables in the Python language?

Answer:  The basic guidelines for local and global variables are as below
Global variables: The variables which are only referenced inside a function are implicitly global.

Local variables: The local variables are those variables for which a new value is assigned within the function's body.

Q 4: What are the supported data types in Python?

Answer: The supported data types in Python are 
  1. Number
  2. String
  3. List
  4. Tuple
  5. Dictionary
Here, the Number data type can include integer and float values.

You can refer the video below to learn more about Python programming -

Q 5: Is it possible to convert Integer value to String value and vice-versa in the Python language?

Answer: Yes, we can convert an integer value into the String value. Also, we can convert the String value to integer value.  

Normally, if we get input from the user is comes as String even it is number. So in such cases, we need to convert the String value to an integer value  as

    user_input = input("Enter any number")
    int_value = int(user_input)
    print(int_value * 5)

In some cases, we need to convert the numeric value to String value. e.g. Printing number value with appending string content.

       int_age_value = 25
   print("Age of a person is " + str(int_age_value))





                                        


Tuesday, December 4, 2018

Important Python Interview Questions and Answers - Part I


In this article, we will focus on the most important questions which are asked during Python interviews. If you preparing for Python interview then this article will be the good start. If any detailed explanation is required then respective links are provided for your knowledge. Good luck with your interview.



Q1. What are the differences between Python version 3 and Python Version 2?

Answer: Both the Python versions are important for Python programming and they come with their own significance. We will discuss here the differences between these two Python versions.

S. No
Python Version 3
Python Version 2
1.
Python version 3 supports -Unicode UTF-8 and it has two-byte classes –a) Byte b)ByteArray
Python version 2 supports - ASCII str() types and separate Unicode() but there is no byte type code
2.
To print, any string parentheses are required in Python version 3. It will raise error without parentheses.
In Python version 2, to print any string no parentheses are required
3.
If we try to compare un-orderable types then it raises ‘TypeError’ as the warning
Python version 2 silently ignore the error/warning we try to compare un-orderable types
4.
The SyntaxError will be reported when we don’t enclose the exception argument in parentheses.
In this version, it accepts both new and old notations of syntax.



You can refer the video tutorial on Python to better understand Python concepts -


Q 2: What is the memory management process in Python?

Answer: The memory management in Python is similar to other programming languages such as Java.
  • The allocation of heap space is done by the memory manager. It includes memory allocation for Python objects and data structures.
  • The private heap space is used in Python for memory management. The data structures and Python objects are located in this private heap memory. 
  • The Python interpreter interacts with memory and takes care of memory-related tasks.
  • The garbage collector is used to release memory of unused object and make memory available to the heap space. The garbage collector is the inbuilt feature, no special configuration is not required.

Q 3: How Python is interpreted?

Answer: 
  • Python language is an interpreted language. 
  • The program written by the developer is interpreted by Python interpreter. 
  • Once the source is interpreted, it is executed step by step. 
  • The Python program runs directly from the source code, unlike Java compiler where the complete file is compiled first and then it is executed.
In the figure below, HelloWorld.py a Python file is interpreted by Python interpreter and executed at runtime. The output is shown on the console.

Q 4: What is namespace in Python language?

Answer: 
  • The namespace in Python defines the scope for objects such as package, module, class, function.
  • Each module, package, class, and function owns a namespace. In this namespace, variable names are resolved.
  • The namespace is evaluated during execution and dropped after execution is completed.
  • The global namespace is used if the local namespace is not defined.
  • The variable name is checked in the local namespace i.e. in the body of the function or the module, etc. If the variable name is not found in a local namespace then it is checked in the global namespace.
  • The variables are generally created in a local namespace. 



Q 5: What are the module and the package in Python language?

Answer: 
a) Module: The module is the way to structure program. The module can contain one more many Python program file or files. The module can import other modules like the attributes and the objects.

b) Package:  The package is the folder in Python language. A package can have modules or subfolders.








Thursday, November 29, 2018

Very Important Unix Commands


Are you looking for an article for Unix commands which are used for daily activities? Are you looking for the Unix commands which are used for manipulating data? Are also willing to know what commands used for networking and compressing the files? If yes, then you can refer this article as it highlights on commands which are used for data manipulation, networking, messaging and compressing the files.

A) Commands used for manipulating data:


Command
Details
awk
Pattern scanning and processing language
cmp
Compares the contents of two files
comm
Compares sorted data
cut
Cuts out selected fields of each line of a file
diff
Differential file comparator
expand
Expands tabs to spaces
join
Joins files on some common field
perl
Data manipulation language
sed
Stream text editor
sort
Sorts file data
split
Splits the file into smaller files
tr
Translates characters
uniq
Reports repeated lines in a file
wc
Counts words, lines, and characters
vi
Opens vi text editor
vim
Opens vim text editor
fmt
Simple text formatting
spell
Checks text for spelling error
ispell
Checks text for spelling error
emacs
GNU project Emacs
ex, edit
Line editor


B)  Commands used for Compressing files:


Command
Details
compress
Compresses files
gunzip
Helps uncompress gzipped files
gzip
GNU alternative compression method
uncompress
Helps uncompress files
unzip
List, test, and extract compressed files in a ZIP archive
zcat
Cat a compressed file
zcmp
Compares compressed files
zdiff
Compares compressed files
zmore
File perusal filter for crt viewing of compressed text




C)  Commands used for Getting information:


Command
Details
apropos
Locates commands by keyword lookup
info
Displays command information pages online
man
Displays manual pages online
whatis
Searches the whatis database for complete words
yelp
GNOME help viewer


D)  Commands used for Network Communication:


Command
Details
ftp
File transfer program
rcp
Remote file copy
rlogin
Remote login to a Unix host
rsh
Remote shell
tftp
Trivial file transfer program
telnet
Makes terminal connection to another host
ssh
Secures shell terminal or command connection
scp
Secures shell remote file copy
sftp
Secures shell file transfer program




E)  Commands used for sending messages between users:


Command
Details
evolution
GUI mail handling tool on Linux
mail
Simple send or read mail program
mesg
Permits or denies messages
parcel
Sends files to another user
pine
Vdu-based mail utility
talk
Talks to another user
write
Writes message to another user




Refer the video below more interesting concepts about Unix technology -


Navigating Healthcare: A Guide to CareLink Patient Portal

  In the modern era of healthcare, patient engagement and empowerment are paramount. CareLink Patient Portal stands as a digital bridge betw...