Labels

Saturday, October 27, 2012

What is JQuery?

 Q: - What is JQuery?

JQuery is Java Script library or Java Script Framework which helps in how to traverse HTML documents, do some cool animations, and add Ajax interaction to any web page. It mainly helps programmer to reduce lines of code as huge code written in Java Script, can be done easily with JQuery in few lines.
Q: - What does dollar Sign ($) means in JQuery?

Dollar Sign is nothing but it's an alias for JQuery. Take a look at below jQuery code

$(document).ready(function(){
});
Over here $ sign can be replaced with "jQuery " keyword.
jQuery(document).ready(function(){
});
Q: - How is body onload() function is different from document.ready() function used in jQuery?

Document.ready() function is different from body onload () function because off 2 reasons.
1. We can have more than one document.ready() function in a page where we can have only one onload function.
2. Document.ready() function is called as soon as DOM is loaded where body.onload() function is called when everything gets loaded on the page that includes DOM, images and all associated resources of the page.
Q: - How is body onload() function is different from document.ready() function used in jQuery?

Document.ready() function is different from body onload () function because off 2 reasons.
1. We can have more than one document.ready() function in a page where we can have only one onload function.
2. Document.ready() function is called as soon as DOM is loaded where body.onload() function is called when everything gets loaded on the page that includes DOM, images and all associated resources of the page.
JQuery Interview Questions & Answers

Q: - What are the steps you need to follow to use jQuery in ASP.Net project?

It's really simple. One just need to add reference of javascript file(.js). Go to Jquery.com and download the latest version of jQuery. When download is completed, there is a "jQuery-1.3.2.js" in the folder. Include this file
<script src="_scripts/jQuery-1.3.2.js" type="text/javascript"></script>
and you good to go now for JQuery.
Note : 1.3.2 denotes the library version.. It can be vary depending upon the version of Jquery you download.


Q: - There are 3 types of selectors in Jquery?

1. CSS Selector
2. XPath Selector
3. Custom Selector
Q: - Means of dollar Sign ($) in JQuery?

Dollar Sign is nothing but it's an alias for JQuery. Take a look at below jQuery code
$(document).ready(function(){
});
Over here $ sign can be replaced with "jQuery " keyword.
jQuery(document).ready(function(){
});

 Q: - What is the basic used of jQuery() function

->Establish code to be executed when the DOM is ready for manipulation.
->Help as a namespace for global utility functions.
->Create DOM elements from HTML markup.
->Select and wrap DOM elements to operate upon
Q: - which are basic selectors in jQuery (cross browser)?

->Element ID's
->CSS class name
->Tag name
->last but not the least DOM hierarchy.
Q: - How do you select an item using css class or ID and get the value by use of jquery

If an element of html like < div> , < p> or any tag have ID MyId and class used MyClass then we select the element by below jquery code
$('#MyId') for ID and for classs $('.MyClass') and for value
var myValue = $('#MyId').val(); // get the value in var Myvalue by id
Or for set the value in selected item
$('#MyId').val("print me"); // set the value of a form input
 Q: - what the use of $ symbol in Jquery

$ Symbol is just replacement of jquery means at the place of $ you may use jquery hence $ symbol is used for indication that this line used for jquery
Q: - How you will use Jquery means requirement needed for using jquery

Nothing more need to do just olny download jquery library(.js file) from any of the jquery site Download jquery and just linked with your html pages like all other javascript file
like below :
< script src="jquery.js" language="javascript" type="text/javascript">     Questions : 3 what the use of $ symbol in Jquery Answers : 3
$ Symbol is just replacement of jquery means at the place of $ you may use jquery hence $ symbol is used for indication that this line used for jquery

Q: - How do you select an item using css class or ID and get the value by use of jquery

If an element of html like < div> , < p> or any tag have ID MyId and class used MyClass then we select the element by below jquery code

$('#MyId') for ID and for classs $('.MyClass') and for value

var myValue = $('#MyId').val(); // get the value in var Myvalue by id
Or for set the value in selected item

$('#MyId').val("print me"); // set the value of a form input
Q: - >How to get the server response from an AJAX request using Jquery?

