Information Technology,Software Programming

Asp.net,PL/SQL Tips Tricks for error resolution ,SQL version 2014,2012,2008,2005,Procedural language,Stored Procedure, computer , excel macro programming,Visual Studio,Musical notations,Indian ,Western Music Lyrics,Chords.

May 28, 2015

Step Recorder feature of Windows 7

Do you know that you can record steps that you are using for your work on windows by using step recorder.

You need to just click on Start button then type step recorder in search box then you can open the step recorder.

Then click on start to start your task recording when you want to stop your step recorder just click on stop.

Then save as dialog box will be open you can save your file on selected location and file will be save in zip format.

Once file saved you can open that file in Internet explorer browser.

Its windows secret that I know most people do not know but it is very much helpful to make document for your task for future learning.
Step recorder command


Step Recorder




File will be save in MHT format which is MHTML format.

May 11, 2015

How to find distinct from number of list in string

How to find distinct from number of list in string in SQL

Distinct in sql




Solution:

SELECT LTRIM(H,',') OUTPUT
FROM
(SELECT sys_connect_by_path(K,',') H,
L val
FROM
(SELECT K,
ROW_NUMBER() OVER (ORDER BY K) L
FROM
(SELECT UNIQUE TO_NUMBER(REPLACE(SUBSTR(G,1,INSTR(G,',',1)),',','')) K
FROM
(SELECT B,
J,
A,
(LTRIM(SUBSTR(A,B,J),',')) G
FROM
( SELECT DISTINCT b,
LEAD(b)over (order by b ASC) j,
A
FROM
(SELECT instr(a,',',level)b,
A
FROM
(SELECT ('1,2,0,2,432,445,3,3,-1,10099,-2,0.32,0.3432,.3432,4,4,5,6,0.32,-2,432,32,21029,10099,3209839')
||',' a
FROM dual
)
CONNECT BY level <=LENGTH(A)+1
ORDER BY b
)
)
WHERE B<>J
ORDER BY B
)
ORDER BY 1
)
ORDER BY K
)
WHERE connect_by_isleaf=1
START WITH L =1
CONNECT BY L = prior L+1

);

April 16, 2015

Error "Can not load File or Assembly "xxxxx". Parameter is incorrect in Asp.net

If you are facing below error

Error "Can not load File or Assembly "xxxxxx". Parameter is incorrect in Asp.net

Error "Can not load File or Assembly "xxx". Parameter is incorrect in Asp.net









Solution is:

You can try out this cleaned up or delete files from below path

 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary Files.

March 29, 2015

Asp code to call home page on logout button,reset password of user

Asp code to call home page on logout button

Make script code this way Put this code in vb-script tag

sub home()
document.frm.submit()
end sub


to call function on click event this way
onclick="home()"

Asp code to reset password of user

If you want to reset password or change password of particular user and you can login page then you can get hint or help to set this code in your form.

set con=server.CreateObject ("ADODB.CONNECTION")
set rs=server.CreateObject ("ADODB.RECORDSET")

con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database Path"

Response.Clear ()

set rs = con.Execute ("select * from logtable where Username='" & Request.Form ("logid") & "' and pwd = '" & Request.Form ("oldpassword") & "'" )

if rs.RecordCount <=0 then
 Response.Write "invalid password"
end if

if Request.Form("check1")="pwd" and Request.Form ("check2")<>"question" then
con.Execute ("Update logtable set pwd='" & Request.Form("newpassword") & "' where pwd='" & Request.Form("oldpassword") & "'")
Response.Redirect ("loginpage.asp")

elseif Request.Form("check2")="question" and Request.Form ("check1")<>"pwd" then
con.Execute ("Update logtable set Question='" & Request.Form("question") & "', Answer='" & Request.Form("Answer") & "' where pwd='" & Request.Form("oldpassword") & "'")
Response.Redirect ("loginpage.asp")

