Monday, January 24, 2011

5 ways to speed up your PC

Hi All,

Following is the nice article i found on Microsoft site, which i wanted to share with you.

By following a few simple guidelines, you can maintain your computer and keep it running smoothly. This article discusses how to use the tools available in Windows 7, Vista, and XP Service Pack 3 (SP3) to more efficiently maintain your computer and safeguard your privacy when you're online.

1. Free up disk space

The Disk Cleanup tool helps you free up space on your hard disk to improve the performance of your computer. The tool identifies files that you can safely delete, and then enables you to choose whether you want to delete some or all of the identified files.

Use Disk Cleanup to:

  • Remove temporary Internet files.

  • Remove downloaded program files (such as Microsoft ActiveX controls and Java applets).

  • Empty the Recycle Bin.

  • Remove Windows temporary files such as error reports.

  • Remove optional Windows components that you don't use.

  • Remove installed programs that you no longer use.

  • Remove unused restore points and shadow copies from System Restore.

Tip: Typically, temporary Internet files take the most amount of space because the browser caches each page you visit for faster access later.

To use Disk Cleanup

Window 7 users

  1. Click Start, click All Programs, click Accessories, click System Tools, then click Disk Cleanup. If several drives are available, you might be prompted to specify which drive you want to clean.

  2. When Disk Cleanup has calculated how much space you can free, in the Disk Cleanup for dialog box, scroll through the content of the Files to delete list.

    Disk Cleanup dialog box

    Disk Cleanup dialog box

  3. Clear the check boxes for files that you don't want to delete, and then click OK.

    • For more options, such as cleaning up System Restore and Shadow copy files, under Description, click Clean up system files, then click the More Options tab.

  4. When prompted to confirm that you want to delete the specified files, click Yes.

After a few minutes, the process completes and the Disk Cleanup dialog box closes, leaving your computer cleaner and performing better.

For Windows XP users

  1. Click Start, point to All Programs, point to Accessories, point to System Tools, and then click Disk Cleanup. If several drives are available, you might be prompted to specify which drive you want to clean.

    Disk Cleanup dialog box

  2. In the Disk Cleanup for dialog box, scroll through the content of the Files to delete list.

    Choose the files that you want to delete.

    Choose the files that you want to delete.

  3. Clear the check boxes for files that you don't want to delete, and then click OK.

  4. When prompted to confirm that you want to delete the specified files, click Yes.

After a few minutes, the process completes and the Disk Cleanup dialog box closes, leaving your computer cleaner and performing better.


2. Speed up access to data

Disk fragmentation slows the overall performance of your system. When files are fragmented, the computer must search the hard disk when the file is opened to piece it back together. The response time can be significantly longer.

Disk Defragmenter is a Windows utility that consolidates fragmented files and folders on your computer's hard disk so that each occupies a single space on the disk. With your files stored neatly end-to-end, without fragmentation, reading and writing to the disk speeds up.

When to run Disk Defragmenter
In addition to running Disk Defragmenter at regular intervals—monthly is optimal—there are other times you should run it too, such as when:

  • You add a large number of files.

  • Your free disk space totals 15 percent or less.

  • You install new programs or a new version of Windows.

To use Disk Defragmenter:

Windows 7 users

  1. Click Start, click All Programs, click Accessories, click System Tools, and then click Disk Defragmenter.

    Click Analyze disk to start the Disk Defragmenter.

    Click Analyze disk to start the Disk Defragmenter.

  2. In the Disk Defragmenter dialog box, click the drives that you want to defragment, and then click the Analyze button. After the disk is analyzed, a dialog box appears, letting you know whether you should defragment the analyzed drives.

    Tip: You should analyze a volume before defragmenting it to get an estimate of how long the defragmentation process will take.

  3. To defragment the selected drive or drives, click the Defragment disk button. In the Current status area, under the Progress column, you can monitor the process as it happens. After the defragmentation is complete, Disk Defragmenter displays the results.

  4. To display detailed information about the defragmented disk or partition, click View Report.

  5. To close the View Report dialog box, click Close.

  6. You can also schedule the Disk Defragmenter to run automatically, and your computer might be set up this way by default. Under Schedule, it reads Scheduled defragmentation is turned on, then displays the time of day and frequency of defragmentation. If you want to turn off automatic defragmentation or change the time or frequency, click the Configure schedule (or Turn on Schedule, if it is not currently configured to run automatically). Then change the settings, then click OK.

  7. To close the Disk Defragmenter utility, click the Close button on the title bar of the window.