When invoking functions that have asynchronous behavior We must provide a callback function to capture the desired result. This is especially important with AJAX in the browser because when a remote request is made, it is indeterminate when the response will be received.
Below an example of making an AJAX call and alerting the response (or error):
 $.ajax({
     url: 'pcdsEmpRecords.php',
     success: function(response) {
        alert(response);
     },
     error: function(xhr) {
        alert('Error!  Status = ' + xhr.status);
     }
});


Q: - How do you update ajax response with id " resilts"

By using below code we can update div content where id 'results' with ajax response
 function updateStatus() {
     $.ajax({
            url: 'pcdsEmpRecords.php',
            success: function(response) {
             // update div id Results
             $('#results').html(response);
         }
     });
}


Friday, October 26, 2012

We really Does A Business Need SOA?

If an enterprise is willing to invest in enabling existing applications as well as developing new applications using service oriented architecture (SOA), then there has to be concrete business benefit. In this article, we explore causes behind investments in service oriented enterprises. We try to see what senior management must be visualizing when they approve budgets for SOA based applications.
Competition:Every business domain is experiencing fierce competition, hence there is tremendous pressure on IT infrastructure to support continusously changing business expectations. Business is expecting quick implementation of new ideas, so that the market can be captured before competitors are even ready. Time taken to generate an idea and realize it has to be very less. Applications invoving these business changes should also undergo transformation rapidly, and make new things available to customers. SOA introduces modularity which eases introduction of new modules without largly affecting other application stack. Thus the desired functionality can be brought to market with unit development and can be pluged in to existing functionality.
Cost Implications:Business always wants cost effective solutions. IT budgets are usually to run existing applications to continue business, and to change applications to intruduce new things. It is expected that there should be lesser and lesser expenditure in maintaining the existing applications. Also the cost of chaning existing applications as well as introducing of new functionality should be minimum. Service oriented structuring of applications introduces loose coupling, which allows changing applications without much impacting others. Loose coupling also helps in introduction of new functionality easily. In short IT is commoditized to benefit business.
Adaptivity:Loose-coupling makes applications adaptive. Applications can grow and shrink as required. Also Service oriented architecture is based on standards. This makes applications (interfacing) generic enough so that these can be integrated with each other without much effort. Also this avoids vendor locking. Any change in vendor (application server, operating system etc.) can be accomodated easily.
Operational Effectiveness:Each service in an enterprise can be treated as a separate business unit. Now we can manage these servicess individually with better effectiveness instead of managing a bunch of highly integrated functionalities in an application. This improves the operational effeciency of people supporting these services. Support team does not face complexities arising due to integrated nature of applications.
Better Control: Services are individual business units. We can monitor each of them for service related paramters such as performance, service level agreement, revenue generation, business loss etc. This can help in defining road map of a service along with business growth.
The list of business reasons can be endless. Here we have few important business drivers which impact most of the decisions. In a nutshell, we can say that SOA is needed to make IT catch up with high speed of changing business environment.

Best Spring Interview Questions