elseif Request.Form("check1")="pwd" and Request.Form ("check2")="question" then
con.Execute ("Update logtable set pwd='" & Request.Form("newpassword") & "', Question='" & Request.Form("question") & "', Answer='" & Request.Form("Answer") & "' where pwd='" & Request.Form("oldpassword") & "'")
Response.Redirect ("loginpage.asp")
end if

March 17, 2015

Example of New operator overloading,Call by value function and reference in c++

Example of New operator overloading in c++

const int maxnames = 5;

class Names
{
char name[25];
static char Names::pool[];
static short int Names::inuse[maxnames];

public:
Names(char* s = 0)
{
if (s)
strncpy(name, s, sizeof(name));
}
void* operator new[](size_t) throw(std::bad_alloc);
void operator delete[](void*) throw();
void display() const
{
std::cout << name << std::endl;
}
}; // Simple memory pool to handle fixed number of Names. char Names::pool[maxnames * sizeof(Names)];
short int Names::inuse[maxnames]; // Overloaded new[] operator for the Names class. void* Names::operator new[](size_t size) throw(std::bad_alloc)
{
int elements = size / sizeof(Names);
 // Find the first empty element (if any).
int p = -1;
int i = 0;
while ((i < maxnames) && (p == -1))
{
 if (!inuse[i]) p = i; ++i; } // Not enough room.
if ((p == -1) || ((maxnames - p) < elements))
throw std::bad_alloc(); // Mark the elements as used.
 for (int x=0; x inuse[p+x] = elements;
// Return pointer to memory.
return pool+p*sizeof(Names);
} // Overloaded delete[] operator for the Names class.
void Names::operator delete[](void* b) throw()
 {
 if (b != 0)
{
int p = ((char*)b - pool) / sizeof(Names);
int elements = inuse[p];
for (int i = 0; i < elements; i++)
inuse[p + i] = 0;
}
}

int main()
 {
Names* np = new Names[maxnames];
 int i;
for (i = 0; i < maxnames; i++)
{
 std::cout << std::endl << "Enter name # " << i+1 << ": ";
char name[25];
std::cin >> name;
*(np + i) = name;
}

for (i = 0; i < maxnames; i++)
 (np + i)->display();

delete [] np;

return 0;
}

A call-by-value function and reference in c++

struct bigone
{
int serno;
char text[1000];
};

// Two function prototypes with a structure parameter.
void slowfunc(bigone p1); // Call by value.
void fastfunc(bigone& p1); // Call by reference.

// The main() function.

int main()
{
static bigone bo = {123, "This is a BIG structure"};

// This call will take a while.
slowfunc(bo);
// This call will be faster than the previous one.
fastfunc(bo);
return 0;
}

// A call-by-value function.
void slowfunc(bigone p1)
{
}
; }

March 3, 2015

Get Missing Index details from Activity Monitor Screen in SQL to get more performance

Create Missing index using SQL Activity Monitor to process improvement

If you want to improve performance of application then keep view on activity monitor in SQL and go to long executed query line then you can observe from recent expensive query window screen . You can see average duration of query execution.

To get Missing Index details from Activity Monitor Screen in SQL to get more performance you can do following steps.

Show Query execution plan

Missing Index
/*

Missing Index Details from ExecutionPlan1.sqlplan
The Query Processor estimates that implementing the following index could improve the query cost by 93.6536%.
*/

/*
USE [DB_TEST]
GO
CREATE NONCLUSTERED INDEX [<Name of Missing Index, sysname,>]
ON [dbo].[GENERALJOURNALACCOUNTENTRY] ([CREATEDTRANSACTIONID])

GO
*/

Once you get index you can create index by directly executing query or you can create index manually. You can create index in query execution process time is very high.

February 26, 2015

Solution for SQL Database Backup Restore Error

Sql Error Description

Facing Below Error during Restoring of SQL Database to existing database or newly created database.

Restore of database 'MicrosoftDynamicsAx' failed.
(  Microsoft.SqlServer.Management.RelationalEngineTasks)


