discussing some technical aspects covering tools, frameworks, technologies etc (the areas where i m involved and getting experienced) - feel free to discuss!

Wednesday, April 04, 2007

How to get the list of files in a directory and save it in a file

You may need to get the list of files inside a folder with the appropriate structures being maintained.

This tip will help you to get the complete list of filenames within a directory structure in Windows OS.

(1) Go to Command Prompt
(2) Navigate to any directory of your interest
(3) Type dir /b /s "Root-directory" > "filename.extension"

whereas

/b -> use bare format (no heading information or summary)
{summary is the date time info, size , file or directory attribute etc.}

/s -> displays file in specified directory and all subdirectories.

Root-directory -> is the directory from which you want the file list info
{if Root-directory is omitted it will process from the current directory}

> -> Redirection Operator or Symbol.
{the output of the command on its left would be sent to its right}

fileName.extension -> any file name with extension you want
{example. directory-structure.txt}

Make it Automated in a Batch File

You can even write a batch file with another line to open it in the
appropriate application.


dir /b /s "Root-directory" > "filename.extension"
notepad "filename.extension"
Save these two lines in a batchfile as ".bat" and run this batch file from command prompt. It would automatically save it in the file and gets opened in Notepad. You could use any other convenient applications to open as you wish.

Hope you may need not take screenshots for directory structure {if at all you had been doing so} ;-).

Friday, February 23, 2007

Tip to increase the efficiency while deleting huge volume of rows

This tip would be very much useful when you have enormous rows in a table and you are trying to delete/remove the rows using the usual, "DELETE FROM <tableName>;" statement.

You may ask whats the consequences of using the DELETE statement and thats what its purpose is. But, not just deletion, for that matter any DML statement will make use of something called TRANSACTION LOG which is nothing but the buffer/temporary storage where all the data would be kept until there is an explicit COMMIT or ROLLBACK.

Once a Commit is issued, the data kept in the Transaction Log is written into the database files in its own appropriate format (.dat for data files, .inx for index files in IBM DB2 database - which may vary in Oracle, MySQL, SQL Server etc..).

When a rollback is issued, the data in the temporary Transaction Log is removed and thereby no state change happens to the data files.

Moreover, its gonna be time consuming wherein the time is directly proportional to the dense of data.

When you deal with large number of data to be dealt with, be it inserting, updating or deleting, you might end up in something called, "The Transaction Log is FULL" while doing the operation. Most of us might not have encountered this situtation as we do just deal with 100s or max 1000s of data. People who are dealing with lakhs, millions of rows might have been aware of this. Say, who are in Data Warehousing, Business Objects etc.

When we encountered the situation, one of my teammates in my client place (Yadati Ravishankar) had come up with a query what he found out in googling. This query does the magic by just clearing up the table with very very less time compared to that of plain old DELETE statement.

Here you go...

"ALTER TABLE [<SchemaName>.]<tablename> ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE;"

This query does alter the table with empty rows but while doing the same it requests the db engine not to activate the Logging. Thereby it is able to get the request serviced within seconds!!

Try with huge data buddies..then only you can make out the difference!!

Good luck!

Tuesday, January 16, 2007

Java #Q1: What would be the output?

public class Test
{
public void method1(Object o)
{
System.out.print("object");
}
public void method1(String s)
{
System.out.print("string");
}
public static void main(String[] args)
{
Test t = new Test();
t.method1(null);
}
}


When running the program, the output would be
(a) object
(b) string
(c) objectstring
(d) stringobject


Answer:
(b) string

Explanation:
It is the hierarchy of objects being searched for a match, which is quite similar to the exception objects of catch blocks. The search process is done in the bottom-up manner wherein the object of class of least node is searched first and its continued upwards to the super/parent classes till the end is reached.

Tuesday, May 02, 2006

jsfffffff

Java Server Faces Notes
=====================
- M Raghavan alias Saravanan, 13Jan2006 Friday 5:25 PM

--> JSF - is mainly used to develop the custom UI Parts in any application in a neutral manner.
(*)to create a standard framework for user interface components for web applications
(*)JSF lets you build web applications that run on a Java server and render the user interface back to the client
(*)provides web application lifecycle management through a controller servlet, and a rich component model with event handling and component rendering
--> Though it also follows MVC 2 pattern (separation of presentation logic and business logic) its focus is fully into the VIEW tier, where as
--> Struts is concentrating mainly on the Controller tier. But still there are some overlaps are there between these two frameworks.
--> Integration of these two frameworks is in progress. See Apache site for the same.