What is Spring?
Spring is an open source enterprise application development framework, which is primarily based on IOC (inversion of control) or DI (dependency injection) design pattern. It provides ready container to create and manage objects and also provides enterprise services to those objects. It provides ready components for different tiers of application e.g. web, middle/business and data access.
What is inversion of control (IOC) or Dependency Injection?
Inversion of control (IOC) or dependency injection (DI) is a design pattern used to give control to the assembler of classes. Generally, if a class wants to use another class, it instantiates desired class. But using this design pattern, the instantiation control is provided to the assembler. Assembler instantiates the required class and injects it in using class.
What are different types of DI?
- Constructor Injection
- Setter Injection
- Interface Injection
What are different modules in Spring?
Following six modules are there in Spring.
- Core: Springs IoC container and core services
- Web: Spring MVC and ability to integrate Spring with other web frameworks like Strusts, Tapestry, JSF etc.
- JEE: Java enterprise services like EJB support, JMX, JMS, JCA etc.
- ORM: Support to integrate with object relation mapping frameworks like hibernate, iBatis, Toplink etc.
- DAO: Helps in implementing Data Access Object design pattern. Provides support for Spring JDBC transaction management.
- AOP: Implementation of cross cutting concerns through Spring AOP and AspectJ.
What is new in Spring 2.5 as compared to 2.0?
Following changes are introduced in Spring 2.5.
- IOC container: New bean scopes, easier xml configuration, extensible xml authoring, annotations
- AOP: Easier xml configuration, support for @AspectJ aspects, support for bean name pointcut element, support for AspectJ load-time waving
- Middle tier: Declarative transactions in xml, full Websphere transaction management support, JPA, Asynchronous JMS, JDBC improvements
- Web tier: Changes in Spring MVC, Portlet framework, Tiles, JSF, JAX-WS support, etc.
What is IoC container of Spring?
Spring IoC container take care of instantiation of objects, injection of objects in each other and providing enterprise services (e.g. AOP, transaction management) to these objects.
What is BeanFactory interface?
BeanFactory provides configuration framework to Spring object creation and basic functionality around object management.
What is ApplicationContext?
ApplicationContext is built around Spring’s BeanFactory and it provides enterprise centric features e.g. AOP features, message resourcing, event propagating, application-layer-specific contexts to applications.
What is difference between BeanFactory and ApplicationContext?
BeanFactory is core configuration and basic functionality centric while ApplicationContext is enterprise-centric functionality support.
What is your preference BeanFactory or ApplicationContext? Why?
ApplicationContext. It provides all features provided by BeanFactory and enterprise centric more features, which may be required by application in future.
How to instantiate IoC container?
ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {“services.xml”, “daos.xml”});
How does a web application use Spring’s configuration xmls?
Spring container/configuration xmls can be integrated with web application through web.xml. Following entries in web.xml can integrate Spring container with web container.
 <context-param>
  <description>
  Context parameter to integrate Spring and Web containers
  </description>
  <param-name>contextConfigLocation</param-name>
  <param-value>
  classpath: services.xml,
  classpath: daos.xml
  </param-value>
 </context-param>
 <listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
 </listener>
How to integrate multiple bean configuration xmls?
Multiple bean configuration xmls are created to separate configurations according to layers so that it becomes easy to manage and maintain them. These configuration xmls can be imported in single xml to combine all of them.
<beans>
    <import resource="services.xml"/>
    <import resource="daos.xml"/>

    <bean id="bean1" class="..."/>
    <bean id="bean2" class="..."/>
</beans>
What are Lazily-instantiated beans?
In default behavior Spring instantiates singleton beans at the time of startup, which is called eagerly instantiation. This is good behavior as it exposes any problems in instantiation of beans at start up only. But sometimes this behavior is not expected hence by addition lazy-init=”true” to the bean definition the instantiation can be postponed to first request. Also following configuration will not allow any bean to get instantiated eagerly.
<beans default-lazy-init="true">
    <!-- no beans will be pre-instantiated... -->
</beans>
What is autowiring?
By Autowiring, Spring injects dependencies without having to specify those explicitly. Spring inspects bean factory contents and establishes relationships amongst collaborating beans. To implement it, just add autowire property in xml configuration.
What are different modes of autowiring?
Autowiring has following five modes
- no: No autowiring.
- byName: Autowiring by property name, means bean matching property name is autowired.
- byType: Bean having type as that of property type is autowired.
- constructor: Similar to byType just that the property is in constructor.
- autodetect: Spring is allowed to select autowiring from byType and constructor.
What are different bean scopes available to configure?
Following scopes can be assigned to different beans.
- singleton: One bean instance per IoC container
- prototype: Any number of instances of bean
- request: Within HTTPRequest object scope
- session: As long as HttpSession is alive
- globalsession: Within life-cycle of global HttpSession. Applicable in portlet context usually.
What is default scope in Spring?
Singleton.
How can you control bean instantiation process?
Bean instantiation by Spring can be controlled using initialization call backs. There are two ways of doing it. First is having a initialization method (say init()) and specifying it in bean configuration as ‘init-method’ property. Second is implementing InitializingBean interface and implementing afterPropertiesSet() method in it.
How can you control bean destruction process?
There are two ways of doing it. First is add a destroy() method and specify it in bean configuration as ‘destroy-method’ property. Second is implement DisposableBean interface and implement destroy() method of it.
How do you implement inheritance in bean definition?
Bean definition inheritance can be implemented by specifying ‘parent’ property of the bean equal to its parent bean definition id. This bean class must have extended itself from the parent bean class.
What are advantages of Spring usage?
- Spring provides commonly required enterprise services without a need of expensive application server.
- It reduces coupling in code and improves maintainability.
- Readily available component improve productivity and subsequently reduce development cost.
- Pojo based programming enables reuse.
- Dependency Injection can be used to improve testability.
What all you have to do to start using Spring?
- Download Spring (and dependent Jars) from Spring’s site.
- Create application context xml to define beans and dependencies.
- Integrate this xml with web.xml
- Deploy and Run the application