System.Data.SqlClient.SqlError: BACKUP LOG cannot be performed because there is no current database backup. (Microsoft.SqlServer.SmoExtended)

Sql database Restore error

Sql database Restore error

Solution:

This Error due to you have take Full SQL Backup in Read only mode. To solve this issue you can try below steps.

1.Untick tail log backup checkbox .If you don't know about Tail log backup option then search on google to know more about tail log backup.

2. Second option is you can take full backup of database again then restore then file on database then you can deleted backed up file to free the disk space.

Intranet and Extranet,Artificial Neural Networks,Server and Workstation

Intranet and Extra net

An Intranet is a private network

(LAN) that uses the TCP/IP protocol suite. However, access to the network is limited only to the users inside the organization.

The network uses application

programs defined for the global

Internet such as HTTP, and may

have web servers, print servers, file servers etc.

Extra net

Private network that uses the Internet protocol and the public telecommunication system

Shares part of a business's information with suppliers, vendors, partners, customers or other businesses.
Viewed as part of a company's intranet that is extended to users outside the company.


Artificial Neural Networks

ARTIFICIAL NEURAL NETWORKS

•Neural Networks can supplement the enormous potential of traditional computers with the ability to make sensible decisions and to learn by experience.

•Neural Computation is done by a dense mesh of computing nodes and connections. They operate collectively and simultaneously on data inputs.

•Antennas are being used to solve many real world problems. They have an ability to derive meaning from complicated or imprecise data and can be used to extract patterns and detect trends that are too complex to be noticed by either humans or other computer techniques


•Applications of neural networks, that give an impression of its achievements, include
(i) text to speech transformation
(ii) Picture data compression
(iii) recognition of handwriting
(iv) explosives detector
(v) signature examiner and many more.

Server and Workstation


Individual workstations (clients) have access to the resources available on the file servers.

Novell Netware and Windows NT Server are

examples of client/server network operating

systems.

Advantages of Server/Workstation

Resources and data security are controlled through the server.

Any or all elements can be replaced individually as needs increase.

New technology can be easily integrated into the system.

Server can be accessed remotely and across multiple platforms.


Disadvantages of Server/Workstation

Requires initial investment in dedicated server.

Large networks will require staff to ensure efficient operation.

When server goes down, operations will cease across the network.

Structured query language,SQL Query Processing

Structured query language

The common commands and methods used in it are grouped into the following categories: Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), Logical Connectors, Comparison operators, Aggregate functions, Joins, Sub query, Relational operators, Where clause etc.

Data definition language covers SQL commands that create and destroy database tables.

Data manipulation language covers SQL commands that create, change or destroy the information in a database table or the structure of the table.

Data control language covers protection to the database such as granting access to the tables.

Comparison operators cover those operators that allow for comparison between two items.

Aggregate function deals with those standard SQL functions that allow programmers to narrow the search of a database.

Joins category covers those items that allow information from two or more tables to be related.


SQL Query Processing

SQL QUERY PROCESSING

Limitations of computer,Introduction of Internet

Limitations of computer

1. No Feelings: Computers are not living. Hence, can’t make judgment of its own. Its instructions are based on information given to it in form of program.
2. It is Dumb: Computer posses no intelligence of it’s own. It’s I.Q. is zero. Computer can’t take it’s own decision in this regard.


Definition of  Internet

Internet is a worldwide network that provides an infrastructure to connect universities, government offices, companies, students, scientists, researchers and private individuals.
A machine to be on the Internet means it runs TCP/IP protocol stack, has an IP address, and has the ability to send IP packets to all the other machines on the Internet. A private individual having a personal computer can call up an Internet service provider using a modem, be assigned a temporary IP address, and send IP packets to other Internet hosts. 


An Internet consists of a set of connected networks that act as an integrated whole. The Internet provides universal interconnections while allowing individual groups to use whichever network hardware is best suited to their needs. As a network of networks, it provides a capability for communication to take place between research institutions, individuals, and among all ‘Internet Citizens’.

