Join us at the SAP Exchange for TTL to gain a thorough understanding of industry developments. #SAPTTL
Wednesday, 9 October 2013
Saturday, 1 June 2013
backup dos command
== BACKUP ==
'''External - DOS 2.0 and above'''
:Backs up one or more files from one disk to another.
<pre>
BACKUP source destination-drive: [/S] [/M] [/A] [/F[:size]]
[/D:date[/T:time]] [/L[:[drive:][path]logfile]]
source Specifies the file(s), drive, or directory to back up.
destination-drive: Specifies the drive to save backup copies onto.
/S Backs up contents of subdirectories.
/M Backs up only files that have changed since the last
backup.
/A Adds backup files to an existing backup disk.
/F:[size] Specifies the size of the disk to be formatted.
/D:date Backs up only files changed on or after the specified
date.
/T:time Backs up only files changed at or after the specified
time.
/L[:[drive:][path]logfile]
Creates a log file and entry to record the backup
operation.
</pre>
'''External - DOS 2.0 and above'''
:Backs up one or more files from one disk to another.
<pre>
BACKUP source destination-drive: [/S] [/M] [/A] [/F[:size]]
[/D:date[/T:time]] [/L[:[drive:][path]logfile]]
source Specifies the file(s), drive, or directory to back up.
destination-drive: Specifies the drive to save backup copies onto.
/S Backs up contents of subdirectories.
/M Backs up only files that have changed since the last
backup.
/A Adds backup files to an existing backup disk.
/F:[size] Specifies the size of the disk to be formatted.
/D:date Backs up only files changed on or after the specified
date.
/T:time Backs up only files changed at or after the specified
time.
/L[:[drive:][path]logfile]
Creates a log file and entry to record the backup
operation.
</pre>
Thursday, 25 April 2013
Calling a Stored Procedure ( C connect 2 orcle) .......intrsting
Input Table
SQL> SELECT ename, empno, sal FROM emp ORDER BY sal DESC; ENAME EMPNO SAL ---------- --------- -------- KING 7839 5000 SCOTT 7788 3000 FORD 7902 3000 JONES 7566 2975 BLAKE 7698 2850 CLARK 7782 2450 ALLEN 7499 1600 TURNER 7844 1500 MILLER 7934 1300 WARD 7521 1250 MARTIN 7654 1250 ADAMS 7876 1100 JAMES 7900 950 SMITH 7369 800
Stored Procedure
/* available online in file 'sample6' */ #include <stdio.h> #include <string.h> typedef char asciz; EXEC SQL BEGIN DECLARE SECTION; /* Define type for null-terminated strings. */ EXEC SQL TYPE asciz IS STRING(20); asciz username[20]; asciz password[20]; int dept_no; /* which department to query */ char emp_name[10][21]; char job[10][21]; EXEC SQL VAR emp_name is STRING (21); EXEC SQL VAR job is STRING (21); float salary[10]; int done_flag; int array_size; int num_ret; /* number of rows returned */ int SQLCODE; EXEC SQL END DECLARE SECTION; EXEC SQL INCLUDE sqlca; int print_rows(); /* produces program output */ int sqlerror(); /* handles unrecoverable errors */ main() { int i; /* Connect to Oracle. */ strcpy(username, "SCOTT"); strcpy(password, "TIGER"); EXEC SQL WHENEVER SQLERROR DO sqlerror(); EXEC SQL CONNECT :username IDENTIFIED BY :password; printf("\nConnected to Oracle as user: %s\n\n", username); printf("Enter department number: "); scanf("%d", &dept_no); fflush(stdin); /* Print column headers. */ printf("\n\n"); printf("%-10.10s%-10.10s%s\n", "Employee", "Job", "Salary"); printf("%-10.10s%-10.10s%s\n", "--------", "---", "------"); /* Set the array size. */ array_size = 10; done_flag = 0; num_ret = 0; /* Array fetch loop - ends when NOT FOUND becomes true. */ for (;;) { EXEC SQL EXECUTE BEGIN personnel.get_employees (:dept_no, :array_size, :num_ret, :done_flag, :emp_name, :job, :salary); END; END-EXEC; print_rows(num_ret); if (done_flag) break; } /* Disconnect from Oracle. */ EXEC SQL COMMIT WORK RELEASE; exit(0); } print_rows(n) int n; { int i; if (n == 0) { printf("No rows retrieved.\n"); return; } for (i = 0; i < n; i++) printf("%10.10s%10.10s%6.2f\n", emp_name[i], job[i], salary[i]); } sqlerror() { EXEC SQL WHENEVER SQLERROR CONTINUE; printf("\nOracle error detected:"); printf("\n% .70s \n", sqlca.sqlerrm.sqlerrmc); EXEC SQL ROLLBACK WORK RELEASE; exit(1); }
Interactive Session
Connected to Oracle as user: SCOTT Enter department number: 20 Employee Job Salary -------- --- ------ SMITH CLERK 800.00 JONES MANAGER 2975.00 SCOTT ANALYST 3000.00 ADAMS CLERK 1100.00 FORD ANALYST 3000.00
Batch Transaction Processing oracle
Input Tables - named shiv_accounts
SQL> SELECT * FROM accounts ORDER BY account_id; ACCOUNT_ID BAL ---------- ------- 1 1000 2 2000 3 1500 4 6500 5 500 SQL> SELECT * FROM action ORDER BY time_tag; ACCOUNT_ID O NEW_VALUE STATUS TIME_TAG ---------- - ---------- -------------------- --------- 3 u 599 18-NOV-88 6 i 20099 18-NOV-88 5 d 18-NOV-88 7 u 1599 18-NOV-88 1 i 399 18-NOV-88 9 d 18-NOV-88 10 x 18-NOV-88
PL/SQL Block
-- available online in file 'sample4' DECLARE CURSOR c1 IS SELECT account_id, oper_type, new_value FROM action ORDER BY time_tag FOR UPDATE OF status; BEGIN FOR acct IN c1 LOOP -- process each row one at a time acct.oper_type := upper(acct.oper_type); /*----------------------------------------*/ /* Process an UPDATE. If the account to */ /* be updated doesn't exist, create a new */ /* account. */ /*----------------------------------------*/ IF acct.oper_type = 'U' THEN UPDATE accounts SET bal = acct.new_value WHERE account_id = acct.account_id; IF SQL%NOTFOUND THEN -- account didn't exist. Create it. INSERT INTO accounts VALUES (acct.account_id, acct.new_value); UPDATE action SET status = 'Update: ID not found. Value inserted.' WHERE CURRENT OF c1; ELSE UPDATE action SET status = 'Update: Success.' WHERE CURRENT OF c1; END IF; /*--------------------------------------------*/ /* Process an INSERT. If the account already */ /* exists, do an update of the account */ /* instead. */ /*--------------------------------------------*/ ELSIF acct.oper_type = 'I' THEN BEGIN INSERT INTO accounts VALUES (acct.account_id, acct.new_value); UPDATE action set status = 'Insert: Success.' WHERE CURRENT OF c1; EXCEPTION WHEN DUP_VAL_ON_INDEX THEN -- account already exists UPDATE accounts SET bal = acct.new_value WHERE account_id = acct.account_id; UPDATE action SET status = 'Insert: Acct exists. Updated instead.' WHERE CURRENT OF c1; END; /*--------------------------------------------*/ /* Process a DELETE. If the account doesn't */ /* exist, set the status field to say that */ /* the account wasn't found. */ /*--------------------------------------------*/ ELSIF acct.oper_type = 'D' THEN DELETE FROM accounts WHERE account_id = acct.account_id; IF SQL%NOTFOUND THEN -- account didn't exist. UPDATE action SET status = 'Delete: ID not found.' WHERE CURRENT OF c1; ELSE UPDATE action SET status = 'Delete: Success.' WHERE CURRENT OF c1; END IF; /*--------------------------------------------*/ /* The requested operation is invalid. */ /*--------------------------------------------*/ ELSE -- oper_type is invalid UPDATE action SET status = 'Invalid operation. No action taken.' WHERE CURRENT OF c1; END IF; END LOOP; COMMIT; END;
Output Tables
SQL> SELECT * FROM accounts ORDER BY account_id; ACCOUNT_ID BAL ---------- -------- 1 399 2 2000 3 599 4 6500 6 20099 7 1599 SQL> SELECT * FROM action ORDER BY time_tag; ACCOUNT_ID O NEW_VALUE STATUS TIME_TAG ---------- - ---------- --------------------- --------- 3 u 599 Update: Success. 18-NOV-88 6 i 20099 Insert: Success. 18-NOV-88 5 d Delete: Success. 18-NOV-88 7 u 1599 Update: ID not found. 18-NOV-88 Value inserted. 1 i 399 Insert: Acct exists. 18-NOV-88 Updated instead. 9 d Delete: ID not found. 18-NOV-88 10 x Invalid operation. 18-NOV-88 No action taken.
Tuesday, 19 March 2013
The jQuery noConflict() Method
Example---------shiv's refined
$.noConflict();
jQuery(document).ready(function(){
jQuery("button").click(function(){
jQuery("p").text("jQuery is still working!");
});
});
jQuery(document).ready(function(){
jQuery("button").click(function(){
jQuery("p").text("jQuery is still working!");
});
});
jQuery Event Methods
| Method | Description |
|---|---|
| bind() | Attaches event handlers to elements |
| blur() | Attaches/Triggers the blur event |
| change() | Attaches/Triggers the change event |
| click() | Attaches/Triggers the click event |
| dblclick() | Attaches/Triggers the double click event |
| delegate() | Attaches a handler to current, or future, specified child elements of the matching elements |
| die() | Removed in version 1.9. Removes all event handlers added with the live() method |
| error() | Attaches/Triggers the error event |
| event.currentTarget | The current DOM element within the event bubbling phase |
| event.data | Contains the optional data passed to an event method when the current executing handler is bound |
| event.delegateTarget | Returns the element where the currently-called jQuery event handler was attached |
| event.isDefaultPrevented() | Returns whether event.preventDefault() was called for the event object |
| event.isImmediatePropagationStopped() | Returns whether event.stopImmediatePropagation() was called for the event object |
| event.isPropagationStopped() | Returns whether event.stopPropagation() was called for the event object |
| event.namespace | Returns the namespace specified when the event was triggered |
| event.pageX | Returns the mouse position relative to the left edge of the document |
| event.pageY | Returns the mouse position relative to the top edge of the document |
| event.preventDefault() | Prevents the default action of the event |
| event.relatedTarget | Returns which element being entered or exited on mouse movement. |
| event.result | Contains the last/previous value returned by an event handler triggered by the specified event |
| event.stopImmediatePropagation() | Prevents other event handlers from being called |
| event.stopPropagation() | Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event |
| event.target | Returns which DOM element triggered the event |
| event.timeStamp | Returns the number of milliseconds since January 1, 1970, when the event is triggered |
| event.type | Returns which event type was triggered |
| event.which | Returns which keyboard key or mouse button was pressed for the event |
| focus() | Attaches/Triggers the focus event |
| focusin() | Attaches an event handler to the focusin event |
| focusout() | Attaches an event handler to the focusout event |
| hover() | Attaches two event handlers to the hover event |
| keydown() | Attaches/Triggers the keydown event |
| keypress() | Attaches/Triggers the keypress event |
| keyup() | Attaches/Triggers the keyup event |
| live() | Removed in version 1.9. Adds one or more event handlers to current, or future, selected elements |
| load() | Attaches an event handler to the load event |
| mousedown() | Attaches/Triggers the mousedown event |
| mouseenter() | Attaches/Triggers the mouseenter event |
| mouseleave() | Attaches/Triggers the mouseleave event |
| mousemove() | Attaches/Triggers the mousemove event |
| mouseout() | Attaches/Triggers the mouseout event |
| mouseover() | Attaches/Triggers the mouseover event |
| mouseup() | Attaches/Triggers the mouseup event |
| off() | Removes event handlers attached with the on() method |
| on() | Attaches event handlers to elements |
| one() | Adds one or more event handlers to selected elements. This handler can only be triggered once per element |
| $.proxy() | Takes an existing function and returns a new one with a particular context |
| ready() | Specifies a function to execute when the DOM is fully loaded |
| resize() | Attaches/Triggers the resize event |
| scroll() | Attaches/Triggers the scroll event |
| select() | Attaches/Triggers the select event |
| submit() | Attaches/Triggers the submit event |
| toggle() | Removed in version 1.9. Attaches two or more functions to toggle between for the click event |
| trigger() | Triggers all events bound to the selected elements |
| triggerHandler() | Triggers all functions bound to a specified event for the selected elements |
| unbind() | Removes an added event handler from selected elements |
| undelegate() | Removes an event handler to selected elements, now or in the future |
| unload() | Attaches an event handler to the unload event |
jQuery Callback Functions
Typical syntax: $(selector).hide(speed,callback);
Example with Callback
$("button").click(function(){
$("p").hide("slow",function(){
alert("The paragraph is now hidden");
});
});
$("p").hide("slow",function(){
alert("The paragraph is now hidden");
});
});
Example without Callback
$("button").click(function(){
$("p").hide(1000);
alert("The paragraph is now hidden");
});
$("p").hide(1000);
alert("The paragraph is now hidden");
});
Monday, 18 March 2013
Constructors (basics)
Using Constructors (C# Programming Guide)
public class Taxi { public bool isInitialized; public Taxi() { isInitialized = true; } } class TestTaxi { static void Main() { Taxi t = new Taxi(); Console.WriteLine(t.isInitialized); } }
public class Employee { public int salary; public Employee(int annualSalary) { salary = annualSalary; } public Employee(int weeklySalary, int numberOfWeeks) { salary = weeklySalary * numberOfWeeks; } }
This class can be created by using either of the following statements:
Employee e1 = new Employee(30000); Employee e2 = new Employee(500, 52);
A constructor can use the base keyword to call the constructor of a base class. For example:
public class Manager : Employee { public Manager(int annualSalary) : base(annualSalary) { //Add further instructions here. } }
public Manager(int initialdata) { //Add further instructions here. }
public Manager(int initialdata) : base() { //Add further instructions here. }
public Employee(int weeklySalary, int numberOfWeeks) : this(weeklySalary * numberOfWeeks) { }
The use of the this keyword in the previous example causes this constructor to be called:
public Employee(int annualSalary) { salary = annualSalary; }
shivendra mani.................%$#%^$#
.NET and Object Serialization
//Core Serialization
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
namespace MyObjSerial
{
[Serializable()] //Set this attribute to all the classes that want to serialize
public class Employee : ISerializable //derive your class from ISerializable
{
public int EmpId;
public string EmpName;
//Default constructor
public Employee()
{
EmpId = 0;
EmpName = null;
}
}
}
//Main class
public class ObjSerial
{
public static void Main(String[] args)
{
//Create a new Employee object
Employee mp = new Employee();
mp.EmpId = 10;
mp.EmpName = "Omkumar";
//Add code below for serialization
}
}
// Open a file and serialize the object into it in binary format.
// EmployeeInfo.osl is the file that we are creating.
// Note:- you can give any extension you want for your file
// If you use custom extensions, then the user will now
// that the file is associated with your program.
Stream stream = File.Open("EmployeeInfo.osl", FileMode.Create);
BinaryFormatter bformatter = new BinaryFormatter();
Console.WriteLine("Writing Employee Information");
bformatter.Serialize(stream, mp);
stream.Close();
//Clear mp for further usage.
mp = null;
//Open the file written above and read values from it.
stream = File.Open("EmployeeInfo.osl", FileMode.Open);
bformatter = new BinaryFormatter();
Console.WriteLine("Reading Employee Information");
mp = (Employee)bformatter.Deserialize(stream);
stream.Close();
Console.WriteLine("Employee Id: {0}",mp.EmpId.ToString());
Console.WriteLine("Employee Name: {0}",mp.EmpName);
Friday, 15 March 2013
Subscribe to:
Posts (Atom)