Monday, October 15, 2012

Great tips which can be applied by all at any workplace?


1. Listen more than you talk To be a good leader you have to be a great listener. Brilliant ideas can spring from the most unlikely places, so you should always keep your ears open. This can mean following online comments as closely as meeting notes, or asking the frontline staff for their opinions. Get out there, listen to people, draw people out and learn from them.

 2. Keep it simple There are thousands of simple business solutions to problems out there, just waiting to be solved by the next big thing in business. Maintain a focus upon innovation, but don’t try to reinvent the wheel. A simple change for the better is far more effective than five complicated changes for the worse.

 3. Take pride in your work With so many different departments, nationalities and personalities represented under one roof, it is always interesting to see what qualities we all have in common. One is pride in our work, and in the company we represent. Staff are the biggest brand advocates, and focusing on helping them take pride will shine through in how they treat their customers.

 4. Have fun, success will follow If you are having a good time, there is a far greater chance a positive, innovative atmosphere will be nurtured and your business will flourish. A smile and a joke can go a long way, so be quick to see the lighter side of life.

 5. Rip it up and start again Every successful person has experienced a few failures along the way – the important thing is how you learn from them. Don’t allow yourself to get disheartened by a setback or two, instead dust yourself off and work out what went wrong. Then you can find the positives, analyze where you can improve, rip it up and start again.

Tuesday, October 9, 2012

WebSphere Portal Interview Questions and answers for an Administrator

