Skip to main content

Posts

Command to know the incoming network connections,transmitting data to server in unix

Command   to know the incoming network connections in unix   to know a command which would help knowing the incoming network connections through(from & to) different ip-address:ports netstat -anp | grep "port" | grep "process" Transmitting data to server through code in linux int no_of_bytes_to_send; char* buffer[100]; no_of_bytes_to_send=sizeof(buffer); while(no_of_bytes_to_send>0) { int byte_send = send(sd,buffer,no_of_bytes_to_send); no_of_bytes_to_send = no_of_bytes_to_send - byte_send; buffer+=byte_send; }

Code To Fill data table in DataGrid,fill static, get DataSet combo in asp.Net

Code To Fill DataGrid using asp.net  You can try Code To Fill DataGrid using asp.net common class. After creation these methods you need to call these method to your form editors by creating class object. Fill DataGrid Private Sub fillgrid() dim dta2 as New dataTable Dim str1 As String = "select * from receipt_detail " Dim datatb As New DataTable datatb = obj.OpenDataTable(str1, "receipt_detail") dta2.DataSource = datatb dta2.DataBind() End Sub 'Other Related Function Public Function OpenCn() As Boolean Try If cn Is Nothing Then cn = New SqlConnection End If If Not (cn.State = ConnectionState.Open) Then cn.ConnectionString = constr cn.Open() End If Finally End Try Return True End Function Public Function Closecn() As Boolean Try If Not (cn Is Nothing) Then cn.Close() End If Finally cn.Dispose() End Try Return True End Function Public Function OpenDataTable(B

Workbook Data Into One Single Sheet,Sort Alphabetic​ally ,Row column height width manipulation -MS Excel

