Tuesday, June 30, 2009

Useful System Stored Procedures:

Useful System Stored Procedures:

Lists the number of table in Database
sp_help
To get code for Stored Procedure
sp_helptext 'usp_Load_mntLoadDate'
Who is accessing which database…
sp_who 'CMC\sbaheti'
Verify dependencies for give object,For example we want to know where 'datedim' table is referenced
sp_depends datedim
Deatils of Databse
sp_helpdb DefaultReportStage
Details of all table
sp_tables
Details of particular table
sp_tables 'DateDim'


To rename the object:
Rename table
sp_rename 'AssetDetails','AssetDet'
Rename column
sp_rename 'AssetDet.AssetName','AssetNm'

Sunday, June 28, 2009

Correlated SubQueries in DB2

A sub query in which the inner (nested) query refers back to the table in the outer query is called correlated sub queries in DB2.

Correlated sub queries must be evaluated for each qualified row of the outer query that is referred to.

Friday, June 26, 2009

SUDO Access (Redhat vs SUSE Linux)

SUDO Access (Redhat vs SUSE Linux):
RHCE:
1) Create the user
2) Add the user to Wheel group
3) Uncomment the Wheel group entries line in sudoers file.
4) User can able execute root users previledged command by executing sudo followed by the commands

SLES 9:
But in SLES Apart from above steps We have to comment out the following lines inorder to provide SUDO Access to the users.
# Defaults specificationDefaults targetpw # ask for the password of the target user i.e. root

Note:
Without commenting the above lines will ask only the root pwd to allow normal user to get sudo access.

Wednesday, June 24, 2009

Email won’t go if the destination is over 500 miles

Imagine yourself as a system administrator for a moment and you get a weird call from a user saying that any email that he sends would fail if the destination point is over 500 miles. You'll choke for a moment and you ll call that guy Insane. E-Mails don't have distance or stamps. It goes to whomever it needs to, wherever he is on the face of the earth.

I read a blog of a system admin who went through a smiliar situation and how he ironed out the issue. It definitely wasn't the users fault. At times all it requires to catch serious bugs is a totally new perspective!!

Read more here: http://www.ibiblio.org/harris/500milemail.html?test

Monday, June 22, 2009

Using HashMap

Map is an object that stores key/volume pairs. Given a key, you can find its value. Keys must be unique, but values may be duplicated. The HashMap class provides the primary implementation of the map interface. The HashMap class uses a hash table to implementation of the map interface. This allows the execution time of basic operations, such as get() and put() to be constant.

This code shows the use of HaspMap. In this program HashMap maps the names to account balances.

import java.util.*;
public class HashMapDemo {
public static void main(String[] args) {
HashMap hm = new HashMap();
hm.put("Rohit", new Double(3434.34));
hm.put("Mohit", new Double(123.22));
hm.put("Ashish", new Double(1200.34));
hm.put("Khariwal", new Double(99.34));
hm.put("Pankaj", new Double(-19.34));
Set set = hm.entrySet();
Iterator i = set.iterator();
while(i.hasNext()){
Map.Entry me = (Map.Entry)i.next();
System.out.println(me.getKey() + " : " + me.getValue() );
}
double balance = ((Double)hm.get("Rohit")).doubleValue();
hm.put("Rohit", new Double(balance + 1000));
System.out.println("Rohit new balance : " + hm.get("Rohit"));
}
}

source: java-tips.org

Saturday, June 20, 2009

Mainframe and Commonly used Dataset options in SAS

1) FIRSTOBS - Causes processing to begin at a specified observation.
Example : data new (firstobs = 30);

2)OBS - Causes processing to end with the nth observation.
Example : data new (obs = 30);

3)LABEL - Specifies the label for the data set. Example : data new (Label = ‘label for input dataset is not permanent’);

4)WHERE - Selects the observations that match the specified condition.
Example : data new (where = (age ge 45));

5)YEARCUTOFF option
This System option specifies the first year of a 100 year span used by Informats & functions.
Based on this, the century values of dates are determined by SAS system if the year is specified as a two digit year.

The default value is 1920.

If the yearcutoff option is set to 1950 then the value
09/18/49 with MMDDYY8. format will be read as 18th September 2049.
This does not have any effect on year specified in four digits

Thursday, June 18, 2009

Stored Procedures

Stored procedures are specialised programs stored in RDBMS. A stored procedure is a named group of SQL statements (and in some cases operating system calls) that have been coded and stored directly in a database.

Stored procedures provide the following advantages:
1) Reduced network traffic
2) Improved performance of server-intensive work
3) Separation and reuse of business logic
4) Access to server features

Tuesday, June 16, 2009

MDT in CICS

