C,C++,Python, MFC, Multi Threading, ORACLE, BIG DATA,HADOOP
Friday, August 26, 2016
Wednesday, June 15, 2016
Oracle - Kill Locked Sessions
Oracle - List Locked Sessions :-
SELECT DO.owner
, DO.object_name
, DO.object_type
, vs.SID
, vs.serial#
, vs.status
, vs.osuser
, vs.machine
, vs.program
, vs.module
, vs.action
FROM v$locked_object vlo
, v$session vs
, dba_objects DO
WHERE
vs.SID = vlo.session_id
AND vlo.object_id = DO.object_id
ORDER BY module
Oracle - Kill Locked Session :-
alter system kill session 'SID,serial#'
alter system kill session '145,47805'
SELECT DO.owner
, DO.object_name
, DO.object_type
, vs.SID
, vs.serial#
, vs.status
, vs.osuser
, vs.machine
, vs.program
, vs.module
, vs.action
FROM v$locked_object vlo
, v$session vs
, dba_objects DO
WHERE
vs.SID = vlo.session_id
AND vlo.object_id = DO.object_id
ORDER BY module
Oracle - Kill Locked Session :-
alter system kill session 'SID,serial#'
alter system kill session '145,47805'
Wednesday, January 6, 2016
ORACLE DATABASE : Replication Problem with Auto Increment value
ORACLE DATABASE :
While replication, When auto increment value exists same value in other table as well.
To adjust to max Auto increment value use the below query.
STOP Auto_increment turn it to OFF. Insert MAX value then start turn it to ON
EXAMPLE :
SET IDENTITY_INSERT Yaks ON INSERT INTO dbo.Yaks (YakID, YakName) Values(1, 'Mac the Yak') SET IDENTITY_INSERT Yaks OFF SELECT * from yaks
Thursday, December 17, 2015
Restart Python Script
Restart Python Script :
python = sys.executable
os.execl(python, python, * sys.argv)
IDE for Python
IDE for Python : for python Development , Pycharm IDE is easy to write the python script.
Link : https://www.jetbrains.com/pycharm/
Link : https://www.jetbrains.com/pycharm/
Wednesday, December 9, 2015
Design Patterns
Design Patterns :
Strategy Pattern : The strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
Eg: with different strategies we can pay the bill via credit card,debit card,online payment etc.. each is having different algorithm.
Singleton Pattern : Ensures a class has only one instance and provides global point of access to it.
Factory Pattern : Defines an interface for creating an object, but lets sub class decide which class to instantiate. Factory method lets a class defer instantiation to subclasses.
Abstract Factory Pattern : Provides an interface for creating family of related or dependent objects without specifying their concrete classes.
Observer Pattern : Defines one to many dependency between objects so that when one object changes all its dependants are notified and updated automatically.
Strategy Pattern : The strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
Eg: with different strategies we can pay the bill via credit card,debit card,online payment etc.. each is having different algorithm.
Singleton Pattern : Ensures a class has only one instance and provides global point of access to it.
Factory Pattern : Defines an interface for creating an object, but lets sub class decide which class to instantiate. Factory method lets a class defer instantiation to subclasses.
Abstract Factory Pattern : Provides an interface for creating family of related or dependent objects without specifying their concrete classes.
Observer Pattern : Defines one to many dependency between objects so that when one object changes all its dependants are notified and updated automatically.
Facade pattern
the Facade pattern helps manage complexity by providing a simple interface to a complicated system, making the client’s job easier and the codebase more manageable.
Why It’s Useful
Reduces complexity for the client by hiding intricate subsystem details.
Promotes loose coupling between client and subsystems.
Improves maintainability by centralizing subsystem interactions in one place.
Makes the system easier to use and understand.
When to Use It
When you want to simplify interactions with complex subsystems.
When you want to decouple clients from subsystem classes.
When you want a single entry point to a set of functionalities.
Singleton Pattern Example Code:
#include <iostream>
using namespace std;
class singleton
{
private:
static singleton *sptr;
singleton(){}
singleton(singleton &s);
singleton operator =(singleton &s);
public:
static singleton* GetInstance();
};
singleton *singleton::sptr=NULL;
singleton* singleton::GetInstance()
{
if(sptr==NULL)
{
sptr= new singleton();
return sptr;
}
else
{
return sptr;
}
}
int main() {
// your code goes here
singleton *ptr1 =singleton::GetInstance();
cout<<ptr1<<endl;
singleton *ptr2 =singleton::GetInstance();
cout<<ptr2;
return 0;
}
Note : Article is in Progress.
Friday, November 27, 2015
C++ FAQS
FAQ's
1. copy constructor Vs Assignment operator
2. Copy constructor vs assignment operator -using constant members and refrences(intialization list)
3. Why copy constructor takes const refrence objects?
4. what are the const pointer and constant to pointer?
5. Static object and static data members?
6. singleton class? How it could be thread safe?
7. Static data members are stored in which location?
8. what are the data members are stored in Stack and what are they in Heap?
9. Where are they const char pointer array elements are stored?
10. what are the differences between vector and list?
11. Map internal implementation?(tree)
12. How to find loops in circuler linked list?
13. fucntion objects and usage?
14. virtual destructor when where?
15. where do you used singlton desgin pattern?
16. where do you used factory menthod and explain?
17. What are the differences b/w primary key and foriegn key?
18. Diffences b/w static and shared library and syntax?(Linux command)
19. valgrind and other memory leak tools(CPunit tool,memcheck)
20. gdb command for thread creation and thread safe?
21. what are the differences b/w mutex and semaphore?
22. Function pointer declaration and where we can use these function pointers?
23. Stack unwinding and how to resolve it?
24. factory method explain?
25. Write an function swap two number without using temp variable?
26. Find out if the number is power of 2?
27.Find the least common ancestor of 2 nodes in a BST?
28.Write a method to replace all spaces in a string with '%20'
29. Check if the binary tree is balanced?
30.Implement an algorithm to find the nth to last element of a singly linked list?
31. substring subtitution code?
1. Explain about singleton ? (You should explain multi thread safe)
2. In which scenario did you used Abstract factory and why?
3. What is the usage of design patterns?
4. What are the creational, structural and behaviour patterns?
5. How observer will works explain it?
6. Explain decorator and why we go for decorator?
1. How vptr, VTable works in C++?
2. conversion constructor how it works?
3. virtual desctructor how it works? If no virtual keyword which destructor will call?
4. virtual functions and how they overriden in C++?
5. singleton class in C++?
6. Differences between malloc and new opearator?
7. Boost library? How many places you used?
8. what are the places did you used overloaded new operator?
9. Explain the code implementation in Decorator?
10. How observer works in C++?
11. Where did you used Abstract factory DP?
12. where did you used the command DP?
13. what are the differences b/w vector and array?
14. what are the differences b/w vector size and capacity?
15. How to use smart pointer and how to implement it?
16. auto_ptr how to use it and what are the drawbacks using auto_ptr?
17. what is it means account demon?
18. UML diagrams- deployment diagram and usage?
19. class diagram and use case diagrams?
20. Differences sequential diagram vs activity diagrams?
21. Multiple process or threads can we used inside activity diagrams? ( swimlines, fork,join lines)
22. SAS and GMS differnces?
23. VLT power consumption tools?
24.What are the differences b/w vector and list? where we can use these two containers?
25.In boost lib what are the smart pointers used?
26. Difference b/w mutex and binary semaphore?
27.critical section in windows?
28. mutex explain it?
30. explain about pipes and other IPCs?
31. How does the unrelated process will communicate?
32. Explain about FIFOs?
33. Message queues? when will you use Message queues?
34. Messageoutlook?
35.
1. What are the differences b/w structure and union and their allocation status?
2. Why padding required? how to avoid?
3. What is inline function, how to make sure your inline function would be execuated as a inline? (as per compiler instructions)
4.2+3*(2,3) output?
5. 2+3<4?1:0; output?
6. Write a queue implementation using stacks?
7. Write a code for binary search tree with queues?
1. copy constructor Vs Assignment operator
2. Copy constructor vs assignment operator -using constant members and refrences(intialization list)
3. Why copy constructor takes const refrence objects?
4. what are the const pointer and constant to pointer?
5. Static object and static data members?
6. singleton class? How it could be thread safe?
7. Static data members are stored in which location?
8. what are the data members are stored in Stack and what are they in Heap?
9. Where are they const char pointer array elements are stored?
10. what are the differences between vector and list?
11. Map internal implementation?(tree)
12. How to find loops in circuler linked list?
13. fucntion objects and usage?
14. virtual destructor when where?
15. where do you used singlton desgin pattern?
16. where do you used factory menthod and explain?
17. What are the differences b/w primary key and foriegn key?
18. Diffences b/w static and shared library and syntax?(Linux command)
19. valgrind and other memory leak tools(CPunit tool,memcheck)
20. gdb command for thread creation and thread safe?
21. what are the differences b/w mutex and semaphore?
22. Function pointer declaration and where we can use these function pointers?
23. Stack unwinding and how to resolve it?
24. factory method explain?
25. Write an function swap two number without using temp variable?
26. Find out if the number is power of 2?
27.Find the least common ancestor of 2 nodes in a BST?
28.Write a method to replace all spaces in a string with '%20'
29. Check if the binary tree is balanced?
30.Implement an algorithm to find the nth to last element of a singly linked list?
31. substring subtitution code?
1. Explain about singleton ? (You should explain multi thread safe)
2. In which scenario did you used Abstract factory and why?
3. What is the usage of design patterns?
4. What are the creational, structural and behaviour patterns?
5. How observer will works explain it?
6. Explain decorator and why we go for decorator?
1. How vptr, VTable works in C++?
2. conversion constructor how it works?
3. virtual desctructor how it works? If no virtual keyword which destructor will call?
4. virtual functions and how they overriden in C++?
5. singleton class in C++?
6. Differences between malloc and new opearator?
7. Boost library? How many places you used?
8. what are the places did you used overloaded new operator?
9. Explain the code implementation in Decorator?
10. How observer works in C++?
11. Where did you used Abstract factory DP?
12. where did you used the command DP?
13. what are the differences b/w vector and array?
14. what are the differences b/w vector size and capacity?
15. How to use smart pointer and how to implement it?
16. auto_ptr how to use it and what are the drawbacks using auto_ptr?
17. what is it means account demon?
18. UML diagrams- deployment diagram and usage?
19. class diagram and use case diagrams?
20. Differences sequential diagram vs activity diagrams?
21. Multiple process or threads can we used inside activity diagrams? ( swimlines, fork,join lines)
22. SAS and GMS differnces?
23. VLT power consumption tools?
24.What are the differences b/w vector and list? where we can use these two containers?
25.In boost lib what are the smart pointers used?
26. Difference b/w mutex and binary semaphore?
27.critical section in windows?
28. mutex explain it?
30. explain about pipes and other IPCs?
31. How does the unrelated process will communicate?
32. Explain about FIFOs?
33. Message queues? when will you use Message queues?
34. Messageoutlook?
35.
1. What are the differences b/w structure and union and their allocation status?
2. Why padding required? how to avoid?
3. What is inline function, how to make sure your inline function would be execuated as a inline? (as per compiler instructions)
4.2+3*(2,3) output?
5. 2+3<4?1:0; output?
6. Write a queue implementation using stacks?
7. Write a code for binary search tree with queues?
1. Can I throw an exception from a constructor? From a destructor?
Yes: You should throw an exception from a constructor whenever you cannot properly initialize (construct) an object. There is no really satisfactory alternative to exiting a constructor by a throw.Not really: You can throw an exception in a destructor, but that exception must not leave the destructor; if a destructor exits by a throw, all kinds of bad things are likely to happen because the basic rules of the standard library and the language itself will be violated. Don't do it.
Yes: You should throw an exception from a constructor whenever you cannot properly initialize (construct) an object. There is no really satisfactory alternative to exiting a constructor by a throw.Not really: You can throw an exception in a destructor, but that exception must not leave the destructor; if a destructor exits by a throw, all kinds of bad things are likely to happen because the basic rules of the standard library and the language itself will be violated. Don't do it.
Subscribe to:
Posts (Atom)
Vi Editor
VI EDITOR Move move in the editor: h right j up k down l left move top shift +g gg down the line of the file :8 go to line 8 search /string...
-
AI consuting AI content production AI Training services AI Tutoring AI software development AI Chatbot development Advanced courses Machine...
-
LUA LUA has emerged as an extensible procedural language that is mostly designed to support procedural programming with powerful data desc...
-
1. Download XAMP and install as per your system configuration Link https://www.apachefriends.org/download.html 2. Editor for cake...