MINIMUM REQUIREMENT:
-----------------------------
--> Works with the Servlet 2.3 or more and JSP 1.2 or more

Two Main Components of JSF:
~~~~~~~~~~~~~~~~~~~~~~~~~
(1) Java APIs to represent UI Components, manage state, handle events, and validate Input. (Internationalization and accessibilty!)
(2) Two JSP Custom tag libraries for expressing user interfaces (UI) components within a JSP page and for writing components to server-side objects. Page authors can easily add UI components to their pages.

The UI parts are rendered on the Server and then the rendered output (HTML Of course as most of the clients - browsers are relying on HTML as the Least Common Denominator) is sent to the client on the first.

Browser---->(request for a jsp page for ex) ----> form.jsp ----> UI ===> Form rendered with the components



Guidelines/Rules to Use
****************************
--> In order to user JSF tags, you need to include the taglib directives to the "html" and "core" tag libraries that refer to the standard HTML renderkit library and the JSF core tag library, respectively
--> A page containing JSF tags is represented by a tree of components whose root is the "UIViewRoot", which is represented by the "view" tag. All component tags MUST BE ENCLOSED in the "view" tag. Other content such as HTML and other JSP pages can be enclosed within that tag.
--> A typical JSP page includes a form, which is submitted when a button is clicked. The tags representing the form components (such as textfields and buttons) MUST BE NESTED inside the "form" tag.


POINTS TO PONDER:
################
(1) Value-binding expressions (syntax: #{bean-managed-property}, eg: value="#{UserNumberBean.minimum}")
(*) minimum is the attribute in the bean class UserNumberBean
Method-binding expressions (syntax: #{method-name-of-the-bean-to-validate}, eg: validator="#{UserNumberBean.validate}")
(*) validate is the method in the bean class UserNumberBean

The Model Object
----------------------
--> A typical JSF application uses a bean with each page in the application.
--> The bean defines the properties and methods associated with the UI components used on the page.
--> A bean can also define a set of methods that perform functions, such as validating the component's data, for the component.
--> The model object bean is like any other JavaBeans component: it has a set of accessor methods.

Application Configuration Resource File
------------------------------------------------
An application configuration resource file, "faces-config.xml", is used to define your managed beans, validators, converters, and navigation rules

Faces Servlet
============
(*) has to be configured in web.xml (similar to ActionServlet in Struts)

--> in order to use the JSF framework in your web applications, you need to define the "FaceServlet and its mapping" in your deployment descript file, web.xml.
--> This servlet "acts as the FRONT CONTROLLER" and handles "all JSF-related requests"

JSF Components are organized into categories
********************************************************
--> Added Components: JSF components you have written or acquired elsewhere and imported into the Java Studio Creator development environment
--> JSF Standard Components: The basic set of components including form fields, hyperlinks, labels and text. The JSF components are organized into logical groups by function.
--> JSF Validators/Converters: Components that modify or validate data in other components but are not themselves displayed
--> Advanced: JSP tags for advanced JSF features. These tags generally do not have a visual appearance and are only useful if you are familiar with both the JSP and JSF technologies.

Conclusion
###########
(*) JavaServer Faces (JSF) is a user interface framework for building web applications that run on the server side and render the user interface back to the client.
(*) It lets you develop tools that simplify coding web-based Java applications

(*) JSF requires little more effort than an ordinary JSP configuration -- but with many more benefits

Saturday, April 29, 2006

just test in teknical stuff

hi folks,
this just a test post in this teknical stuff..

Free java e-books, visit http://www.jvsoft.org/index.html

Raghs.

About Me

ஏதோ பிறந்தோம், ஏதோ வாழ்ந்தோம் என்றிருப்பதல்ல வாழ்க்கை! எப்படி வாழ்ந்தோம் என்பதும் ஒரு அங்கம். வாழக் கிடைத்த வாழ்க்கையில், ஒரு சிலருக்காவது வசந்தத்தின் முகவரியை அறிமுகம் செய்தோமேயானால் அதுவே வசீகரத்தின் வனப்பைக் கூட்டும்!