MDT (Modified Data Tag) is one bit of the attribute character. If it is off(0), it indicates that this field has not been modified by the terminal operator. If it is on(1), it indicates that this field has been modified by the operator. Only when MDT is on, will the data of the field be sent by the terminal hardware to the host computer ( i.e., to the application program, in end).
An effective use of MDT drastically reduces the amount of data traffic in the communication line, thereby improving performance significantly. Therefore, BMS maps and CICS application programs should be developed based on careful considerations for MDT.

Sunday, June 14, 2009

Proceedure to execute Stored procedures

1) Create the stored procedure.
2) Write the stored procedure.
3) Compile and Bind the stored procedure.
4) Insert a row in SYSIBM.SYSPROCEDURES.
5) Write the Application Program.
6) Compile and Bind the Application program.
7) Run the Application program

Friday, June 12, 2009

Server requirements for deploying a Flex application

Flex or Flash applications are compiled to SWF format. You can deploy SWF file on a normal web server.

SWF files are downloaded on to the the client and will run on the Flash Player. So there are no specific requirements for hosting or deploying a Flex application. A normal web server which is used to deploy a HTML page is sufficient for deploying the SWF files.

In the URL below there is a detailed description on how to deploy a Flex application. You will find very useful.

http://livedocs.adobe.com/flex/3/html/deployingoverview_02.html

Wednesday, June 10, 2009

How-To: Copy Excel cells into a Word document!!

Just thought of writing about one of the pain points i often come across while working on Excel and Word. Whenever we try to paste some excel cells into Word, the usual problem faced is the loss of formatting. This can be overcome by following the steps mentioned below:

1.Select your cells in Excel, copy (Ctrl+C) then in your Word document, on the Edit menu,
2.click Paste Special
3.Click Microsoft Office Excel Worksheet Object, and then click OK

Note: If you are using word 2007 then press ALT+CTRL+V. This reduces formatting problems between Word and Excel.

Monday, June 08, 2009

Add Language Translation feature to your Blog.

In order to add language translation feature to your Blog or Website, follow the steps below

1.) Point your Browser to Google Translate Tools section. (http://translate.google.com/translate_tools?hl=en)
2.) Select the language of your website or blog. The option you select should be the same as the language of your website, else the translation won’t work properly.
3.) Copy the code from the page and paste it on your webpage whereever you would like to have the language translation feature.

Source: http://technofriends.in/2008/11/23/how-to-add-language-translation-feature-to-your-website-or-blog/

Saturday, June 06, 2009

Why Selenium scripts fail when run outside the web server for Selenium Core?

As we know selenium scripts will fail when we place our scripts outside the AUT (Application Under Test) web server for Selenium Core, this is due to the reason that Selenium core is built with DHTML / JavaScript. When we are using javaScript we should bound to Same Origin Policy of JavaScript.

What is Same Origin Policy?
Same origin Policy states that javaScript is only allowed to read / Modify the HTML content from the same origin as source i.e, javaScript can able to read / Modify the HTML only when the source and destination of the scripts are from same web server.

For Example:
Suppose a person is working on crutial page and some unsecured webpage simultaneously which are from different sources. If JavaScript is not bound to same Origin Policy, then the other user / Owner of unsecured web page can access / Modify the content of crutial web page. In order to avoid this JavaScript should be bound to Same Origin Policy.

But when we install Selenium IDE, this acts as a trusted FireFox extension and therefore we can violate the Same Origin Policy.

Thursday, June 04, 2009

Java Tokenizing Techniques Comparision

If Performance is a Matters !!!

In this blog I am going to discuss about my experience in measuring the fastness of different Tokenizing techniques in Java.

Tokenizing! The first that comes to our mind is StringTokenizer.

When you google it, the other popular things are Scanner, String.split() .

Scanner can me more handy if we want to split the string based on Regex. Of the above three based on the fastness of tokenizing StringTokenizer wins the race followed by Scanner and split.

Tuesday, June 02, 2009

Optimistic Concurrency using Hibernate

I came across an interesting but most common use case last week. It goes like this that we need to manage concurrency for the data which are being worked on by multiple users at the same time…Obviously Pessimistic Locking of Database records is not a possible solution as it will affect the performance and scalability of the application.

When looking for a solution, straight away the answer could be that the Framework / ORM has to provide some mechanism to control.

Luckily the use case we are working on is using Hibernate and we ought to find a way from Hibernate. Being a strong recommender of hibernate I felt confident that it will have something to solve this.

Hibernate provides technique called "Optimistic Concurrency" using Versioning / Timestamp. What is intersting here? Versioning and Timestamp are same old stuff. But above these two it has another concept called "Session-Per-Conversation" or "Long Conversation" using which we can do Optimistic Concurrency control without change in datastructure and without much change in code.

For More details visit:
http://www.hibernate.org/hib_docs/reference/en/html_single/#transactions-optimistic
http://hibernate.bluemars.net/43.html
Computers Add to Technorati Favorites Programming Blogs - BlogCatalog Blog Directory