To use Disk Defragmenter:

  1. Click Start, point to All Programs, point to Accessories, point to System Tools, and then click Disk Defragmenter.

    Click Analyze disk to start the Disk Defragmenter

    Click Analyze disk to start the Disk Defragmenter.

  2. In the Disk Defragmenter dialog box, click the drives that you want to defragment, and then click the Analyze button. After the disk is analyzed, a dialog box appears, letting you know whether you should defragment the analyzed drives.

    Tip: You should analyze a volume before defragmenting it to get an estimate of how long the defragmentation process will take.

  3. To defragment the selected drive or drives, click the Defragment button. Note: In Windows Vista, there is no graphical user interface to demonstrate the progress—but your hard drive is still being defragmented.

    After the defragmentation is complete, Disk Defragmenter displays the results.

  4. To display detailed information about the defragmented disk or partition, click View Report.

  5. To close the View Report dialog box, click Close.

  6. To close the Disk Defragmenter utility, click the Close button on the title bar of the window.


3. Detect and repair disk errors

In addition to running Disk Cleanup and Disk Defragmenter to optimize the performance of your computer, you can check the integrity of the files stored on your hard disk by running the Error Checking utility.

As you use your hard drive, it can develop bad sectors. Bad sectors slow down hard disk performance and sometimes make data writing (such as file saving) difficult, or even impossible. The Error Checking utility scans the hard drive for bad sectors, and scans for file system errors to see whether certain files or folders are misplaced.

If you use your computer daily, you should run this utility once a week to help prevent data loss.

Run the Error Checking utility:
  1. Close all open files.

  2. Click Start, and then click My Computer.

  3. In the My Computer window, right-click the hard disk you want to search for bad sectors, and then click Properties.

  4. In the Properties dialog box, click the Tools tab.

  5. Click the Check Now button.

  6. In the Check Disk dialog box (called Error-checking in Windows 7), select the Scan for and attempt recovery of bad sectors check box, and then click Start.

    Check Disk Local Disk dialog box, with the Scan <br /><br />for and attempt recovery of bad sectors check box selected.

    Example of Check Disk Local Disk dialog box

  7. If bad sectors are found, choose to fix them.

Tip: Only select the "Automatically fix file system errors" check box if you think that your disk contains bad sectors.


4. Protect your computer against spyware

Spyware collects personal information without letting you know and without asking for permission. From the websites you visit to usernames and passwords, spyware can put you and your confidential information at risk. In addition to privacy concerns, spyware can hamper your computer's performance. To combat spyware, you might want to consider using the PC safety scan from Windows Live OneCare. This scan is a free service and will help check for and remove viruses.

Download Microsoft Security Essentials for free to guard your system in the future from viruses, spyware, and other malicious software.


5. Learn all about ReadyBoost

If you're using Windows 7 or Windows Vista, you can use ReadyBoost to speed up your system. A new concept in adding memory to a system, it allows you to use non-volatile flash memory—like a USB flash drive or a memory card—to improve performance without having to add additional memory

Thanks & Regards

Raju Jetla

Friday, January 14, 2011

Best Practices to use Pen Drives & Memory Cards

We mostly face virus problem while using pen drives & memory cards. As they are spread the virus most we avoid using it many times.
Here is the few best practices to protect your system free from virus & protect data corruption due to virus

  1. Disable AutoPlay
    When we plug-in any removable drive like pen drive it autoplay's due to which virus program in it gets executed damaging the system. So best thing is to disable autoplay. For this Click Start Click Run Enter GPEDIT.MSC
    On left panel Double-click Computer Configuration Double-click Administrative Templates Double-click System Double-click Turn autoplay off
    (The default is the Not configured).
    Set it to Enabled and choose 'All drives' as opposed to just CD drives.
  2. Don't Create Folder in Pen or removable drives
    Second thing is not to create folder in pen drives or memory cards as virus mostly gets hidden inside it and it multiplies as many as folders are there normally your folder appears with exe extension and data gets corrupted with viral instructions in it making it to spread. So loose your important data.
  3. Zip your folder before copying
    Instead of copying the folder using winrar zip your folder (in rar format, if winrar is installed on the system right click the folder [your folder name].rar appears in the menu select it) then you copy it to pend drive.
    Making zip has three advantages i.e.
    1. Folder size gets reduced and so takes less space on pen drive
    2. Copying data to pen drive becomes 10 times faster
    3. Data will not be corrupted in 90% cases even virus is in pen drive
  4. Scan Pen drives before use
    Before you use your pen drive do not forget to scan it, but remember if virus found your data may be lost
  5. Don't double click on pen or removable drive
    Do not double click open pen or removable drives as it executes the virus program if it has, so avoid it instead right click select explore or select pen or removable drive from address bar in my computer.

