One cause of this issue could be that the password for service account in websphere is expired.
Thursday, 30 April 2020
Wednesday, 29 April 2020
AttributeError: partially initialized module 'webbrowser' has no attribute 'open' (most likely due to a circular import)
AttributeError: partially initialized module 'webbrowser' has no attribute 'open' (most likely due to a circular import)
Don't save your file with the same name as imported package
you save your file with name webbrowser and system is comfused change filename to new.py and try.
Steps to start derby database
C:\Users\AnilBalwani> java -jar C:\Users\AnilBalwani\Downloads\db-derby-10.14.2.0-bin\db-derby-10.14.2.0-bin\lib\derbyrun.jar
Usage:
java -jar derbyrun.jar ij [-p propertiesfile] [sql script]
java -jar derbyrun.jar sysinfo [-cp ...] [-cp help]
java -jar derbyrun.jar dblook [args] (or no arguments for usage)
java -jar derbyrun.jar server [args] (or no arguments for usage)
java -jar derbyrun.jar SignatureChecker [args]
java -jar derbyrun.jar PlanExporter [args]
C:\Users\AnilBalwani> java -jar C:\Users\AnilBalwani\Downloads\db-derby-10.14.2.0-bin\db-derby-10.14.2.0-bin\lib\derbyrun.jar ij
ij version 10.14
ij> CONNECT 'jdbc:derby:booksdb;create=true';
ij> CREATE TABLE book (book_id int primary key, title varchar(64));
0 rows inserted/updated/deleted
ij> INSERT INTO book VALUES (1, 'Core Java'), (2, 'Thinking in Java'), (3, 'Effective Java');
3 rows inserted/updated/deleted
ij> CONNECT 'jdbc:derby://localhost:1527/projects;create=true';
ERROR 08001: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused: connect.
ij> CONNECT 'jdbc:derby://localhost:1527/booksdb;create=true';
ERROR 08001: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused: connect.
ij> exit
> ;
C:\Users\AnilBalwani>java -jar C:\Users\AnilBalwani\Downloads\db-derby-10.14.2.0-bin\db-derby-10.14.2.0-bin\lib\derbyrun.jar server start
Wed Apr 29 23:59:22 IST 2020 : Security manager installed using the Basic server security policy.
Wed Apr 29 23:59:27 IST 2020 : Apache Derby Network Server - 10.14.2.0 - (1828579) started and ready to accept connections on port 1527
Open another command prompt
C:\Users\AnilBalwani>java -jar C:\Users\AnilBalwani\Downloads\db-derby-10.14.2.0-bin\db-derby-10.14.2.0-bin\lib\derbyrun.jar ij
ij version 10.14
ij> CONNECT 'jdbc:derby://localhost:1527/library;create=true';
ij> CREATE TABLE book(book_id int primary key, book_name varchar(32));
0 rows inserted/updated/deleted
ij> INSERT INTO project VALUES (1, 'Java'), (2, '.Net'), (3, 'Maximo');
3 rows inserted/updated/deleted
ij> SELECT * FROM project;
PROJECT_ID |PROJECT_NAME
--------------------------------------------
1 |Java
2 |.Net
3 |Maximo
3 rows selected
ij>
Usage:
java -jar derbyrun.jar ij [-p propertiesfile] [sql script]
java -jar derbyrun.jar sysinfo [-cp ...] [-cp help]
java -jar derbyrun.jar dblook [args] (or no arguments for usage)
java -jar derbyrun.jar server [args] (or no arguments for usage)
java -jar derbyrun.jar SignatureChecker [args]
java -jar derbyrun.jar PlanExporter [args]
C:\Users\AnilBalwani> java -jar C:\Users\AnilBalwani\Downloads\db-derby-10.14.2.0-bin\db-derby-10.14.2.0-bin\lib\derbyrun.jar ij
ij version 10.14
ij> CONNECT 'jdbc:derby:booksdb;create=true';
ij> CREATE TABLE book (book_id int primary key, title varchar(64));
0 rows inserted/updated/deleted
ij> INSERT INTO book VALUES (1, 'Core Java'), (2, 'Thinking in Java'), (3, 'Effective Java');
3 rows inserted/updated/deleted
ij> CONNECT 'jdbc:derby://localhost:1527/projects;create=true';
ERROR 08001: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused: connect.
ij> CONNECT 'jdbc:derby://localhost:1527/booksdb;create=true';
ERROR 08001: java.net.ConnectException : Error connecting to server localhost on port 1,527 with message Connection refused: connect.
ij> exit
> ;
C:\Users\AnilBalwani>java -jar C:\Users\AnilBalwani\Downloads\db-derby-10.14.2.0-bin\db-derby-10.14.2.0-bin\lib\derbyrun.jar server start
Wed Apr 29 23:59:22 IST 2020 : Security manager installed using the Basic server security policy.
Wed Apr 29 23:59:27 IST 2020 : Apache Derby Network Server - 10.14.2.0 - (1828579) started and ready to accept connections on port 1527
Open another command prompt
C:\Users\AnilBalwani>java -jar C:\Users\AnilBalwani\Downloads\db-derby-10.14.2.0-bin\db-derby-10.14.2.0-bin\lib\derbyrun.jar ij
ij version 10.14
ij> CONNECT 'jdbc:derby://localhost:1527/library;create=true';
ij> CREATE TABLE book(book_id int primary key, book_name varchar(32));
0 rows inserted/updated/deleted
ij> INSERT INTO project VALUES (1, 'Java'), (2, '.Net'), (3, 'Maximo');
3 rows inserted/updated/deleted
ij> SELECT * FROM project;
PROJECT_ID |PROJECT_NAME
--------------------------------------------
1 |Java
2 |.Net
3 |Maximo
3 rows selected
ij>
Python HTTP Request
import requests,json
print(requests.get('https://api.github.com'));
# Getting response in json format
response=requests.get('https://api.github.com');
#print(response.json());
#print(response.headers);
print(response.headers['content-type']);
print(response.headers['date']);
print(requests.get('https://api.github.com'));
# Getting response in json format
response=requests.get('https://api.github.com');
#print(response.json());
#print(response.headers);
print(response.headers['content-type']);
print(response.headers['date']);
Python error : PermissionError: [Errno 13] Permission denied: '
if you get this command installing pip request package or any another packa
PermissionError: [Errno 13] Permission denied: '
Then run with --user
C:\Users\AnilBalwani>pip install requests --user
PermissionError: [Errno 13] Permission denied: '
Then run with --user
C:\Users\AnilBalwani>pip install requests --user
writing json to a file using python
import json
data={}
data['people']=[]
data['people'].append({'name':'Ram Singh'});
with open('data.txt', 'w') as outfile:
json.dump(data, outfile)
data={}
data['people']=[]
data['people'].append({'name':'Ram Singh'});
with open('data.txt', 'w') as outfile:
json.dump(data, outfile)
Tuesday, 28 April 2020
Reading JSON File using Python
Code to Read Json File using Python
>>> import os
>>> os.chdir(r"C:\Users\AnilBalwani\Desktop");
>>> f=open("hello.json");
>>> print(json.load(f));
{'glossary': {'title': 'example glossary', 'GlossDiv': {'title': 'S', 'GlossList': {'GlossEntry': {'ID': 'SGML', 'SortAs': 'SGML', 'GlossTerm': 'Standard Generalized Markup Language', 'Acronym': 'SGML', 'Abbrev': 'ISO 8879:1986', 'GlossDef': {'para': 'A meta-markup language, used to create markup languages such as DocBook.', 'GlossSeeAlso': ['GML', 'XML']}, 'GlossSee': 'markup'}}}}}
>>> import os
>>> os.chdir(r"C:\Users\AnilBalwani\Desktop");
>>> f=open("hello.json");
>>> print(json.load(f));
{'glossary': {'title': 'example glossary', 'GlossDiv': {'title': 'S', 'GlossList': {'GlossEntry': {'ID': 'SGML', 'SortAs': 'SGML', 'GlossTerm': 'Standard Generalized Markup Language', 'Acronym': 'SGML', 'Abbrev': 'ISO 8879:1986', 'GlossDef': {'para': 'A meta-markup language, used to create markup languages such as DocBook.', 'GlossSeeAlso': ['GML', 'XML']}, 'GlossSee': 'markup'}}}}}
Sunday, 26 April 2020
Reading a file in oracle
create a directory using sqlplus
sys / as sysdba
create directory
create directory test as 'C:\test'
grant access for read and write to db
Grant read,write test to public;
copy your file emp.txt with data
DECLARE
L_HANDLER UTL_FILE.FILE_TYPE;
L_TEST VARCHAR2(1000);
BEGIN
L_HANDLER := UTL_FILE.FOPEN('TEST', 'EMP.txt', 'R');
UTL_FILE.GET_LINE(L_HANDLER,L_TEXT);
DBMS_OUTPUT.PUT_LINE(L_TEXT);
END;
sys / as sysdba
create directory
create directory test as 'C:\test'
grant access for read and write to db
Grant read,write test to public;
copy your file emp.txt with data
DECLARE
L_HANDLER UTL_FILE.FILE_TYPE;
L_TEST VARCHAR2(1000);
BEGIN
L_HANDLER := UTL_FILE.FOPEN('TEST', 'EMP.txt', 'R');
UTL_FILE.GET_LINE(L_HANDLER,L_TEXT);
DBMS_OUTPUT.PUT_LINE(L_TEXT);
END;
Friday, 24 April 2020
Running a project class from a project by making runnable jar
Go to your project
Create a runnable jar by right click --->export -> Runnable jar
Give your mail class details.
Create a runnable jar by right click --->export -> Runnable jar
Give your mail class details.
Calling a specific class of Jar file inside a package from command Promt
Calling a specific class of Jar file inside a package from command Promt
Example to call a class from command line
C:\Users\AnilBalwani>java -cp C:\Users\AnilBalwani\Desktop\Testing.jar net.codecrete.qrbill.examples.AppendToPDF
Invoice 1 saved at C:\Raj\my_DemoPdf-1.pdf
Invoice 2 saved at C:\Users\AnilBalwani\my_dloc.pdf
Example to call a class from command line
C:\Users\AnilBalwani>java -cp C:\Users\AnilBalwani\Desktop\Testing.jar net.codecrete.qrbill.examples.AppendToPDF
Invoice 1 saved at C:\Raj\my_DemoPdf-1.pdf
Invoice 2 saved at C:\Users\AnilBalwani\my_dloc.pdf
Thursday, 23 April 2020
PIP Tool Python
PIP is tool for installing library.
IT is used for installing/listing/deleting library.
To search for python libraries
https://pypi.org/search/
pip install qbill
To check installation
pip show qbill
IT is used for installing/listing/deleting library.
To search for python libraries
https://pypi.org/search/
pip install qbill
To check installation
pip show qbill
PIP syntax error python
PIP syntax error python
Open command prompt.Check python version
run command like pip install qrbill --user (--user is optional if you have access denied issue)
Steps to install package in python is
Microsoft Windows [Version 10.0.18363.778]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\AnilBalwani>python --version
Python 3.8.2
C:\Users\AnilBalwani>pip --version
pip 19.2.3 from c:\program files (x86)\python38-32\lib\site-packages\pip (python 3.8)
C:\Users\AnilBalwani>python -m pip install --upgrade pip setuptools wheel
Collecting pip
Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
|████████████████████████████████| 1.4MB 386kB/s
Collecting setuptools
Downloading https://files.pythonhosted.org/packages/a0/df/635cdb901ee4a8a42ec68e480c49f85f4c59e8816effbf57d9e6ee8b3588/setuptools-46.1.3-py3-none-any.whl (582kB)
|████████████████████████████████| 583kB 344kB/s
Collecting wheel
Downloading https://files.pythonhosted.org/packages/8c/23/848298cccf8e40f5bbb59009b32848a4c38f4e7f3364297ab3c3e2e2cd14/wheel-0.34.2-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\program files (x86)\\python38-32\\lib\\site-packages\\pip-19.2.3.dist-info\\entry_points.txt'
Consider using the `--user` option or check the permissions.
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Users\AnilBalwani>pip install qrbill
Collecting qrbill
Downloading https://files.pythonhosted.org/packages/34/6d/9595caee9529a4841d521fa4701912c2eac87f6824ab03fb262677363362/qrbill-0.4.tar.gz
Collecting iso3166 (from qrbill)
Downloading https://files.pythonhosted.org/packages/a0/42/15d2ef2211ddb26deb810a21b084ee6f3d1bc7248e884dcabb5edc04b649/iso3166-1.0.1-py2.py3-none-any.whl
Collecting python-stdnum>=1.13 (from qrbill)
Downloading https://files.pythonhosted.org/packages/6b/57/5d1ee250a9c4e780d57d7dcc1b9553c4e386c759ed3087f813965c4534d2/python_stdnum-1.13-py2.py3-none-any.whl (839kB)
|████████████████████████████████| 849kB 409kB/s
Collecting qrcode (from qrbill)
Downloading https://files.pythonhosted.org/packages/42/87/4a3a77e59ab7493d64da1f69bf1c2e899a4cf81e51b2baa855e8cc8115be/qrcode-6.1-py2.py3-none-any.whl
Collecting svgwrite (from qrbill)
Downloading https://files.pythonhosted.org/packages/1c/85/1dc25b36c3ac4f3fe285d33065fc0f2ea7bdfb9209d6369e01a3e8ef6252/svgwrite-1.4-py3-none-any.whl (66kB)
|████████████████████████████████| 71kB 269kB/s
Collecting colorama; platform_system == "Windows" (from qrcode->qrbill)
Downloading https://files.pythonhosted.org/packages/c9/dc/45cdef1b4d119eb96316b3117e6d5708a08029992b2fee2c143c7a0a5cc5/colorama-0.4.3-py2.py3-none-any.whl
Collecting six (from qrcode->qrbill)
Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Installing collected packages: iso3166, python-stdnum, colorama, six, qrcode, svgwrite, qrbill
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\program files (x86)\\python38-32\\Lib\\site-packages\\iso3166'
Consider using the `--user` option or check the permissions.
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
To Resolve Access denied issue
Using cached https://files.pythonhosted.org/packages/c9/dc/45cdef1b4d119eb96316b3117e6d5708a08029992b2fee2c143c7a0a5cc5/colorama-0.4.3-py2.py3-none-any.whl
Installing collected packages: iso3166, python-stdnum, six, colorama, qrcode, svgwrite, qrbill
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\program files (x86)\\python38-32\\Lib\\site-packages\\iso3166'
Consider using the `--user` option or check the permissions.
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Users\AnilBalwani>pip install qrbill --user
Collecting qrbill
Using cached https://files.pythonhosted.org/packages/34/6d/9595caee9529a4841d521fa4701912c2eac87f6824ab03fb262677363362/qrbill-0.4.tar.gz
Collecting iso3166 (from qrbill)
Using cached https://files.pythonhosted.org/packages/a0/42/15d2ef2211ddb26deb810a21b084ee6f3d1bc7248e884dcabb5edc04b649/iso3166-1.0.1-py2.py3-none-any.whl
Collecting python-stdnum>=1.13 (from qrbill)
Using cached https://files.pythonhosted.org/packages/6b/57/5d1ee250a9c4e780d57d7dcc1b9553c4e386c759ed3087f813965c4534d2/python_stdnum-1.13-py2.py3-none-any.whl
Collecting qrcode (from qrbill)
Using cached https://files.pythonhosted.org/packages/42/87/4a3a77e59ab7493d64da1f69bf1c2e899a4cf81e51b2baa855e8cc8115be/qrcode-6.1-py2.py3-none-any.whl
Collecting svgwrite (from qrbill)
Using cached https://files.pythonhosted.org/packages/1c/85/1dc25b36c3ac4f3fe285d33065fc0f2ea7bdfb9209d6369e01a3e8ef6252/svgwrite-1.4-py3-none-any.whl
Collecting six (from qrcode->qrbill)
Using cached https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Collecting colorama; platform_system == "Windows" (from qrcode->qrbill)
Using cached https://files.pythonhosted.org/packages/c9/dc/45cdef1b4d119eb96316b3117e6d5708a08029992b2fee2c143c7a0a5cc5/colorama-0.4.3-py2.py3-none-any.whl
Installing collected packages: iso3166, python-stdnum, six, colorama, qrcode, svgwrite, qrbill
WARNING: The script qr.exe is installed in 'C:\Users\AnilBalwani\AppData\Roaming\Python\Python38\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Running setup.py install for qrbill ... done
Successfully installed colorama-0.4.3 iso3166-1.0.1 python-stdnum-1.13 qrbill-0.4 qrcode-6.1 six-1.14.0 svgwrite-1.4
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Thursday, 16 April 2020
Try and Catch using Python
num=input();
try:
if (int(num)>0):
print("greater than zero");
else:
print("less than zero");
except ValueError:
print("Not a number");
try:
if (int(num)>0):
print("greater than zero");
else:
print("less than zero");
except ValueError:
print("Not a number");
Maximo Integration Framework
Maximo Integration framework is used for integrating with external application or system or for loading data. Its heart is object structure.
It supports following file formats
JSON, XML, CSV etc.
You can integrate via Webservice Soap/Rest, JMS , HTTP etc.
You can also define a particular time during a day to synchronize or can be in real time.
Main integration components and there use in Layman terms : -
Object Structure : List of Objects
Publish Channel : Used to send data or Publish data
Enterprise Service : Used to receive data from external system
Invocation Channel : Used for Send and receive data at particular event
External system : you define a virtual name for external system you are integrating.
Endpoint : - Its a gate through which data goes in and out.
For business logic we can do XSL Mapping, Java classes or processing rules.
It supports following file formats
JSON, XML, CSV etc.
You can integrate via Webservice Soap/Rest, JMS , HTTP etc.
You can also define a particular time during a day to synchronize or can be in real time.
Main integration components and there use in Layman terms : -
Object Structure : List of Objects
Publish Channel : Used to send data or Publish data
Enterprise Service : Used to receive data from external system
Invocation Channel : Used for Send and receive data at particular event
External system : you define a virtual name for external system you are integrating.
Endpoint : - Its a gate through which data goes in and out.
For business logic we can do XSL Mapping, Java classes or processing rules.
Hellow World program in python
# Hello World program in Python
import datetime,time,sys
def welcome():
print("Hi How are you" +str(datetime.datetime.now())); #prints date and time
print("Hope you are having a great day");
print("Welcome to python");
time.sleep(1); #cause program to wait for 1 second
welcome();
welcome();
exit();
This program creates welcome function, shows you how to import or do multiple import and print datetime.
with params
# Hello World program in Python
import datetime,time
def welcome(number):
print("Hi How are you" +str(datetime.datetime.now()));
print("Hope you are having a great day"+str(number+1));
print("Welcome to python");
time.sleep(1);
welcome(6);
Python Creating class example
class Person:
def __init__(self,name,age):
self.name=name;
self.age=age;
p1 = Person("John", 36)
print(p1.name)
import datetime,time,sys
def welcome():
print("Hi How are you" +str(datetime.datetime.now())); #prints date and time
print("Hope you are having a great day");
print("Welcome to python");
time.sleep(1); #cause program to wait for 1 second
welcome();
welcome();
exit();
This program creates welcome function, shows you how to import or do multiple import and print datetime.
with params
# Hello World program in Python
import datetime,time
def welcome(number):
print("Hi How are you" +str(datetime.datetime.now()));
print("Hope you are having a great day"+str(number+1));
print("Welcome to python");
time.sleep(1);
welcome(6);
Python Creating class example
class Person:
def __init__(self,name,age):
self.name=name;
self.age=age;
p1 = Person("John", 36)
print(p1.name)
Friday, 3 April 2020
Anonymous block not working in SQL*Plus
To resolve this issue please end sql anonymous block like you end multiple sql's in editor to run multiple queries
Declare
Begin
Statements....
End;
/
Declare
Begin
Statements....
End;
/
Getting started with PLSQL
PLSQL Basics
Structure of PLSQL Block
Declare (Optional)
BEGIN (Required)
Sql statments
IF....While...For....Else....Do....While
Exception (Optional)
End ; (Mandatory)
Types of blocks in PLSQL
1. Anonymous
Structure :
2. Procedure
Structure
3. Function
Structure
Function nam
Return datatype
Is
Structure of PLSQL Block
Declare (Optional)
BEGIN (Required)
Sql statments
IF....While...For....Else....Do....While
Exception (Optional)
End ; (Mandatory)
Types of blocks in PLSQL
1. Anonymous
Structure :
Declare (Optional)
BEGIN (Required)
Sql statments
IF....While...For....Else....Do....While
Exception (Optional)
End (Required)
2. Procedure
Structure
Procedure name
Is
Declare (Optional)
BEGIN (Required)
Sql statments
IF....While...For....Else....Do....While
Exception (Optional)
End ; (Required)
3. Function
Structure
Function nam
Return datatype
Is
Declare (Optional)
BEGIN (Required)
Sql statments
IF....While...For....Else....Do....While
Return value;
Exception (Optional)
End; (Required)
Steps to create user in database
Creating test user in oracle database
alter session set container=testdb--only for 12c
create user test identified by test;
grant create session to test;
grant create table,create view to test;
grant create procedure to test;
grant create synonym, create trigger to test;
grant unlimited tablespace to test;
Subscribe to:
Comments (Atom)