Friday, April 24, 2015

Mongo DB as a Windows Service

1.install the mongo db software
2.create data folder under C:\Program Files\MongoDB
3. create db folder under C:\Program Files\MongoDB\data
4. create log folder under C:\Program Files\MongoDB\data
5.create conf folder under C:\Program Files\MongoDB\data

finally execute the below commend on cmd

cd C:\Program Files\MongoDB\bin

press enter then copy and paste those commends one by one

mongod.exe --dbpath "C:\Program Files\MongoDB\data\db" --port 27017

mongod.exe --dbpath "C:\Program Files\MongoDB\data\db" --logpath "C:\Program Files\MongoDB\data\log\mongod.log"

and inside the mongodb.conf file we need configure the db

dbpath = C:\Program Files\MongoDB\data\db
port = 27017
logpath = C:\Program Files\MongoDB\data\log\mongod.log

mongod -f "C:\Program Files\MongoDB\data\conf\mongodb.conf" --install --serviceName mongodb26 --serviceDisplayName "MongoDB Server Instance mongodb26" --serviceDescription "MongoDB Server Instance running on mongodb26"

Wednesday, April 15, 2015

Alert for Success of process using Struts

in Action File We need to set
if(flag==true)
            {
                req.setAttribute("msg",str);
                if(type.equals("APP"))
                    req.setAttribute("url","####.do");
                else
                    req.setAttribute("url","####.do?code="+code);                  forward=mapping.findForward("success");
            }
in Struts Config
<action path="/###" type="ActionName" parameter="Method" scope="request">
            <forward name="success" path="/Success.jsp" />
            <forward name="error" path="/Error.jsp" />
        </action>

<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<html>
  <head>
  <link rel="stylesheet" type="text/css" href="../css/<%=session.getAttribute("pageCss")%>">
  </head>
  <body class="bg">
<%String fwd=(String)request.getAttribute("fwdlink");
//System.out.println("fwd link is"+fwd);

%>

<%
if(fwd==null)
{
fwd=(String)request.getAttribute("url");
}
%>

    <script>
    var msg="<%=request.getAttribute("msg")%>";
    alert(msg);
    location.replace("<%=fwd%>");
    </script>
  </body>
 
</html>

Saturday, February 2, 2013

How to position a background image


<!DOCTYPE html>
<html>
<head>

<style>
body
{
background-image:url('img_tree.png');
background-repeat:no-repeat;
background-position:right top;
margin-right:200px;
}
</style>

</head>

<body>
<h1>Hello World!</h1>
<p>W3Schools background no-repeat, set position example.</p>
<p>Now the background image is only shown once, and positioned away from the text.</p>
<p>In this example we have also added a margin on the right side, so the background image will never disturb the text.</p>
</body>

</html>

How to repeat a background image only horizontally


<!DOCTYPE html>
<html>
<head>
<style>
body
{
background-image:url('gradient2.png');
background-repeat:repeat-x;
}
</style>
</head>

<body>
<h1>Hello World!</h1>
</body>

</html>

Bad background image

<!DOCTYPE html>
<html>
<head>
<style>
body {background-image:url('bgdesert.jpg');}
</style>
</head>

<body>
<h1>Hello World!</h1>
<p>This text is not easy to read on this background image.</p>
</body>

</html>


Set an image as the background of a page


<!DOCTYPE html>
<html>
<head>
<style>
body {background-image:url('paper.gif');}
</style>
</head>

<body>
<h1>Hello World!</h1>
</body>

</html>

et the background color of different elements


<!DOCTYPE html>
<html>
<head>
<style>
h1
{
background-color:#6495ed;
}
p
{
background-color:#e0ffff;
}
div
{
background-color:#b0c4de;
}
</style>
</head>

<body>

<h1>CSS background-color example!</h1>
<div>
This is a text inside a div element.
<p>This paragraph has its own background color.</p>
We are still in the div element.
</div>

</body>
</html>

Set the background color of a page


<!DOCTYPE html>
<html>
<head>
<style>
body
{
background-color:#b0c4de;
}
</style>
</head>

<body>

<h1>My CSS web page!</h1>
<p>Hello world! This is a W3Schools.com example.</p>

</body>
</html>

Wednesday, January 9, 2013

CSS Borders

Borders can be applied to most HTML elements within the body.
Changes are afoot… 
Follow HTML Dog on Twitter 
To make a border around an element, all you need is border-style. The values can be solid, dotted, dashed, double, groove, ridge, inset and outset.
border-width sets the width of the border, which is usually in pixels. There are also properties for border-top-width, border-right-width, border-bottom-width and border-left-width.
Finally, border-color sets the colour.
Add the following code to the CSS file:

h2 {
 border-style: dashed;
 border-width: 3px;
 border-left-width: 10px;
 border-right-width: 10px;
 border-color: red;
}
This will make a red dashed border around all HTML secondary headers (the h2 element) that is 3 pixels wide on the top and bottom and 10 pixels wide on the left and right (these having over-ridden the 3 pixel wide width of the entire border).

Margins and Padding

margin and padding are the two most commonly used properties for spacing-out elements. A margin is the space outside of the element, whereas padding is the space inside the element.
Changes are afoot… 
Follow HTML Dog on Twitter 
Change the CSS code for h2 to the following:

h2 {
 font-size: 1.5em;
 background-color: #ccc;
 margin: 1em;
 padding: 3em;
}
You will see that this leaves one-character width space around the secondary header and the header itself is fat from the three-character width padding.
The four sides of an element can also be set individually. margin-top, margin-right, margin-bottom, margin-left, padding-top, padding-right, padding-bottom and padding-left are the self-explanatory properties you can use.

The Box Model

Margins, padding and borders (see next page) are all part of what's known as the Box Model. The Box Model works like this: in the middle you have the content area (let's say an image), surrounding that you have the padding, surrounding that you have the border and surrounding that you have the margin. It can be visually represented like this:
Margin box
Border box
Padding box
Element box
You don't have to use all of these, but it can be helpful to remember that the box model can be applied to every element on the page, and that's a powerful thing!

Text

font-family

This is the font itself, such as Times New Roman, Arial, or Verdana.
The font you specify must be on the user's computer, so there is little point in using obscure fonts. There are a select few 'safe' fonts (the most commonly used are arial, verdana and times new roman), but you can specify more than one font, separated by commas. The purpose of this is that if the user does not have the first font you specify, the browser will go through the list until it finds one it does have. This is useful because different computers sometimes have different fonts installed. So font-family: arial, helvetica, for example, is used so that similar fonts are used on PC (which traditionally has arial, but not helvetica) and Apple Mac (which, traditionally, does not have arial and so helvetica, which it does normally have, will be used).
Note: if the name of a font is more than one word, it should be put in quotation marks, such as font-family: "Times New Roman".

font-size

The size of the font. Be careful with this - text such as headings should not just be a paragraph in a large font; you should still use headings (h1, h2 etc.) even though, in practice, you could make the font-size of a paragraph larger than that of a heading (not recommended for sensible people).

font-weight

This states whether the text is bold or not. In practice this usually only works as font-weight: bold or font-weight: normal. In theory it can also be bolder, lighter, 100, 200, 300, 400, 500, 600, 700, 800 or 900, but seeing as many browsers shake their heads and say "I don't think so", it's safer to stick with bold and normal.

font-style

This states whether the text is italic or not. It can be font-style: italic or font-style: normal.

text-decoration

This states whether the text is underlined or not. This can be:
  • text-decoration: overline, which places a line above the text.
  • text-decoration: line-through, strike-through, which puts a line through the text.
  • text-decoration: underline should only be used for links because users generally expect underlined text to be links.
This property is usually used to decorate links, such as specifying no underline with text-decoration: none.

text-transform

This will change the case of the text.
  • text-transform: capitalize turns the first letter of every word into uppercase.
  • text-transform: uppercase turns everything into uppercase.
  • text-transform: lowercase turns everything into lowercase.
  • text-transform: none I'll leave for you to work out.

body {
 font-family: arial, helvetica, sans-serif;
 font-size: 0.8em;
}

h1 {
 font-size: 2em;
}

h2 {
 font-size: 1.5em;
}

a {
 text-decoration: none;
}

strong {
 font-style: italic;
 text-transform: uppercase;
}

Text spacing

The letter-spacing and word-spacing properties are for spacing between letters or words. The value can be a length or normal.
The line-height property sets the height of the lines in an element, such as a paragraph, without adjusting the size of the font. It can be a number (which specifies a multiple of the font size, so '2' will be two times the font size, for example), a length, a percentage or normal.
The text-align property will align the text inside an element to left, right, center or justify.
The text-indent property will indent the first line of a paragraph, for example, to a given length or percentage. This is a style traditionally used in print, but rarely in digital media such as the web.

p {
 letter-spacing: 0.5em;
 word-spacing: 2em;
 line-height: 1.5;
 text-align: center;
}

Colours

red
Is the same as
rgb(255,0,0)
Which is the same as
rgb(100%,0%,0%)
Which is the same as
#ff0000
Which is the same as
#f00
There are 17 valid predefined colour names. They are aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow.
transparent is also a valid value.
The three values in the rbg value are from 0 to 255, 0 being the lowest level (for example no red), 255 being the highest level (for example full red). These values can also be a percentage.
Hexadecimal (previously and more accurately known as 'sexadecimal') is a base-16 number system. We are generally used to the decimal number system (base-10, from 0 to 9), but hexadecimal has 16 digits, from 0 to f.
The hex number is prefixed with a hash character (#) and can be three or six digits in length. Basically, the three-digit version is a compressed version of the six-digit (#f00 becomes #ff0000, #c96 becomes #cc9966 etc.). The three-digit version is easier to decipher (the first digit, like the first value in rgb, is red, the second green and the third blue) but the six-digit version gives you more control over the exact colour.

'color' and 'background-color'

Colours can be applied by using color and background-color (note that this must be the American English 'color' and not 'colour').
A blue background and yellow text could look like this:

h1 {
 color: yellow;
 background-color: blue;
}
These colours might be a little too harsh, so you could change the code of your CSS file for slightly different shades:

body {
 font-size: 0.8em;
 color: navy;
}

h1 {
 color: #ffc;
 background-color: #009;
}
Save the CSS file and refresh your browser. You will see the colours of the first heading (the h1 element) have changed to yellow and blue.
You can apply the color and background-color properties to most HTML elements, including body, which will change the colours of the page and everything in it.