C,C++,Python, MFC, Multi Threading, ORACLE, BIG DATA,HADOOP
Saturday, April 25, 2020
Monday, February 10, 2020
C++
https://leetcode.com/problems/add-two-numbers/
1. C Programming Absolute Beginner's Guide by Greg Perry and Dean Miller
The 3rd edition of this book is a powerful resource to learn C programming. You can become an expert in these languages with the help of this book. C program examples mentioned in these books is a fast way to get into the comfort zone of learning C language. The book has over 32 chapters, each explains the core concepts of C along with clear examples.
2. Learn C the Hard Way by Zed A
This book is an introduction to modern C programming. The book crafts the knowledge of programming language, making it the perfect choice for all programmers that wish to learn C. Apart from programming concepts, it also discusses skills such as defensive coding, automated testing, illegal memory access, and debugging.
3. Accelerated C++: Practical Programming by Example by Andrew Koenig and Barbara E. Moo
This book is for those who are eager to learn the practical aspects of C++. The book is a part of Stroustrup's C++ in-depth series. It bypasses the basic concepts and directly gets you started with the practical approach of C++. Some of the topics covered in the book include basic string handling, loop, flow control statements, overloading, file I/O, inheritance, virtual functions, and polymorphism.
4. C++ Primer (5th Edition) 5th Edition by Stanley B. Lippman, Josée Lajoie, and Barbara E. Moo
The authors of this book focus on the 2011 revised standard. The book focuses rationale behind the rules for programming in C++. The first part of the book covers basics of the C++ language. The next section deals with the concepts like I/O library, sequential and associative containers, generic algorithms, and dynamic memory. It teaches you high-level programming techniques such as specialised library facilities and tools for large programs.
5. Effective Modern C++: 42 Specific Ways to Improve Your Use of C++11 and C++14 (1st Edition) by Scott Meyers
This book talks about how you can use the latest features of C++ 11 and C++ 14. The author ensures that you will be able to create software that is correct, efficient, portable, and maintainable. Topics covered in this book include perfect forwarding, except specifications, initialisation, auto type declarations etc. You need to have some basic knowledge of C++ to get started with this book.
Tuesday, December 3, 2019
Oracle database
select * from sample_db where
id =1
and
(name like '%praveen%'
or name like '%naveen%')
SQL CONSTRAINTS
primary key
CREATE TABLE sbanks (
ID int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int,
PRIMARY KEY (ID)
);
TO ADD PRIMARY KEY CONSTRAINT TO EXISTING TABLE ie for one column.
syntax
ALTER TABLE sbank
ADD PRIMARY KEY (ID);
imp:u can have primary key constraint one only.
now to add primary key constraint for more than one column to already existing table with primary constraint
you have to delete existing primary key,and add new primary key constraint.
DROP a PRIMARY KEY Constraint
syntax
ALTER TABLE sbank
DROP PRIMARY KEY;
o/p
MySQL returned an empty result set
now adding primary key constraint for two columns
ALTER TABLE sbank
ADD CONSTRAINT PK_sbank PRIMARY KEY (ID,LastName)
o/p
MySQL returned an empty result set
here PK_sbank is the constraint name.
DATABASE column name search in all tables /schemas
select c.tabschema as schema_name,
c.tabname as table_name,c.colname
from syscat.columns c
inner join syscat.tables t on
t.tabschema = c.tabschema and t.tabname = c.tabname
where c.colname like '%
PRODUCT_NUMBER%' and t.type = 'T'
order by schema_name,table_name;
for more details https://dataedo.com/kb/query/db2/find-tables-with-specific-column-name
https://dataedo.com/kb/query/db2
SEARCH TABLES QUERY
select name from sysibm.systables
where name like '%ISP%'
and type = 'T'
EASY CONCATENATE STRINGS IN EXCEL AND SEARCH THE STRING IN DB
="'"&A1&"',"
DB2
SELECT * FROM customers FETCH FIRST 1 ROWS ONLY
http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html?ssSourceSiteId=otnpt
SQL joins are used to
combine rows from two or more tables.
Types of Joins:
INNER JOIN: Returns all rows when
there is at least one match in BOTH tables
EG: view Intersection (matching
data in two tables) of two table’s data.
Syn:
SELECT column_name(s) FROM table1 INNER JOIN table2 ON table1.column_name=table2.column_name;
LEFT JOIN: Return all rows from
the left table, and the matched rows from the right table
EG : view Table 1’s +
Intersection (matching data in two tables)
of two table’s data