Workbook Data Into One Single Sheet using MS Excel  If you have 10 workbook each workbook have single sheet of data (tab name should be anything) if you need consolidation sheet into all 10 workbook into one then you can do this with code use below mention code and your work will done . Sub test() Dim FS, Fle, FLDR, fles Dim Fletype As Variant Set FS = CreateObject("scripting.filesystemobject&quot ;) Dim intLstrow As Integer Dim intLstcol As Integer Dim dlgDialoge As FileDialog Dim srcsheet As Worksheet Dim wk As Workbook 'Set dlgDialoge = Application.FileDialog(msoFileDialogFolderPicker) Set wk = ThisWorkbook Set FLDR = FS.getfolder(BrowseFolder) Set fles = FLDR.Files For Each Fle In fles Fletype = Split(Fle.Name, ".") If (Fletype(UBound(Fletype)) = "xls" Or Fletype(UBound(Fletype)) = "xlsx") Then Set srcsheet = Workbooks.Open(Fle.path).Worksheets(1) intLstrow = srcsheet.Range("

Create or replace trigger before insert on field in sql

1.Create  or replace trigger before insert on field in sql Create or replace trigger t1 Before insert on Employee For each row declare v_firstname Employee.firstname%type; v_lastname Employee.lastname%type; Begin DBMS_OUTPUT.PUT_LINE('You inserted the first Name:'|| :NEW.FIRSTNAME); DBMS_OUTPUT.PUT_LINE('You inserted the first Name:'|| :NEW.LASTNAME); Begin select distinct firstname into v_firstname from Employee where firstname=:NEW.FIRSTNAME; IF(:NEW.FIRSTNAME = v_firstname) THEN DBMS_OUTPUT.PUT_LINE('This first name exists already in the table Employee.'); end if; exception when no_data_found then DBMS_OUTPUT.PUT_LINE('This first name does not exist in the table Employee.'); End; Begin select distinct lastname into v_lastname from Employee where lastname=:NEW.lastNAME; IF(:NEW.LASTNAME = v_lastname) THEN DBMS_OUTPUT.PUT_LINE('This last name exists already in the table Employee.

Select query to get Database owner and Get package name from the database in SQL

To get owner of all database in sql you can run following query in sql server query editor. select suser_sname(owner_sid) from sys.databases To get owner of particular database like Testdb is database name in sql you can run following query in sql server query editor. select suser_sname(owner_sid) from sys.databases where name = 'Testdb'  Get package name from the database query level If you  have a front end application.When a button on that page is clicked, a package is called.If you  want to find that package name from from the db level. Db level means by writing a query. How to find it? use who called me function for example OWA_UTIL.WHO_CALLED_ME(owner ,name, lineno ,caller_t ); 

Difference between primary key and unique key,Find Primary key,Index help,Not Null in SQL

Difference between primary key and unique key A table can have only one primary key but multiple unique keys. unique key may have null value which is not allowed in primary. simply primary key is unique + not null where as unique key Field contains any number of NULL values. Find primary key, index_name ,index key  using sp_Help command in sql How to find primary key, index_name and index_key in the same query For a particular table and also want to group by index_name use sysindexes table to get the output you want use the stored procedure sp_helpindex [object name] sp_help 'table name' Null and Not Null value in Primary and unique keys in sql Primary key should contain unique value and not null because if attribute value is null than how should maintain the uniqueness.. one more think i want to add that Primary key is a type of constraint and foreign key is also a type of constraint and pk is null then u can't use the null value as a foreign key. S

Simple command to shrink all database at once to reduce database size in SQL server

Simple command to shrink all database at once to reduce database size in SQL server This is very simple command to shrink all database at once to reduce database size in SQL server but one thing you need to remember do not forget to make recovery mode simple before executing this command. EXEC sp_MSForEachDB 'select ''?'' as [Database]; ALTER DATABASE [?] SET RECOVERY SIMPLE; DBCC SHRINKDATABASE (''?'' , 0)' After execution of command it will display all database name with details of size. I hope this command will help you a lot on troubleshooting of disk size. Shrinking and reducing database size in sql Summary: If there is big difference in ldf file and .bak file then you can shrink database to reduce size of database. you can use following method at Details use <dbname> checkpoint go backup log <dbname> with truncate_only, go dbccshrinkfile(<logfilename>,1000)

Re-indexes all the tables using DBCC BREINDEX command

Summary: re-indexes all the tables using DBCC BREINDEX command. This goes and re-indexes all the tables and takes about 7 minutes and make an improvement of 10% Details: USE DbName_1 --Enter the name of the database you want to reindex totally DECLARE @TableName varchar(255)  DECLARE TableCursor CURSOR FOR  SELECT YourTableName FROM information_schema.tables  WHERE table_type = 'base table'  OPEN TableCursor  FETCH NEXT FROM TableCursor INTO @TableName  WHILE @@FETCH_STATUS = 0  BEGIN  DBCC DBREINDEX(@TableName,' ',100)  FETCH NEXT FROM TableCursor INTO @TableName  END  CLOSE TableCursor  DEALLOCATE TableCursor ReIndexing All Database Tables at once in SQL Database Server This is a simple three line command for Re-indexing All Database Tables at once in SQL Database Server. This command is very helpful to improve your database performance by re indexing tables. Its Update Statistics on Tables. USE YouDatabaseName GO EXEC sp_MSforeachtable @co

SQL Stored Procedure Examples-Create,Delete and Drop Table ,insert,row count

Create,Delete and Drop Table  Through SQL Stored Procedure Following is code which you can create new Stored procedure in SQL Stored procedure section and can write following code. You can understand easily by reviewing whole code. set ANSI_NULLS OFF set QUOTED_IDENTIFIER OFF GO Create PROCEDURE [dbo].[SP_abc](@userID char(3)) AS BEGIN -- Statement to create table if NOT exists (select * from dbo.sysobjects where id = object_id('abc')) exec("CREATE TABLE abc(@field1 CHAR(3),LOGDT SMALLDATETIME,LOGTM DATETIME )") END set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO -- Statement to Delete records from table table Create PROCEDURE [dbo].[SP_DELETE](@ID1 char(3)) AS BEGIN SET NOCOUNT ON if exists (select * from dbo.sysobjects where id = object_id('L')) BEGIN DELETE FROM abc WHERE ID1=@id1 END END set ANSI_NULLS OFF set QUOTED_IDENTIFIER OFF GO -- Statement to Drop table Create PROCEDUR

SQL Join Query Tips-Example of right ,self query itselft,anti ,left join,Full outer join

Example of self join query in sql. Summary : If you are looking for information like self join query mean table used self as join let us see following example to get more clear. Hear I used  right join with self join. Example of self join query in sql,right join,self join,join query itself. select * from emp where empno not in (select e.empno from emp e right join dept d on e.empno = d.empno) How to use self join in sql select query Example of self join: To find the IDs which have a different department: select distinct A.id  from myTable A join myTable B on A.id = B.id where A.dept <> B.dept Example of join select query in sql Query to get a list of all students who have a certain checklist item (MFST) with a status of Initiated where all other checklist items have a status of Completed. Should I be using Exists or should I be using someting else? SELECT A.COMMON_ID,         B.AID_YEAR,         C.CHKLST_ITEM_CD,         C.ITEM_STATUS FROM PS_PERSON

Whate is Java Servlets ,JDBC,JAVA API,Webserver

WHAT IS JAVA SERVLETS ? An HTTP servlet can generate an HTML page, either when the servlet is accessed explicitly by name, by following a hypertext link, or as the result of a form submission. An HTTP servlet can also be embedded inside an HTML page, where it functions as a server-side include. Servlets can be chained together to produce complex effects--one common use of this technique is for filtering content. Finally, snippets of servlet code can be embedded directly in HTML pages using a new technique called JavaServer Pages. Servlets : A servlet is dynamically loaded module that services requests from Web server, by another service called response. Servlet is efficient as it is initialized only once when the web server loads it. Servlets are efficient, persistent, portable, robust, extensible, and secure, and they have facility to embed JavaScript. JDBC :  The JDBC is a pure JAVA API used to execute SQL statements. It provides the classes and interfaces that can be us

Anti Virus Tips-Remove autorun.inf folder virus,protect from virus,Best Antivirus

Remove autorun.inf folder virus 1. click on Start Button 2.then Click on Run 3. write down "cmd" in the Run box then you can see a CMD box. Here, you will write down cd...(Change directory) you can see like this C:\> then write c:\> attrib when you will write this command "attrib" it will show you all of your affected file. but you should only attentive for SHR autorun.inf and SHR AUTOTEXT.bat(these are virus) then follow this instruction>>> C:\>attrib -s -h -r autorun.inf C:\> del autorun.inf and then restart your computer. if you see this problem again then just delete autorun.inf. you should do same thing for all of your drivers. Some tips to protect from virus Here are some practical tips to help you decide whether or not to open an attached emails: 1. If you get an email with an attachment from someone you don't know, delete it. You don't take candy from strangers, and you should behave the same with email attac