Hope you find this useful

Thanks & Regards
Raju Jetla

RJ Smart SQL


Very useful application developed by me for developers who needs to access their SQL Server on windows phone when they are on move. It is a small MS SQL Management studio. The connection can be made with MS SQL Server using LAN, WiFi or GPRS
Features:
  • -View databases lists
  • -View tables, view, procedures lists in the database
  • -Write & Execute SQL Queries
  • -Quick view top N Rows
  • -Quick use of Insert, update, delete queries templates
  
Hope you will find it useful.
For any further assistance please post your queries on http://rjetla.blogspot.com
Thanks & Regards Raju Jetla
download RJ Smart SQL

Monday, July 5, 2010

What is Cloud Computing?

clip_image001

Cloud computing is a technology that uses the internet and central remote servers to maintain data and applications. Cloud computing allows consumers and businesses to use applications without installation and access their personal files at any computer with internet access. This technology allows for much more efficient computing by centralizing storage, memory, processing and bandwidth.

A simple example of cloud computing is Yahoo email or Gmail etc. You don’t need software or a server to use them. All a consumer would need is just an internet connection and you can start sending emails. The server and email management software is all on the cloud (internet) and is totally managed by the cloud service provider Yahoo, Google etc.

The analogy is ‘If you only need milk, would you buy a cow?' All the users or consumers need is to get the benefits of using the software or hardware of the computer like sending emails etc. Just to get this benefit (milk) why should a consumer buy a (cow) software /hardware?

A cloud service has three distinct characteristics that differentiate it from traditional hosting. It is sold on demand, typically by the minute or the hour; it is elastic -- a user can have as much or as little of a service as they want at any given time; and the service is fully managed by the provider (the consumer needs nothing but a personal computer and Internet access). Significant innovations in virtualization and distributed computing, as well as improved access to high-speed Internet and a weak economy, have accelerated interest in cloud computing.

These services are broadly divided into three categories:

1. Infrastructure-as-a-Service (IaaS)

2. Platform-as-a-Service (PaaS)

3. Software-as-a-Service(SaaS)

clip_image003

1-Infrastructure-as-a-Service

Infrastructure-as-a-Service like Amazon Web Services provides virtual server instances with unique IP addresses and blocks of storage on demand. Customers use the provider's application program interface (API) to start, stop, access and configure their virtual servers and storage. In the enterprise, cloud computing allows a company to pay for only as much capacity as is needed, and bring more online as soon as required. Because this pay-for-what-you-use model resembles the way electricity, fuel and water are consumed; it's sometimes referred to as utility computing.

2- Platform-as-a-Service

Platform-as-a-service in the cloud is defined as a set of software and product development tools hosted on the provider's infrastructure. Developers create applications on the provider's platform over the Internet. PaaS providers may use APIs, website portals or gateway software installed on the customer's computer. Force.com, (an outgrowth of Salesforce.com) and GoogleApps are examples of PaaS. Developers need to know that currently, there are not standards for interoperability or data portability in the cloud. Some providers will not allow software created by their customers to be moved off the provider's platform.

3- Software-as-a-Service

In the software-as-a-service cloud model, the vendor supplies the hardware infrastructure, the software product and interacts with the user through a front-end portal. SaaS is a very broad market. Services can be anything from Web-based email to inventory control and database processing. Because the service provider hosts both the application and the data, the end user is free to use the service from anywhere.

For more info & to ask any queries plz use the post query option on the top

 

Thanks & Regards

