Pages

Wednesday, November 16, 2011

Change folder or file properties via command prompt....

Hi folks,
Don't you ever had an issue with viewing hidden files or folders in your personal computer or office computer?
I had this issue in my computer few times, because of virus attack. Sometimes this can happen because of some other reasons like problems in system files.
In my case system didn't allow me to change the properties of particular file in my PC. To overcome this problem i found a simple way which can change file or folder properties via command prompt.
Let's see how can we do that......


  • Just imagine you have a wmv file name 'Advertisement'.( Hidden file )
  • File path is C:\Users\udara\Desktop\Personal\Customize\My Advertisement.
  • First open command prompt.
  • Type ' C: ' and press Enter.
  • Then type ' cd Desktop ' and press Enter.
  • Then type ' cd Customize ' and press Enter.
  • Type ' My Advertisement ' and then press Enter.
  • Type ' attrib ' + ' -s ' + ' -h ' + <File name or Folder name> ( In this case 'Advertisement' ) and then press Enter.
You can see your file now in related folder.
You can use this command for a hidden folders also. This command functioning well in WINDOWS XP and also WINDOWS 7 platforms.


To find out more details about these commands, follow
http://www.computerhope.com/attribhl.htm

Friday, November 11, 2011

Trigger (PRE-QUERY), set dynamically properties....


Introduction
A form trigger is a block of PL/SQL code that adds functionality to your application. Triggers are attached to objects in your application. When a trigger is fired, it execute the code it contains. Each trigger's name defines what event will fire it, for instance, a WHEN-BUTTON-PRESSED trigger executes it's code each time click on the button which trigger is attached, or we can say , a form trigger is a set of PL/SQL actions that happen each time an event such as WHEN-CHECKBOX-CHANGED, WHEN-BUTTON-PRESSED, or WHEN-NEW-RECORD-INSTANCE occurs. You can attach several triggers to data QUERY. The most populer of them are PRE-QUERY and POST-QUERY. 

PRE-QUERY Trigger
The PRE-QUERY trigger fires before SELECT statement finalized.The POST-QUERY trigger fires before selected records are presented to the user. It fires after records are retrieved but before they are displayed. So you can use it to enhance a query's in a number of ways. Your POST-QUERY trigger can contain code to calculate or populate control items.

Change an OBJECT PROPERTY DYNAMICALLY
 You can always change object property dynamically. The SET_OBJECTNAME_PROPERTY built_in sub program will change an object property dynamically.

Thursday, November 3, 2011

Insert data in to a table by using simple FOR loop.....

Recently i had to insert several number of data rows to database table related to my oracle form( For the testing purpose). There's few constrains in that particular table. Before insert data, i have to concern about those constraints. Because my insertion can violate those constraints.  I disabled relevant constraints according to my data insertion and run simple FOR LOOP mentioned below.

BEGIN
    FOR v_LoopCounter IN 1..120 LOOP
        INSERT INTO TABLE_NAME  (col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,col13,
         col14,col15,col16,col17,col18,col19,col20,col21,col22,col23,co24,co25)
        VALUES ('TESTU'||v_LoopCounter,'test'||v_LoopCounter,'94',null,null,null,null,null,      null,null,null,null,null,null,null,'1','Y','val',sysdate,'val1',sysdate,null,
       'E',null,'N');
    END LOOP;
END;


This is very simple sql code for insert several data rows to a table. Nyway you can use any number you want for counter. It depends on the number of data rows you want to insert to your table. This is more suitable for testing purpose. Because it's really hard to edit each and every column value in each insertion. But for the simple testing purpose you can edit unique fields by adding loop counter as a part of that field value.

Running a 'for' loop in ms sql

I just want to insert few rows in to my table at once. It seems complicated for me to do that in a way i want. But i did stumble upon a convenient way for populating lot of new rows using a simple technique that is not using bulk insert. It is actually pretty basic stuff, but useful for my purpose.



DECLARE @count INT
SET @count = 0
WHILE (@count < 40)
BEGIN
   INSERT INTO some_table ([columnA], [columnB]) VALUES ('val1', 'val2')
   SET @count = (@count + 1)
END

All that was really done is a manual 'For' loop using the SQL WHILE loop.  Just set the number in WHILE (@count < 40) to however many times you want the loop to run. 

Tuesday, November 1, 2011

T-sql (Transact SQL) Reference (Database Engine)


Transact-SQL is central to using SQL Server. All applications that communicate with an instance of SQL Server do so by sending Transact-SQL statements to the server, regardless of the user interface of the application.


The following is a list of the kinds of applications that can generate Transact-SQL:
  • General office productivity applications.
  • Applications that use a graphical user interface (GUI) to let users select the tables and columns from which they want to see data.
  • Applications that use general language sentences to determine what data a user wants to see.
  • Line of business applications that store their data in SQL Server databases. These applications can include both applications written by vendors and applications written in-house.
  • Transact-SQL scripts that are run by using utilities such as sqlcmd.
  • Applications created by using development systems such as Microsoft Visual C++, Microsoft Visual Basic, or Microsoft Visual J++ that use database APIs such as ADO,
    OLE DB,
    and ODBC.
  • Web pages that extract data from SQL Server databases.
  • Distributed database systems from which data from SQL Server is replicated to various databases, or distributed queries are executed.
  • Data warehouses in which data is extracted from online transaction processing (OLTP) systems and summarized for decision-support analysis.