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"





Recent Comments