|¯¯|)¯¯)
|__|\__\aju
___|¯¯|
(¯¯(|   |etla
¯¯¯¯¯

Wednesday, April 28, 2010

How N-Tier Architecture Application are made, using Stored Procedure in Database Layer

Hi All,
In this article i will be explaining how n-tier Architecture Applications are made. There are 3 Layers  typical in any application. They are
  1. Presentation Layer: Presentation layer is basically the front end forms which is used by the end users
  2. Business Logic Layer: This layer consists of business logic like transactional operations
  3. Database Layer :
    Consists of data and data related programming like triggers, stored procedures & functions for complex sql transactions

Making these three layers independent makes you the deal with these layers independently like any changes required in stored procedure logic can be done without disturbing other layers. Further application can be developed for other platform like from web to mobile application, without disturbing database layer and business logic layers
AppLayers

To demonstrate i will be making small application using ASP.NET with C# & SQL server where add the State names in the database using a web form. I have made a database with name myDB in SQL server with a table “States” shown below.

image

I have made a sql stored procedure for inserting the record in the database to make database layer bulky.
CREATE PROCEDURE DBO.USP_INSERT_INTO_States
(
@STATEID CHAR(5)
,@STATE VARCHAR(25)
)
AS BEGIN
INSERT INTO States(
[STATEID]
,[STATE]
)
VALUES
(
@STATEID
,@STATE
)
END

Now we will create a business layer, here business will be adding new state, this transaction in the database will be done using the stored procedure, so in next step we will be making class called StateBL for handling the State (table) related transaction and we will add business method AddNewState() for adding new state. This business layers normally made as a web service, in java EJB, .NET remoting in .NET for global access.  For now we will be making ASP.NET website and we will add business class to this website i.e. from website menu-> Add new item. This class will be our Business layer in our application, coding is given below

public class StateBL
{
    //declare the objects for database operation
    SqlCommand cmd;
    SqlConnection con;

   //represents the exception occurred during the sql transaction
    public Exception exception=null;
  
    // Initialize the connnection and command object in constructor
    public StateBL()
    {
       con=new SqlConnection("Data Source=RAJU-PC\\SQLEXPRESS;Initial Catalog=myDB;Integrated Security=True;");    
       cmd=new SqlCommand();
       cmd.CommandType=CommandType.StoredProcedure;
    }

    // Used for adding State
    public Boolean AddNewState(string StateID, String State)
    {
        try
        {
            cmd.CommandText="DBO.USP_INSERT_INTO_STATES";
            cmd.Parameters.AddWithValue("@STATEID",StateID);
            cmd.Parameters.AddWithValue("@STATEID",State);
            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
            return true; //represents successful transaction
        }
        catch(Exception ex)
        {
            exception=ex;
            return false; //represents sql operation failed
        }
    }
}

Now we will create a web form i.e. our presentation layer to add record into the table through business layer

image

Coding for save button click is given below

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
    protected void btnSave_Click(object sender, EventArgs e)
    {
        StateBL objState = new StateBL();
        if (objState.AddNewState(txtStateID.Text, txtStateName.Text)) //check the return value of the AddNewState
        {
            //display the message on success
            lbMsg.Text = "State added successfully...";
        }
        else
        {
            //display the error message from exception object in the StateBL class
            lbMsg.Text = "Unable to add state, error:" + objState.exception.Message;
        }
    }
}

Here is the output of the program, first output is showing the error message due to connection string problem and second shows the successful addition of the record in the table.
image

image

Conclusion:
We have made three layers of the application
Database Layer: with data tables, stored procedure
Business Layers: having business class with business method for adding new state
Presentation Layer: we have a form for data entry

If i make business layer as web service and consider in future i need to develop the same application for mobile platform then what i need to develop, only the presentation for mobile platform. isn’t it?
AppLayers3

I hope you find this article helpful, if you liked it please do not forget to add your feedback below

download source code of above example

Thanks & Regards
l¯¯l)¯¯)
l__l\__\aju
.      l¯¯l
(¯¯(/_  /etla

Tuesday, March 23, 2010

Add Search Engine to your website

Hi All,

Now It very easy to add search engine to your website and custom search engine with specific sites for searching. To do this just goto http://www.google.com/cse/ and log in into your gmail account



Click on create custom search engine
Now enter the title & description for your search engine and specify the site you want to search. if you are adding it to your website specify your site name



select i have read & agree terms & conditions, then click on next



Then try search engine with some keywords. Click finish to create search engine that's it, now you can see your search engine in the list



Next we will see how to add this custom search to our website and customize look and feel to match our website design



Click on get code


just copy the code and paste in your webpage and test your page





Now here is my webpage with a search engine on it




For customizing the look & feel to match website design in the control panel click on look & feel and select design from choice or click customize


change the fonts, colors as per the your requirements



save and click on getcode and paste it in your webpage. You can also download CSS file and customize it as per your wish. Hope you find this useful

For more information or query you can visit my blog or join my groups and send your queries & feedback at
http://rjetla.blogspot.com/
http://groups.google.com/group/rjetla

Thanks & Regards

Raju Jetla


Wednesday, February 3, 2010

SilverLight - Making Hello World Program

Dear All,

Following Topic is about how to make Hello World Program with SilverLight, i have taken reference from Tim Heuer blog

Before you start make sure you have installed Visual Studio SP1, Silverlight Runtime, SilverLight SDK and SilverLight Tools, if not get it downloaded from microsoft.com

Understanding the development environment

Once you install Visual Studio and the Silverlight Tools you will notice a new grouping in the VS New Project dialog box:
New Project Dialog Box
You will see some new templates under the category Silverlight which include at least Silverlight Application, Silverlight Class Library and Silverlight Navigation Application.  Some others you may see depending on additional tools you may have installed.
For this step, choose the Silverlight Navigation Application template and give it a name for the application (I’m calling mine TwitterSearchMonitor).
The next window you will see will ask you if you would like to create a web project:
New Silverlight Application Dialog Box
If this is a new project, I highly recommend choosing to create a web project for you.  By doing this you will have a web context to run the application for you.  This is helpful in avoiding issues around accessing web services from the local file system.  Running your application under HTTP from the start will help you avoid some of the most common mistakes in debugging web service access.  You can choose the ASP.NET Web Application Project, ASP.NET Web Site or ASP.NET MVC Project if you have that installed.  If you aren’t sure, just use the defaults.

The Project Structure

Once your app is created you will see something similar like this:
Silverlight project structure
This shows your web application (which will host the Silverlight application) with pre-created test pages for the Silverlight application and the Silverlight application itself.  Let’s focus first on the Silverlight application project.
There are some key files you should be aware of here that we’ll explore in this series:
  • App.xaml – this is an application-wide resource file.  If you put resources in here (we’ll explore in styling) or global events upon startup, they will happen here.  This file is also the entry point to your application and tells the Silverlight plugin what to do next.
  • MainPage.xaml – this is a page that is a part of the template you chose.  It doesn’t have to be called MainPage, but that is what the project template uses by default.  This represents the starting user interface for your application.  Don’t be confused by details just yet.
  • Assets/Views folders – these contain assets (files, images, styles, etc.) and other UI views for your application.
The XAML files are the files that make up the UI of your application.  They are just XML files with the XAML markup language.  We will be altering these in later steps.
When you build the solution (go ahead and do that) you’ll notice in the web application’s ClientBin folder a new file with a XAP extension will show up.  This is your compiled Silverlight application.  It’s actually an archive (aka ZIP) file with a different extension file name.  If you rename it to .ZIP and open it using an archive tool you can see the contents.
The XAP file is what is served to your browser.  This is the file that is hosted on the web server and gets delivered to the end user.  The XAP is hosted within a standard HTML page that hosts the Silverlight application using the tag instantiation. 
NOTE: Silverlight is a client technology and can be hosted on any web server.  It can be any type of web server that is capable of delivering the XAP file along with the correct content MIME type from the server (application/x-silverlight-app).  As long as it does that, we don’t care what type of web server it is delivering the XAP file.
Test pages for ASP.NET and HTML are created for you with the standard template.  Since both of them are the same essentially, I usually delete one of them for simplicity.

Adding UI to the XAML pages



The template we chose is a navigation application template, meaning it has some navigation features built into it.  This is a fairly new feature to Silverlight and enables you to have a “master page” kind of view in your application.  If you look in the Views folder you will see About.xaml, ErrorWindow.xaml and Home.xaml.  For now let’s focus on Home.xaml since that is the first view that is loaded.  Open that file up by double-clicking it and you’ll see the XAML load in Visual Studio.
In this page you’ll see some XAML code that defines the view in a Grid that uses some other layout controls like a StackPanel and TextBlocks (we’ll go into StackPanel in the next step 2).  These are all part of the core control set that Silverlight provides.  A TextBlock enables you to present text to the user.  If you run the application now (hit F5 to run in debug mode – go ahead and choose to modify the web.config to enable debugging) you should see something like this:
Running Silverlight application
Notice the text in the running application matches the text in the TextBlock of the XAML.  Also notice the link style buttons in the upper right.  These represent our navigation points which go to our separate views.  Let’s add some more XAML and see how to write code.
In the Home.xaml view, after the second TextBlock, add a Button using this XAML:
   1: <Button Content="Click me" x:Name="MyButton" FontSize="18" Width="150" Height="45" />
This will display a button on the view just underneath the “Home page content” text area.  Notice the x:Name attribute?  This is the unique identifier for this element and helps us reference it in code.  Think of this as the ID attribute of the control.  Now let’s make it do something when clicked.  There are two ways we can add events to the Button (or other elements) with simplicity.  In the XAML for Button itself we can add a Click attribute and you will see VS Intellisense automatically ask us if we want to generate a new event handler:

We can also wire up the event handler in code directly and keep it out of our XAML using this code in the Home.xaml.cs page:
   1: public Home()
   2: {
   3:     InitializeComponent();
   4:     MyButton.Click += new RoutedEventHandler(MyButton_Click);
   5: }
Either way will work.  For simplicity for now you can use whatever you like…I will use the XAML method for now.  Now in the function MyButton_Click we can write managed code in the function to manipulate our user interface or other functions.  Let’s finish our Hello World sample by changing the HeaderText TextBlock (HeaderText is the x:Name value so we can reference it easily in code) to “Hello World” output.  To do that we’ll write this function code:
   1: void MyButton_Click(object sender, RoutedEventArgs e)
   2: {
   3:     HeaderText.Text = "Hello World!";
   4: }
After making these changes and running the application again (F5) we will see our button and when clicked it will change the text like below:
finished product animation

Thanks & Regards

l¯¯l)¯¯)
l__l\__\aju
.      l¯¯l
(¯¯(/_ /etla

Thursday, December 10, 2009

Introduction to JSTL

1. What is JSTL?

JSTL stands for JSP
Standard Tag Library. JSTL has been standardized and is being one of the most
important technologies in implementing J2EE Web Application. The main objective
of the JSTL is basically to simplify the Java codes within JSP (scriptlets) as
well as to increase the level of reusability within our J2EE web application. Before
JSTL is introduced, J2EE Web Applications (especially in the presentation layer
– JSP) are extremely complex and are very tough to be maintained. It is true
that the new developer may take some time to understand all the underlying
codes within J2EE Web Application This is where JSTL should help.


Here is a simple JSTL flow concept; JSTL is
compiled into a servlets (Java codes) before being displayed to JSP. Some
classes of standard.jar are required to parse and translate these JSTL tags
into servlets (Java codes). Lastly but not least, the servlet that has been
compiled will be executed accordingly.


There are many more advantages
of using JSTL compared to scriptlets. Therefore, it is recommended to replace
scriptlets with JSTL in the presentation layer (JSP).


There
are 5 major types of JSTL tags:

  1. JSTL Core tags,
    prefixed with c
  2. JSTL Format tags,
    prefixed with fmt
  3. JSTL Function
    tags, prefixed with fn
  4. JSTL Database
    tags, prefixed with sql
  5. JSTL XML tags,
    prefixed with x


JSTL Core Tags
<%@ taglib
uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

Mainly used for replacement of scriptlet logical
tags as well as basic URL handling tag such as catch, choose, if, forEach,
param, when, redirect, import, url, etc.



JSTL Format Tags
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"
prefix="fmt" %>

Mainly used for displaying number and date time format. This could be
used for internationalization support as well. Tags examples are setLocale,
setTimeZone, setBundle, formatNumber, formatDate, etc.



JSTL Function Tags
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"
prefix="fn" %>

Very useful JSTL tags. Most are used in
conjunction with JSTL core tags. These tags are designed for manipulating
string.



JSTL Database Tags
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql"
prefix="sql" %>

Tags are used to interact with database level. With database tags you
could do transaction, update and query the database from your UI level.
Personally, I do not prefer these tags. The MVC design pattern should always be
retained.



JSTL XML tags
<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"
%>

Similar to core tags, except xml tags will
deal with xml stuffs like parsing xml documents, validating xml documents, output
an xpath and etc.


For depth details to all JSTL tags, you can
find more information within
your NetBean’s installation folder i.e. installation_netbeans_folder\enterprise1\docs\

Additionally, JSTL accepts the conditional operators
like ‘eq’, ‘ne’, ’==’, ’null’, ’empty’, ’not’, ’!=’, ’>=’, ’<=’, ’and’, ’&&’,
’or’, ’||’ all are valid.


Here is the mapping of relational and
logical operators with JSP Notations.


Operators

JSP
Notation


>

gt

<

Lt

>=

ge

<=

le

==

eq

!=

ne

&&

and

||

or

!

not

‘’

empty

/

div

%

mod
While other arithmetic operators such as +,
-, and * can also be used together with the JSTL tag as well.



Join my groups to share knowledge at
http://groups.google.com/group/rjetla?hl=en
http://rjetla.blogspot.com/

Thanks & Regards

l¯¯l¯)
l__l\__\aju
.     l¯¯l
(¯¯(/__/etla

"falling down is not a crime, staying down is a crime"





Monday, December 7, 2009

Beans and Form processing


Forms are a very common method of interactions in web sites.  JSP makes forms processing specially easy.
The standard way of handling forms in JSP is to define a "bean". This is not a full Java bean.  You just need to define a class that has a field corresponding to each field in the form.  The class fields must have "setters" that match the names of the form fields.  For instance, let us modify our GetName.html to also collect email
address and age.

The new version of GetName.html is

<HTML>
<BODY>
<FORM METHOD=POST ACTION="SaveName.jsp">
What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
<P><INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>

To collect this data, we define a Java class with fields "username", "email" and "age" and we provide setter methods "setUsername", "setEmail" and "setAge", as shown.  A "setter" method is just a method that starts with "set" followed by the name of the field.  The first character of the field name is upper-cased.
So if the field is "email", its "setter" method will be "setEmail".  Getter methods are defined similarly, with "get" instead of "set".   Note that the setters  (and getters) must be public.

package user;
public class UserData {

    String username;
    String email;
    int age;
 
    public void setUsername( String value )
    {
        username = value;
    }
 
    public void setEmail( String value )
    {
        email = value;
    }
 
    public void setAge( int value )
    {
        age = value;
    }
 
    public String getUsername() { return username; }
 
    public String getEmail() { return email; }
 
    public int getAge() { return age; }

}

The method names must be exactly as shown.  Once you have defined the class, compile it and make sure it is available in the web-server's classpath.  The server may also define special folders where you can
place bean classes, e.g. with Blazix you can place them in the "classes" folder.  If you have to change the classpath, the web-server would need to be stopped and restarted if it is already running.  Note that we are using the package name user, therefore the file UserData.class must be placed in a folder named
user under the classpath entry. Now let us change "SaveName.jsp" to use a bean to collect the
data.

<jsp:useBean id="user" class="user.UserData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<HTML>
<BODY>
<A HREF="NextPage.jsp">Continue</A>
</BODY>
</HTML>

All we need to do now is to add the jsp:useBean tag and the jsp:setProperty tag!  The useBean tag will look for an instance of the "user.UserData" in the session.  If the instance is already there, it will update the old instance.  Otherwise, it will create a new instance of user.UserData (the instance of the user.UserData is called a bean), and put it in the session. The setProperty tag will automatically collect the input data, match names against the bean method names, and place the data in the bean!

Let us modify NextPage.jsp to retrieve the data from bean..
<jsp:useBean id="user" class="user.UserData" scope="session"/> 
<HTML>
<BODY>
You entered<BR>
Name: <%= user.getUsername() %><BR>
Email: <%= user.getEmail() %><BR>
Age: <%= user.getAge() %><BR>
</BODY>
</HTML>

Notice that the same useBean tag is repeated.  The bean is available as the variable named "user" of class "user.UserData". The data entered by the user is all collected in the bean. We do not actually need the "SaveName.jsp", the target of GetName.html could have been NextPage.jsp, and the data would still be available the same way as long as we added a jsp:setProperty tag. But in the next tutorial, we will actually use SaveName.jsp as an error handler that automatically forwards the request to NextPage.jsp,
or asks the user to correct the erroneous data.

Exercise:  1)  Write a JSP/HTML set that allows a user to enter the name of a system property, and then displays the value returned by System.getProperty for that property name (handle errors appripriately.)
2)  Go back to the exercises where you manually modified boolean variables. Instead of a boolean variable, make these come from a HIDDEN form field that can be set to true or false.

Join my groups to share knowledge at
http://groups.google.com/group/rjetla?hl=en
http://rjetla.blogspot.com


Thanks & Regards


l¯¯l)¯¯)
l__l\__\aju
       l¯¯l