List of interview questions that i might ask someone for the job of WebSphere Portal Server Administrator.

  1. What is the difference between Application Server and Portal Server ?

    Application servers extend the ability of a Web server to handle Web application requests, and enables a server to generate a dynamic, customized response to a client request. A portal server extends the application server by providing a portlet container that can run portlets and to create portal a website that provides users with a single point of access to Web-based resources by aggregating those resources in one place.
  2. What are the steps involved in deploying themes and skins in a clustered production websphere portal environment ?

    Export the WebSphere wps.ear (Portal EAR) using wsadmin.
    Use EarExpander tool to expand the exported wps.ear file.
    Copy the updated themes and skins into ../themes/html, ../skins/html folder.
    Use EarExpander tool to collapse the EAR directory into an EAR file.
    Use wsadmin to update the wps.ear to complete the deployment of updated themes and skins.
  3. What changes needs to be done to view changes to your theme and skins JSPs without restarting the portal server ?

    You need to enable automatic JSP loading by setting reloadingEnable property to true in ibm-web-ext.xmi file of the wps.ear.
  4. What are the 3 different ways of installing a portlet application in WebSphere Portal ?

    Install a portlet using the portal administration page using Web Modules portlet.
    Install a portlet using xmlaccess tool.
    Pre-deploy a portlet as a standard EAR by installing the portlet WAR file in WAS console and then registering the portlet using xmlaccess.
  5. What is the purpose of XMLAccess configuration file Export.xml & ExportRelease.xml ? What is the difference ? & When will you use one over the other ?

    Export.xml exports the complete portal configuration and useful when transferring configurations between development installations.
    ExportRelease.xml exports the complete portal configuration from the release domain as required by the portal ReleaseBuilder tool and useful when tranaferring different release configurations between staging and production environments.
  6. List me the steps involved in building a release in WebSphere Portal ?

    If you have a completely new installation of the staging server and the production server:

    Install the staging server, then install the production server.
    Develop a release on the staging server.
    Build the release on the staging server.
    Empty portal contents on the production server by running the WPSconfig.sh|bat action-empty-portal task.
    Import that release onto the production server. Refer to Transferring a complete configuration for information.

    If you already have a production server without a staging system:

    Export the release of your production server.
    Install an empty staging server using one of the following two methods:
    Install the staging server with the flag -W emptyPortal.active=True.
    After installing and configuring the staging server, run the WPSconfig.sh|bat action-empty-portal task.
    Import the production release onto the staging server. Refer to Transferring a complete configuration for information.
    Develop and build a new release on the staging server.
    Export that new release from the staging server.
    Use ReleaseBuilder to generate the differential between the two releases.
    Import the differential onto the production server.
  7. What is the purpose of ReleaseBuilder tool in WebSphere Portal ?

    ReleaseBuilder enables management of release configurations independent of user configurations and used during staging of follow-on releases of WebSphere portals, configurations, and artifacts need to be moved between systems.
  8. What are the steps involved in editing WebSPhere Member Manager (wmm.xml) files on a federated node ?

    On the primary node of the WebSphere Portal cluster, check out the files using ./WPSconfig.sh check-out-wmm-cfg-files-from-dmgr task.
    Make any changes to the Member Manager files. The files can be edited in the portal_server_root/wmm directory on the WebSphere Portal node.
    When you have completed your changes, check the files back in using ./WPSconfig.sh check-in-wmm-cfg-files-to-dmgr.
  9. How to change the default portal URI /wps/portal after installation ?

    Set the property WpsContextRoot to the new URI and run ./WPSConfig.sh modify-servlet-path task.
  10. List different types of user registry supported by WebSphere Portal ?

    LDAP (includes LDAP with an optional database user registry).
    Database user registry.
    Custom User registry, (non-LDAP, non-database).
  11. What is LDAP realm support and why would I want to use it?

    A Realm allows you to group users from one or more LDAP trees of one user registry and expose them as a coherent user population to WebSphere Portal; this is also referred to as horizontal partitioning. Realms allow a flexible user management with various configuration options; for example, you can combine principals from one or more corporate LDAP tree. A realm must be mapped to a Virtual Portal to allow the realm's defined user population to login to the Virtual Portal.
  12. What is an Application group and why would I want to use it ?

    Application groups is a concept that allows you to define user groups within the database user registry with members (users or groups) contained in the LDAP user registry you configured. The benefit of application groups is that you can create Groups that are only used in WebSphere Portal particularly in scenarios where there is Read-only LDAP or special group setup specific to the portal.
  13. What are the two methods to install the empty staging WebSphere portal server ?

    Empty portal contents on the staging server by running the ./WPSconfig.sh action-empty-portal.
    Install portal with the ./install.sh -W emptyPortal.active="True" option.
  14. How do you stop portal traffic to the node being upgraded in 24x7 cluster upgrade process ?

    Locate the cluster member being upgraded, and change the value in the Configured weight column from a value to zero and make sure the plugin config information is propagated to webserver to stop traffic.
  15. How to set limits on searches for users and groups ?

    Setting a maximum number of search results maximumSearchResults="200"
    in wmm.xml
  16. What portal resources are scoped for virtual portal ?

    Portal pages.
    Portlet instances.
    Portal Search Engine search services and search collections. This includes the search content sources.
  17. What portal resources can't be seperated for virual portal ?

    Themes and skins.
    Vault segments and vault slots.
    Supported clients and markups.
    Composite applications and templates.
    Policies.
  18. How do you enable temporary and extended trace logging for WebSphere Portal ?

    Temporary traces can be set for a temporary period by using the administration portlet Enable Tracing or the IBM WebSphere Application Server administrative console and also using the Enable Tracing portlet in the portal administration page.

    To enable extended trace settings for a longer period of time, that is, for more than one session, switch them on in the WebSphere Application Server configuration, save the updates and restart the portal server.
  19. What are the different states of the syndication process ?

    Idle: No syndication is occurring.
    Pending: A request has been made to the syndicator, but it has yet to initiate a request to the syndication application.
    Queued: The syndicator has sent a request to the syndication application, but syndication is not yet active.
    Active: Syndication is occurring between the syndicator and subscriber.
    Disabled: Syndication is currently disabled.
  20. What are the two types of rendering portlets ?

    Local rendering portlet and Remote rendering portlet.

Friday, October 5, 2012

Why do we set -Xms and -Xmx to the same value?

There is an additional performance overhead when the memory grows from the initial -Xms to -Xmx when system requires additional memory due to reasons like load etc. Its recommended to have the -Xmx and -Xms of the same value so that during the JVM startup process itself the memory is allocated and overhead due to additional progressive growth is avoided. Now in this sense the question remains then why have an -Xms setting in the first place. There might be systems that rarely reach the -Xmx heap value and hence to optimize resource utilization the -Xms setting makes sense. 


 config can prevent overhead of memory manipulating and decrease frequency of garbage collection :)
 

Thursday, October 4, 2012

How to get application Hit count?




 Use below syntax
grep <searchstring> <application name> | wc –l