As a complex system of interlinked networks, the Internet supports millions of ‘servers’ computers housing large volumes of all sorts of information. The Internet is where millions of friends and strangers can chat. It lets people browse through thousands of on –line libraries, play new games, and trade software. Another feature of the Internet is that it has no geographic bounds. Users are logging on from India to the US, India to Australia etc.

Application Domain,Definition of SQL Server Integration Service(SSIS).

Application Domain

Application domain is nothing but a process(not exactly as normal process) where the application will be running on it. Application domain will isolates all the applications by running each application in a diff. app domain. For instance, if 5 applications are running on your system, it will then creates 5 diff app domain to guarantee the security. It also has the following advantages,

1. An application can be independently stopped.

2. An application cannot directly access code or resources in another application.

3. A fault in an application cannot affect other applications.

Definition of SQL Server Integration Service(SSIS).

SQL Server Integration Services (SSIS) is one of the main issues of Microsoft BI (Business Intelligence) concept representing the data integration and data transformation in the enterprise level approach.


SSIS (SQL Server Integration Services) has the ability to gather data from various resources in different kinds of formats, process this data, transform data and convert the processed data into any shape that you can use in your daily business as well as for data-mining and data warehouse applications.

By using SSIS, SQL Server developers and Database Administrators can reach data from XML files, text files, CSV files as well as relational databases.

By using SSIS, emailing data or many tasks like storing the processed data into a file folder can be managed easily bu not writing a line of code using the SSIS task packages.

Server hardening

What is server hardening & what needs to be done ?

Everyone,

Server Hardening is not a small part. It is always a challenge for the Server administrator. I am highlighting few points for the same.

*Run MBSA scan and fix the errors/warnings found in the result of the scan.
*TCP/IP Stack Hardening.
*System partition permission
*Disable unnecessary services
*Services should be running with the least privilege accounts
*Administrator account should be renamed.
*There should be maximum two administrative privilege accounts.
*Logging must be configured to generate failure
*All unnecessary protocols should be disabled
*Firewall should be configured

Server hardening is a process to secure your server against unknown threats. Operating system is never 100 percent secure. There are several vulnerabilities or unknown bugs come with the operating system and server services. Server hardening is a process to shut off most of all the doors from where intruders can attack or compromise the service or entire server.
It must be performed on regularly bases (Weekly/Monthly/Quarterly) since day to day there are many bugs are revealed by the master of technology.

February 24, 2015

SQL Tips-Bulk insert records into table ,Select into ,Insert into,delete record in chunks,Remove unused space

Bulk insert records into table in sql 

This is the way to Bulk insert records into table in sql or oracle

insert into 

If you want to insert of table data to existing table then you need to select insert into query.
E.g.

INSERT INTO Table2
SELECT FROM Table1

insert into dTable select * from sTable

It mean table2 and table1 both exists before execution of query and its simply insert data line by line. It takes more time on execution.



Select into:

If you want to copy of table structure with data to new table then you need to select select into query.
E.g.

Select * into tab1 from tab2.

It means tab2 exists and tab1 does not exist in database before execution of query. After execution it will copy data of tab2 to tab1 and it will create table tab1 also.


if dTable is blank and doesn't have any record.

Create this as follows: definately reduce the time.

CREATE TABLE dtable NOLOGGING AS SELECT * FROM stable


Example of delete records from sql table delete records  in chunks

If your query for deleting large number of records and its taking long time to delete records then you can try deletion by chunks. This is an simple Example of delete records from sql table in chunks

WHILE (select count(1) from Some_Table where table_sr_key !=-99 and sector_id = @some_code) >0
BEGIN
Delete top (50) from Some_Table where table_sr_key !=-99 and sector_id = @some_code
END

Remove unused space from Table in SQL

1) sp_spaceused "Tablename", @updateusage = 'TRUE'
2) DBCC UPDATEUSAGE('DBName', 'TableName')
3) DBCC CLEANTABLE ('DBName', 'TableName')
4) UPDATE STATISTICS TableName