(¯¯(/__/etla

Tuesday, November 17, 2009

Configuring outlook for accessing Gmail

To configure Outlook 2007 for your Gmail address:

  1. Enable POP in your email account. Don't forget to click Save Changes when you're done.
  2. Open Outlook.
  3. Click the Tools menu, and select Account Settings...
  4. On the E-mail tab, click New...
  5. If you are prompted to Choose E-mail Service, select Microsoft Exchange, POP3, IMAP, or HTTP, and click Next.
  6. Fill in all necessary fields to include the following information:

    Your Name: Enter your name as you would like it to appear in the From: field of outgoing messages.
    Email Address: Enter your full Gmail email address (username@gmail.com). Google Apps users, enter your full address in the format username@your_domain.com.
    Password: Enter your email password.

    Manually configure server settings or additional server types: Leave this option unchecked if you want to automatically configure Outlook 2007. If you want to manually configure Outlook 2007, check this box now. Google Apps users should configure manually as follows.


  7. Click Next. If you are configuring Outlook 2007 automatically, you're done! Just click Finish.


  8. If you are configuring Outlook 2007 manually, select Internet E-mail and click Next.
  9. Verify your User Information, and enter the following additional information:

    Server Information

    Account Type: POP3

    Incoming mail server:
    pop.gmail.com (Google Apps users, enter the server names provided, don't add your domain name in these steps)

    Outgoing mail server (SMTP):
    smtp.gmail.com

    Logon Information

    User Name: Enter your Gmail username (including @gmail.com). Google Apps users, enter your full address in the format username@your_domain.com

    Password: Enter your email password.

    Require logon using Secure Password Authentication (SPA): Leave this option unchecked.


  10. Click the More Settings... button, and select the Outgoing Server tab.
  11. Check the box next to My outgoing server (SMTP) requires authentication and select Use same settings as my incoming mail server.


  12. Click the Advanced tab, and check the box next to This server requires an encrypted connection (SSL) under Incoming Server (POP3).
  13. In the Outgoing server (SMTP) box, enter 587, and select TLS from the drop-down menu next to Use the following type of encrypted connection:.


  14. Click OK.
  15. Click Test Account Settings... After receiving 'Congratulations! All tests completed successfully', click Close.
  16. Click Next, and then click Finish.

Congratulations! You're done configuring your client to send and retrieve Gmail messages.

Friday, November 13, 2009

Use Gmail IMAP in Microsoft Outlook 2007

We’ve all been hearing about the new IMAP support in Gmail, but how do we access that from Outlook? Those of you that have been waiting patiently will be happy to know all the instructions are on this page.
Using IMAP we can synchronize email across multiple devices, since the mail stays on the server. You already stopped reading this part and skipped down to the instructions, didn’t you?
Enable IMAP in Gmail Settings
Open your Settings panel in Gmail, and then click on the “Forwarding and POP/IMAP” tab.
image
Now click the Enable IMAP radio button, and click Save Changes.
image
Add Account to Outlook
Use the Tools menu you to open the Account Settings panel.
image
If this is your first account you’ll be prompted for the wizard, otherwise you’ll need to click the New button under the E-mail tab.
image
Now select the “Microsoft Exchange, POP3, IMAP or HTTP” option and hit next.
image
Select the checkbox for “Manually configure server settings” and everything on that page will gray out. Hit the next button again.
image
Now select “Internet E-mail”  (Didn’t we just do this? This wizard is taking too long…)
image
Finally we can enter some settings! Add in all your personal information here.
image
Note: If you are outside of the US you may need to use imap.googlemail.com and smtp.googlemail.com instead of imap.gmail.com and smtp.gmail.com.
Note: for Gmail Apps accounts, you’ll need to put in your full email address wherever you see an @gmail.com above. For instance, if your account was geek@howtogeek.com you would put that in the E-mail address field as well as the User Name field.
Click on the “More Settings” button and find the Outgoing Server tab, where you’ll need to check the box for “My outgoing server requires authentication”
image
Now choose the Advanced tab, and enter the following values (Very important)

  • Incoming Server: 993
  • Incoming Server encrypted connection: SSL
  • Outgoing Server: 587
  • Outgoing Server encrypted connection: TLS
image
Note: If you are having an issue with your sent email not showing up in Gmail, you can use the Folders tab, and then select the [Gmail] \ Sent Mail folder.
Note: Only do this step if your mail is not showing up, otherwise it will duplicate the sent mail.
image
Now that you’ve closed out that dialog, you can click the Test Account Settings button to make sure everything is going to work.
image
If all goes well, you should see a success message.
image
Note: Some ISPs restrict outgoing mail, so if you have a problem sending a test message you’ll need to consult with their documentation.
Accessing Your Mail
Now that everything is working you’ll notice a new set of folders for your Gmail account. (I’m using Gmail apps, which is why you don’t see an @gmail.com email address)
All of your labels will show up as separate folders, and the built-in “folders” in Gmail will be under the new [Gmail] folder.
 image
Outlook Flags = Gmail Stars
If you want to star a message in Gmail, you just need to flag it in Outlook. When I flagged this message from Mysticgeek…
image 
It shows up in Gmail as a starred message. (And it works the other way too)
image
Sending Email from Outlook
To send a new email from your Gmail account, just change the “Account” drop-down to your Gmail address before you send a message.
image
Note that if you only use Gmail, you won’t have this drop-down and it will default to your Gmail.
Final Thoughts
Here’s a few things to keep in mind:

  • Gmail Labels = Outlook Folders. To label a message, add it to a folder.
  • Gmail Stars = Outlook Flags.
  • Do Not move spam messages to the “Junk E-mail” folder in Outlook, move them to the [Gmail] \ Spam folder.
  • Outlook has a built-in Search Folder for “Large Mail”, which will let you easily find messages with large attachments.
Now that you can access your starred and labeled messages, you can start using Outlook’s excellent Search Folders to find messages more easily.



Raju Jetla

Recent Comments