Syn: SELECT column_name(s) FROM table1 LEFT JOIN table2 ON table1.column_name=table2.column_name;
RIGHT JOIN: Return
all rows from the right table, and the matched rows from the left table
EG : Intersection (matching data in two tables) of
two table’s data + Table 2’s

FULL JOIN: Return all
rows when there is a match in ONE of the tables
EG : view complete 2 table’s data (Table1
+ Table 2)
for more details https://www.javatpoint.com/dbms-normalization
Monday, November 18, 2019
soap ui
soap ui file reading via groovy script
for more please refer
// To get the output value, use the built-in result map object def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) def projectPath = groovyUtils.projectPath def directoryName = projectPath + "/testData" def row = testRunner.testCase.testSteps["DataSource"].currentRow def allFiles = [] new File( directoryName ).eachFile() { file -> if( file.name =~ /.txt/ ) { allFiles.add( file.name ) } } if ( (row + 1) <= allFiles.size ) { // Output to the test step property called inputData result["inputData"] = new File( directoryName + "/" + allFiles[row] ).text }
https://www.soapui.org/scripting-properties/tips-tricks.html
IOT languages
LUA
LUA has emerged as an extensible procedural language that is mostly designed to support procedural programming with powerful data description facilities. Since it is an embedded language, LUA needs to be embedded in a host client in order to function well. To help developers build IoT-enabled applications, LUA offers a framework called Node.lua that is built on lightweight Lua interpreter and libuv for event-driven (non-blocking I/O model).
ParaSail
Parallel Specification And Implementation Language is another unusual language that can build highly parallel yet secure applications which can be mapped to multicore, manycore, heterogeneous, or distributed architectures. ParaSail is a feature-rich language in terms of module parameterization, interface separation from implementation, and module-independent invariants, etc.
PHPoC
Yes, there is a variant of PHP language too available for IoT development. Not only a language but a hardware platform also, PHP on Chip (PHPoC) is a general-purpose language for IoT with most syntaxes and core functions inherited from PHP. Addition of new functions like I/O, UART, I2C, SPI, ADC, TIMER/COUNTER, RTC etc. gives it the ability to interact with hardware peripherals in a better way.
Rust
Similar to C/C++, Rust also conceives fine-grained memory management and low runtime overhead, which makes it a strong candidate in the IoT-friendly language list. Popularly known as an alternative to C, Rust is used for system programming and safeguards memory from getting corrupted. With basic structure and easy to learn syntaxes, Rust has become a language of choice for many IoT developers.
LUA has emerged as an extensible procedural language that is mostly designed to support procedural programming with powerful data description facilities. Since it is an embedded language, LUA needs to be embedded in a host client in order to function well. To help developers build IoT-enabled applications, LUA offers a framework called Node.lua that is built on lightweight Lua interpreter and libuv for event-driven (non-blocking I/O model).
ParaSail
Parallel Specification And Implementation Language is another unusual language that can build highly parallel yet secure applications which can be mapped to multicore, manycore, heterogeneous, or distributed architectures. ParaSail is a feature-rich language in terms of module parameterization, interface separation from implementation, and module-independent invariants, etc.
PHPoC
Yes, there is a variant of PHP language too available for IoT development. Not only a language but a hardware platform also, PHP on Chip (PHPoC) is a general-purpose language for IoT with most syntaxes and core functions inherited from PHP. Addition of new functions like I/O, UART, I2C, SPI, ADC, TIMER/COUNTER, RTC etc. gives it the ability to interact with hardware peripherals in a better way.
Rust
Similar to C/C++, Rust also conceives fine-grained memory management and low runtime overhead, which makes it a strong candidate in the IoT-friendly language list. Popularly known as an alternative to C, Rust is used for system programming and safeguards memory from getting corrupted. With basic structure and easy to learn syntaxes, Rust has become a language of choice for many IoT developers.
Go
Google’s child, Golang or Go programming language is considered a big player in IoT platform development because of its inherent qualities like inbuilt concurrency and ability to maximising the hardware usage to boost performance. Go’s cloud community support makes it real easy for learners to get acquainted with the knowledge of IoT development super quick and in a veryTuesday, November 12, 2019
Memory Layout
Memory Layout of C Programs
A typical memory representation of C program consists of following sections.
1. Text segment
2. Initialized data segment
3. Uninitialized data segment
4. Stack
5. Heap
A typical memory layout of a running process
1. Text Segment:
A text segment , also known as a code segment or simply as text, is one of the sections of a program in an object file or in memory, which contains executable instructions.
As a memory region, a text segment may be placed below the heap or stack in order to prevent heaps and stack overflows from overwriting it.
Usually, the text segment is sharable so that only a single copy needs to be in memory for frequently executed programs, such as text editors, the C compiler, the shells, and so on. Also, the text segment is often read-only, to prevent a program from accidentally modifying its instructions.
2. Initialized Data Segment:
Initialized data segment, usually called simply the Data Segment. A data segment is a portion of virtual address space of a program, which contains the global variables and static variables that are initialized by the programmer.
Note that, data segment is not read-only, since the values of the variables can be altered at run time.
This segment can be further classified into initialized read-only area and initialized read-write area.
For instance the global string defined by char s[] = “hello world” in C and a C statement like int debug=1 outside the main (i.e. global) would be stored in initialized read-write area. And a global C statement like const char* string = “hello world” makes the string literal “hello world” to be stored in initialized read-only area and the character pointer variable string in initialized read-write area.
Ex: static int i = 10 will be stored in data segment and global int i = 10 will also be stored in data segment
3. Uninitialized Data Segment:
Uninitialized data segment, often called the “bss” segment, named after an ancient assembler operator that stood for “block started by symbol.” Data in this segment is initialized by the kernel to arithmetic 0 before the program starts executing
uninitialized data starts at the end of the data segment and contains all global variables and static variables that are initialized to zero or do not have explicit initialization in source code.
For instance a variable declared static int i; would be contained in the BSS segment.
For instance a global variable declared int j; would be contained in the BSS segment.
4. Stack:
The stack area traditionally adjoined the heap area and grew the opposite direction; when the stack pointer met the heap pointer, free memory was exhausted. (With modern large address spaces and virtual memory techniques they may be placed almost anywhere, but they still typically grow opposite directions.)
The stack area contains the program stack, a LIFO structure, typically located in the higher parts of memory. On the standard PC x86 computer architecture it grows toward address zero; on some other architectures it grows the opposite direction. A “stack pointer” register tracks the top of the stack; it is adjusted each time a value is “pushed” onto the stack. The set of values pushed for one function call is termed a “stack frame”; A stack frame consists at minimum of a return address.
Stack, where automatic variables are stored, along with information that is saved each time a function is called. Each time a function is called, the address of where to return to and certain information about the caller’s environment, such as some of the machine registers, are saved on the stack. The newly called function then allocates room on the stack for its automatic and temporary variables. This is how recursive functions in C can work. Each time a recursive function calls itself, a new stack frame is used, so one set of variables doesn’t interfere with the variables from another instance of the function.
5. Heap:
Heap is the segment where dynamic memory allocation usually takes place.
The heap area begins at the end of the BSS segment and grows to larger addresses from there.The Heap area is managed by malloc, realloc, and free, which may use the brk and sbrk system calls to adjust its size (note that the use of brk/sbrk and a single “heap area” is not required to fulfill the contract of malloc/realloc/free; they may also be implemented using mmap to reserve potentially non-contiguous regions of virtual memory into the process’ virtual address space). The Heap area is shared by all shared libraries and dynamically loaded modules in a process.
Examples.
The size(1) command reports the sizes (in bytes) of the text, data, and bss segments. ( for more details please refer man page of size(1) )
1. Check the following simple C program
filter_none
edit
play_arrow
brightness_4
#include <stdio.h>
int main(void)
{
return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text data bss dec hex filename
960 248 8 1216 4c0 memory-layout
2. Let us add one global variable in program, now check the size of bss (highlighted in red color).
filter_none
edit
play_arrow
brightness_4
#include <stdio.h>
int global; /* Uninitialized variable stored in bss*/
int main(void)
{
return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text data bss dec hex filename
960 248 12 1220 4c4 memory-layout
3. Let us add one static variable which is also stored in bss.
filter_none
edit
play_arrow
brightness_4
#include <stdio.h>
int global; /* Uninitialized variable stored in bss*/
int main(void)
{
static int i; /* Uninitialized static variable stored in bss */
return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text data bss dec hex filename
960 248 16 1224 4c8 memory-layout
4. Let us initialize the static variable which will then be stored in Data Segment (DS)
filter_none
edit
play_arrow
brightness_4
#include <stdio.h>
int global; /* Uninitialized variable stored in bss*/
int main(void)
{
static int i = 100; /* Initialized static variable stored in DS*/
return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text data bss dec hex filename
960 252 12 1224 4c8 memory-layout
5. Let us initialize the global variable which will then be stored in Data Segment (DS)
filter_none
edit
play_arrow
brightness_4
#include <stdio.h>
int global = 10; /* initialized global variable stored in DS*/
int main(void)
{
static int i = 100; /* Initialized static variable stored in DS*/
return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text data bss dec hex filename
960 256 8 1224 4c8 memory-layout
for more refer https://www.geeksforgeeks.org/memory-layout-of-c-program/
A typical memory representation of C program consists of following sections.
1. Text segment
2. Initialized data segment
3. Uninitialized data segment
4. Stack
5. Heap
A typical memory layout of a running process
1. Text Segment:
A text segment , also known as a code segment or simply as text, is one of the sections of a program in an object file or in memory, which contains executable instructions.
As a memory region, a text segment may be placed below the heap or stack in order to prevent heaps and stack overflows from overwriting it.
Usually, the text segment is sharable so that only a single copy needs to be in memory for frequently executed programs, such as text editors, the C compiler, the shells, and so on. Also, the text segment is often read-only, to prevent a program from accidentally modifying its instructions.
2. Initialized Data Segment:
Initialized data segment, usually called simply the Data Segment. A data segment is a portion of virtual address space of a program, which contains the global variables and static variables that are initialized by the programmer.
Note that, data segment is not read-only, since the values of the variables can be altered at run time.
This segment can be further classified into initialized read-only area and initialized read-write area.
For instance the global string defined by char s[] = “hello world” in C and a C statement like int debug=1 outside the main (i.e. global) would be stored in initialized read-write area. And a global C statement like const char* string = “hello world” makes the string literal “hello world” to be stored in initialized read-only area and the character pointer variable string in initialized read-write area.
Ex: static int i = 10 will be stored in data segment and global int i = 10 will also be stored in data segment
3. Uninitialized Data Segment:
Uninitialized data segment, often called the “bss” segment, named after an ancient assembler operator that stood for “block started by symbol.” Data in this segment is initialized by the kernel to arithmetic 0 before the program starts executing
uninitialized data starts at the end of the data segment and contains all global variables and static variables that are initialized to zero or do not have explicit initialization in source code.
For instance a variable declared static int i; would be contained in the BSS segment.
For instance a global variable declared int j; would be contained in the BSS segment.
4. Stack:
The stack area traditionally adjoined the heap area and grew the opposite direction; when the stack pointer met the heap pointer, free memory was exhausted. (With modern large address spaces and virtual memory techniques they may be placed almost anywhere, but they still typically grow opposite directions.)
The stack area contains the program stack, a LIFO structure, typically located in the higher parts of memory. On the standard PC x86 computer architecture it grows toward address zero; on some other architectures it grows the opposite direction. A “stack pointer” register tracks the top of the stack; it is adjusted each time a value is “pushed” onto the stack. The set of values pushed for one function call is termed a “stack frame”; A stack frame consists at minimum of a return address.
Stack, where automatic variables are stored, along with information that is saved each time a function is called. Each time a function is called, the address of where to return to and certain information about the caller’s environment, such as some of the machine registers, are saved on the stack. The newly called function then allocates room on the stack for its automatic and temporary variables. This is how recursive functions in C can work. Each time a recursive function calls itself, a new stack frame is used, so one set of variables doesn’t interfere with the variables from another instance of the function.
5. Heap:
Heap is the segment where dynamic memory allocation usually takes place.
The heap area begins at the end of the BSS segment and grows to larger addresses from there.The Heap area is managed by malloc, realloc, and free, which may use the brk and sbrk system calls to adjust its size (note that the use of brk/sbrk and a single “heap area” is not required to fulfill the contract of malloc/realloc/free; they may also be implemented using mmap to reserve potentially non-contiguous regions of virtual memory into the process’ virtual address space). The Heap area is shared by all shared libraries and dynamically loaded modules in a process.
Examples.
The size(1) command reports the sizes (in bytes) of the text, data, and bss segments. ( for more details please refer man page of size(1) )
1. Check the following simple C program
filter_none
edit
play_arrow
brightness_4
#include <stdio.h>
int main(void)
{
return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text data bss dec hex filename
960 248 8 1216 4c0 memory-layout
2. Let us add one global variable in program, now check the size of bss (highlighted in red color).
filter_none
edit
play_arrow
brightness_4
#include <stdio.h>
int global; /* Uninitialized variable stored in bss*/
int main(void)
{
return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text data bss dec hex filename
960 248 12 1220 4c4 memory-layout
3. Let us add one static variable which is also stored in bss.
filter_none
edit
play_arrow
brightness_4
#include <stdio.h>
int global; /* Uninitialized variable stored in bss*/
int main(void)
{
static int i; /* Uninitialized static variable stored in bss */
return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text data bss dec hex filename
960 248 16 1224 4c8 memory-layout
4. Let us initialize the static variable which will then be stored in Data Segment (DS)
filter_none
edit
play_arrow
brightness_4
#include <stdio.h>
int global; /* Uninitialized variable stored in bss*/
int main(void)
{
static int i = 100; /* Initialized static variable stored in DS*/
return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text data bss dec hex filename
960 252 12 1224 4c8 memory-layout
5. Let us initialize the global variable which will then be stored in Data Segment (DS)
filter_none
edit
play_arrow
brightness_4
#include <stdio.h>
int global = 10; /* initialized global variable stored in DS*/
int main(void)
{
static int i = 100; /* Initialized static variable stored in DS*/
return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text data bss dec hex filename
960 256 8 1224 4c8 memory-layout
for more refer https://www.geeksforgeeks.org/memory-layout-of-c-program/
Monday, November 11, 2019
What are Web Services?
What is a Web Service?
Web Services work on client-server model where client applications can access web services over the network. Web services provide endpoint URLs and expose methods that can be accessed over network through client programs written in java, shell script or any other different technologies.
Web services are stateless and doesn’t maintain user session like web applications.
Web services are stateless and doesn’t maintain user session like web applications.
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...