February 25th, 2009
admin
While designing a website we would need to compare fonts which suits us.Typetester as made the work simple.
Typetester is an online application for comparison of the fonts for the screen.we can compare three fonts at a time with different font style,font size,color etc.We can aslo get the css coding of the font setting given.

Popularity: 1% [?]
February 23rd, 2009
admin
The Document Object Model (DOM) as implemented in MSXML provides a programmatic representation of XML documents, fragments, nodes, or node-sets. It also provides an application programming interface for working with XML data.
The following JScript fragments outline the basic process of programming with XML DOM.
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
Example:
function loadXML(xmlFilePath)
{
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc=document.implementation.createDocument("","",null);
}
catch(e)
{
alert(e.message)
}
}
try
{
xmlDoc.async=false;
xmlDoc.load(xmlFilePath); // xmlFilePath - xml file path Ex: test.xml
return(xmlDoc);
}
catch(e)
{
alert(e.message)
}
return(null);
}
Popularity: 1% [?]
February 18th, 2009
admin
To make the operations such as copy paste using c#,we have to use the Clipboard Class which provides methods to place data on and retrieve data from the system Clipboard.
Example :-
Copy the text from txtCopy to clipboard
System.Windows.Forms.Clipboard.SetDataObject(txtCopy.Text, true);
Paste the text from clipboard to txtPaste
IDataObject clipData = Clipboard.GetDataObject();
if (clipData.GetDataPresent(DataFormats.Text))
{
txtPaste.Text = clipData.GetData(DataFormats.Text).ToString();
}
else
{
txtPaste.Text = "Could not retrieve data from the clipboard.";
}
Download
Popularity: 30% [?]
February 18th, 2009
admin
We can get the clients IP address using the Request object’s(The Request object retrieves the values that the client browser passed to the server during an HTTP request. ) property Request.ServerVariables Collection.
Request.ServerVariables Collection gets the values of predetermined environment variables.
“REMOTE_ADDR” gets the IP address of the remote host making the request.
string ipaddr;
ipaddr = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
here the string “ipaddr” stores the clients ip.
List Of other Request.ServerVariables Object
| Variable |
Description |
| AUTH_TYPE |
The authentication method that the server uses to validate users when they attempt to access a protected script. |
| CONTENT_LENGTH |
The length of the content as given by the client. |
| CONTENT_TYPE |
The data type of the content. Used with queries that have attached information, such as the HTTP queries POST and PUT. |
| GATEWAY_INTERFACE |
The revision of the CGI specification used by the server. Format: CGI/revision.
|
| HTTP_<HeaderName> |
The value stored in the header HeaderName. Any header other than those listed in this table must be prefixed by “HTTP_” in order for the ServerVariables collection to retrieve its value.
Note: The server interprets any underscore (_) characters in HeaderName as dashes in the actual header. For example if you specify HTTP_MY_HEADER, the server searches for a header sent as MY-HEADER.
|
| LOGON_USER |
The Windows NT® account that the user is logged into. |
| PATH_INFO |
Extra path information as given by the client. You can access scripts by using their virtual path and the PATH_INFO server variable. If this information comes from a URL it is decoded by the server before it is passed to the CGI script. |
| PATH_TRANSLATED |
A translated version of PATH_INFO that takes the path and performs any necessary virtual-to-physical mapping. |
| QUERY_STRING |
Query information stored in the string following the question mark (?) in the HTTP request. |
| REMOTE_ADDR |
The IP address of the remote host making the request. |
| REMOTE_HOST |
The name of the host making the request. If the server does not have this information, it will set REMOTE_ADDR and leave this empty. |
| REQUEST_METHOD |
The method used to make the request. For HTTP, this is GET, HEAD, POST, and so on. |
| SCRIPT_MAP |
Gives the base portion of the URL. |
| SCRIPT_NAME |
A virtual path to the script being executed. This is used for self-referencing URLs. |
| SERVER_NAME |
The server’s host name, DNS alias, or IP address as it would appear in self-referencing URLs. |
| SERVER_PORT |
The port number to which the request was sent. |
| SERVER_PORT_SECURE |
A string that contains either 0 or 1. If the request is being handled on the secure port, then this will be 1. Otherwise, it will be 0. |
| SERVER_PROTOCOL |
The name and revision of the request information protocol. Format: protocol/revision. |
| SERVER_SOFTWARE |
The name and version of the server software answering the request (and running the gateway). Format: name/version. |
| URL |
Gives the base portion of the URL. |
Popularity: 5% [?]
February 13th, 2009
admin
We can Convert text to image in c# using System.Drawing namespace.
Here we create a bitmap image and use its Graphics property to convert text passed to image and place the image in a picture box.
private void TextToImage()
{
Color BackColor = Color.White;
String FontName = "Times New Roman";
int FontSize = 25;
int Height = 50;
int Width = 300;
<span style="color: rgb(56, 118, 29);">
//creating bitmap image
<span style="color: rgb(0, 0, 0);">Bitmap </span></span>bitmap = new Bitmap(Width, Height);
<span style="color: rgb(56, 118, 29);">//FromImage method creates a new Graphics from the specified Image.</span>
Graphics graphics = Graphics.FromImage(bitmap);
Color color = Color.Gray;
Font font = new Font(FontName, FontSize);
SolidBrush BrushBackColor = new SolidBrush(BackColor);
Pen BorderPen = new Pen(color);
Rectangle displayRectangle = new Rectangle(new Point(0, 0), new Size(Width - 1, Height - 1));
<span style="color: rgb(56, 118, 29);">//Drawing a rectangle and filling the background as white
<span style="color: rgb(0, 0, 0);">graphics</span></span>.FillRectangle(BrushBackColor, displayRectangle);
graphics.DrawRectangle(BorderPen, displayRectangle); <span style="color: rgb(56, 118, 29);">
//giving the font and color to the string passed</span>
graphics.DrawString(txtEnter.Text,font,Brushes.Red, 0, 0);
pictureBox1.Image = bitmap;
}
Download
Popularity: 5% [?]
Requirements for JavaBeans:
- there have to be set/get methods specified
- has to have public default constructor (without parameters)
- it should be in a package
- serializable
- get/set methods has to have the same data type!
- bean cannot modify content of a page!
… in general, JavaBean is a standard Class.
It can be used as a simple component in a JSP page.
- get method has to be fast, and it should be plain and simple.
usage in a JSP page:
<jsp:useBean id=”nameOfBean” scope=”session” class=”myPackage.Counter”>
<jsp:setProperty name=”nameOfBean” property=”myCount”>
this is the same as
<%= Counter.myCount %>
with JSTL Expression language:
<c:out value=”${Counter.myCount}”>
automatically set the bean attributes from names (!important!):
<jsp:setProperty name=”pocetMiest” property=”*”>
Scope can be:
- application - the bean is available in all application, when that’s in more JSP pages, one of them can create it once and other JSP pages can use it. It’s something like a global object for all application.
- session - stored data, just for this session
- request - just for request or forward
- page - smallest scope, just on a page that is called (forwarded or included)
Popularity: 1% [?]
I was looking for a tool to search a blog since it did not have a search box.
So i Searched google but did’nt find any but surprisingly while searching i
came across a article in yourshortestpath which gave the answer and was
very simple.
Use Google To Search A Website or Blog Without A Search Box.
Steps to search a website or blog without search box:
* Go to Google search
* type the word you want to search space site:+”url of the site”
Example : dotnet site:http://fordevs.com
This returns the result with the pages having the word dotnet.
And to note the search returns only the pages indexed by google for that website/blog.
Popularity: 2% [?]
The setInterval() method evaluates a function or an expression repeatedly for the specified number of milliseconds and it returns an interval reference.
Syntax:
variable = setInterval(expression, milliseconds)
or
variable = setInterval(function, milliseconds)
variable holds the interval reference returned by seInterval method.
Example:
Below example display the current time information using setInterval method call the date object.
<html>
<head>
<title> setInterval Method Example </title>
<script language="javascript">
function startSetInt()
{
ref=setInterval("init()",100);
}
function init()
{
dt = new Date();
document.getElementById("lbl").innerText = "Timer : " + dt;
document.getElementById("btnStart").disabled = true;
document.getElementById("btnStop").disabled = false;
}
function stopSetInt()
{
clearInterval(ref)
document.getElementById("lbl").innerText = "Timer : ";
document.getElementById("btnStart").disabled = false;
document.getElementById("btnStop").disabled = true;
}
</script>
</head>
<body onload="startSetInt()">
<label id="lbl" name="lbl"></label>
</br>
</br>
<input type="button" id="btnStart" value="Start" onclick="startSetInt()" />
<input type="button" id="btnStop" value="Stop" onclick="stopSetInt()" />
</body>
</html>
Demo : Click here
Popularity: 2% [?]
The following are the Basic JSON Data types,
- Number : integer, real, or floating point
- String : double-quoted Unicode with backslash escaping
- Boolean : true and false
- Array : an ordered sequence of values, comma-separated and enclosed in square brackets
- Object : collection of key:value pairs, comma-separated and enclosed in curly braces
- null
Example
{
"firstName": "Praveen",
"lastName": "C",
"address": {
"streetAddress": "KK Nagar",
"city": "Chennai",
"state": "TN",
"postalCode": 6310102
},
"phoneNumbers": [
"091 98943 37266"
]
}
Popularity: 1% [?]
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition – December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others.
Popularity: 1% [?]