Monday, August 18, 2008

Blockquote: Then and Now

Blockquote: Then and Now
by Kevin Yank
As The Ultimate HTML Reference author Ian Lloyd puts it, "blockquote has been around a long time, but it hasn’t aged a day." But while the effect of the tag in today’s browsers is virtually unchanged from when it was first introduced in the Web’s earliest browsers, the way we use it has progressed dramatically.
blockquote, of course, is meant to mark a "block quote"—a verbatim reproduction of content originally published or presented elsewhere, presented as a block, apart from the surrounding content. Belying this important purpose, the element’s default visual presentation is quite simple: browsers simply leave left and right margins of about 36 pixels to either side of the element.
Early on in the Web’s history, blockquote was largely ignored. In a time when HTML elements were routinely misused to achieve visual effects, blockquote was seen as the identical twin of dd, since they both have the same visual effect, and because is shorter to type than , that’s what designers used.
Designers who took pride in the quality of their code quickly found HTML validators (like the W3C’s) didn’t appreciate them using dd for this. dd elements belong inside a definition list (dl), after all. A blockquote, on the other hand, can go anywhere a block element is welcome, so gradually it became the element of choice for producing indentend content.
The more indented a designer wanted content to appear, the more blockquote elements he would wrap it in. This led to some pretty monstrous code, particularly when generated by WYSIWYG authoring tools:
A block with breathing room!Of course, today most web designers understand the value of semantically meaningful code. This, and the fact that CSS can be used easily to apply the exact same formatting that blockquote elements get by default, has seen correct use of blockquote rise to dominate in recent years.
Meanwhile, the semantics provided by blockquote are more relevant than ever. Blogs continually quote other blogs and sites, and the blockquote element is perfectly suited to marking up such quotations.
Read on to discover some of the blockquote element’s hidden subtleties, and how it could be used to reveal a web within the Web: a web of attribution.

Friday, May 23, 2008

Soft Hyphens in javascript

Soft Hyphens
Tucked away in the list of CSS improvements in Firefox 3 is this innocuous-looking feature: “HTML soft hyphens (­) are now supported.”
Soft hyphens are one of those obscure gems that HTML has always supported on paper, but that no one has taken any notice of because browser support has been spotty. With the imminent release of Firefox 3, however, soft hyphens will be supported by all major browsers including Internet Explorer, Safari, and Opera.
So, what is a soft hyphen, anyway?
A soft hyphen is a character of text that is usually invisible. It signals a spot in the text (usually in the middle of a long word) where it would be acceptable to break the line with a hyphen.
When a browser that supports soft hyphens encounters a long word or other long piece of text with no obvious wrap point that doesn’t fit horizontally inside a block on the page, it will look for a soft hyphen within the text and display it as a normal hyphen followed by a line break.
Take a look at this code sample:


Supercalifragilisticexpialidocious


Display this in any browser, and the long word will protrude from the side of the div.

This situation arises all the time in real-world web design. Say you’ve got a navigation menu that occupies 25% of the width of the page. At small enough browser window sizes, a particularly long word in one of your menu items will either protrude messily from your menu into another part of the page, or force the menu to increase its width, possibly breaking your page layout.
Soft hyphens to the rescue!


Supercalifragilistic­expialidocious



Firefox 3 will be the last major browser to add support for soft hyphens, but you don’t have to wait for it to be released to start using them! Firefox 2 simply ignores the character, leaving it invisible (and leaving your text protruding from its box). Not bad as a fallback, especially compared to Safari, which used to display it as a normal hyphen! Thankfully, Safari 2 or later gets it right.
Depending on how you edit your HTML, you may simply want to insert the soft hyphen character itself rather than the HTML character entity reference (­). It’ll save a few bytes, and good code editors (jEdit, for example) will display soft hyphens as normal hyphens, so you can see them in your code. Some are even smart enough to ignore soft hyphens when checking your spelling!
You can type a soft hyphen in Windows by holding down the Alt key and then typing either 0173 on the number pad, or the plus key on the number pad followed by 00AD, before releasing Alt. If you can’t remember that (I sure can’t), or if you’re on a Mac, you can find the soft hyphen in the Character Map (the Character Palette in Mac OS X).
If you do decide to use actual soft hyphen characters in your code, make sure you know your character encodings, because unlike most Latin-1 characters, soft hyphens are encoded differently in UTF-8, so you need to save your code with the right encoding for the soft hyphens to work.

Artical from SitePoint. JavaScript & CSS Blog: Stylish Scriptingby Kevin YankTwo Hidden Features New in Firefox 3

Wednesday, May 14, 2008

Java Script Validation Functions


/****************************************************/
/* COMMON JAVASCRIPT FUNCTIONS */
/****************************************************/
// VARIABLES FOR COLOR
//var BG_ERR_CLR = 'red'; // error background color.
var FG_ERR_CLR = 'black'; // error foreground color.
var BG_DEF_CLR = 'white'; // default background color.
var FG_DEF_CLR = 'black'; // default foreground color.
var CONTROL = 'CONTROL'; // default foreground color.
var BG_ERR_CLR = '#FFE87C';
//var BG_ERR_CLR = 'RED';
--------------------------Method names --------------------------------------
1. showError()
/**
* showError()
* ================
*
* Show the Message Box (Error, Information, Warning)
*
* Parameters
* ----------
* - MANDATORY MUST BE PASSED BY USER
* - MANDATORY MUST BE PASSED BY USER
* - OPTIONAL
* Return value
* ------------
*/
function showError()
{
lstrMessageID = showError.arguments[0];
lstrMessage = showError.arguments[1];
lobjField = showError.arguments[2];

lstrFinalMsg = lstrMessageID + ' : ' + lstrMessage;

if(lobjField!=null)
{
setErrorColor(lobjField);
lobjField.focus();
}
alert(lstrFinalMsg);
}

2. showQuestion()
/**
* showQuestion()
* ================
*
* Show the Message Box (Warning) - Yes/No
*
* Parameters
* ----------
* - MANDATORY MUST BE PASSED BY USER
* - MANDATORY MUST BE PASSED BY USER
* - OPTIONAL
* Return value
* ------------
* -
*/
function showQuestion()
{
lstrMessageID = showQuestion.arguments[0];
lstrMessage = showQuestion.arguments[1];
lobjField = showQuestion.arguments[2];

lstrFinalMsg = lstrMessageID + ' : ' + lstrMessage;

/*if(lobjField!=null){
lobjField.focus();
}*/
return confirm(lstrFinalMsg);
}

3. getComboUpdated(comboObj,strDispValue, strKey)
// Input Parameter - 1. Combo Object
// 2. Text of the option
// 3. Value that is to be returned, when the option is selected
// Output Parameter - None
// Functionality - This function dynamically adds an option to the combo.

function getComboUpdated(comboObj,strDispValue, strKey)
{
var option = new Option(strDispValue, strKey);
// Add a new option to the combo
var i = comboObj.length;
comboObj.options[i]=option;
}

4. openFlmAsPopup(frameName,url,context1,context2,context3,context4)
// Input Parameter - 1. Url of the popup frame
// 2. Url of screen to be opened in the frame
// 3. object name to be passed to the popup screen.
// 4. object name to be passed to the popup screen.
// 5. object name to be passed to the popup screen.
// 6. object name to be passed to the popup screen.
// Output Parameter - None
// Functionality - This is used to open flm in popup mode..
function openFlmAsPopup(frameName,url,context1,context2,context3,context4)
{
strURL = frameName;
if(context1 != null)
{
strURL = strURL + "&enq_context1=";
strURL = strURL + context1;
}
if(context2 != null)
{
strURL = strURL + "&enq_context2=";
strURL = strURL + context2;
}
if(context3 != null)
{
strURL = strURL + "&enq_context3=";
strURL = strURL + context3;
}
if(context4 != null)
{
strURL = strURL + "&enq_context4=";
strURL = strURL + context4;
}
strURL=strURL + '&url='+escape(url+'&popup=true');
//alert('url constructed is'+strURL);
openPopupWindowWithPos(strURL, '870', '550', '20', '40');

}

5. populateGR(objField, HiddenFieldvalue)
function populateGR(objField, HiddenFieldvalue)
{
if ((objField.value).length == 0)
{
objField.value=HiddenFieldvalue;
}
}

6. RefreshOpenerWindowAndCloseMe(strUrl)
function RefreshOpenerWindowAndCloseMe(strUrl)
{
if(window.opener)
{
// refresh the opener window...as user has selected one of the customer records from the table
window.opener.location.href = strUrl;
// close the current window after refreshing the opener
window.close();
}
}


7. openPopupWindow(strUrl, lngWidth, lngHeight)
function openPopupWindow(strUrl, lngWidth, lngHeight)
{

var strWindowName = "";
var strWindowFeatures;

strWindowFeatures = "toolbar=no,resize=yes,titlebar=no,";
strWindowFeatures = strWindowFeatures + "location=no,directories=no,status=no,scrollbars=yes,"
strWindowFeatures = strWindowFeatures + "menubar=no,width=" + lngWidth + ",height=" + lngHeight + ",maximize=null";

// open the window
window.open(strUrl, "", strWindowFeatures);
}

//--- Enter Numeric value with decimal..
8. function pressCharOnlyHandeler(e)

{

if ((e.keyCode >= 65 && e.keyCode <= 90) || (e.keyCode >= 97 && e.keyCode <= 122) ) {
return true;
}
else
{
return false;
}
}

/**
* isSelected()
* ================
*
* Function to check if any checkbox is selected or not
* Assumes that the checkbox column in the table has been defined by the name 'selected'
*
* Parameters -
* ----------
*
* Return value -
* ------------
*/

9. function isSelected()

{
var table = document.getElementById(arguments[0]);
var numrows = table.rows.length;
if(numrows <= 0) { return false; } var chk = 0; for(i=0;;i++)
{
var str = 'accountDatas[' + i + '].delStatus';
var obj = document.getElementById(str);
if(obj == null)
{
break;
}
if(obj.checked)
{
chk=1; break;
}
}
if(chk==1)
{
return true;
}
else
{
return false;
}
}


/**
* isEmpty()
* ================
*
* Check whether string s is empty.
*
* Parameters
* ----------
* -
*
* Return value
* ------------
* -
*/
10. function isEmpty(lstrValue)

{
lstrValue=leftTrimString(lstrValue);
lstrValue=rightTrimString(lstrValue);

return ((lstrValue == null) (lstrValue.length == 0))
}

/////////////////// STRING FUNCTIONS- BEGIN /////////////////////////////////////

/**
* rightTrimString()
* ================
*
* Trim the blank spaces on the right side of the string
*
* Parameters
* ----------
* -
*
* Return value
* ------------
* -
*/
11. function rightTrimString(astrValue)

{
var lstrValue = astrValue;

lstrValue=lstrValue.replace(/(.*?)\s*$/, "$1");
return lstrValue;
}

/**
* leftTrimString()
* ================
*
* Method to Trim the blank spaces on the left side of the string
*
* Parameters
* ----------
* -
*
* Return value
* ------------
* -
*/
12. function leftTrimString(astrValue)

{
var lstrValue = astrValue;

lstrValue=lstrValue.replace(/^\s*(.*)/, "$1");
return lstrValue;
}

/**
* trimString()
* ================
*
* Method to remove the left and right curtailing spaces
*
* Parameters
* ----------
* -
*
* Return value
* ------------
* -
*/
13. function trimString(astrValue)

{
var lstrValue = astrValue;

lstrValue=leftTrimString(lstrValue);
lstrValue=rightTrimString(lstrValue);
return lstrValue;
}

14. function isInteger(aValue)
{
var lstrValue = aValue;
re = new RegExp(",","g");
lstrValue = lstrValue.replace(re,"");
for (lintCounter = 0; lintCounter < c =" lstrValue.charAt(lintCounter);"> "9"))){
return false;
}
}

/**
* validateFloat()
* ================
*
* To validate that the number passed is valid or not
*
* Parameters
* ----------
* - MANDATORY MUST BE PASSED BY USER
* - MANDATORY MUST BE PASSED BY USER
* - MANDATORY MUST BE PASSED BY USER
* - OPTIONAL (By default it is false)
*
* Return value
* ------------
* -
*/

15. function validateFloat(astrNumber,astrDigitsBefDec,astrDigitsAfterDec)
{
var lreComma = new RegExp(",","g");
var lblnResult = false;
var lstrVal = astrNumber;
var lstrDigitsBefDec = astrDigitsBefDec;
var lstrDigitsAfterDec = astrDigitsAfterDec;
var lblnNegativeAllowed = validateFloat.arguments[3];
// Replace the commas if present in the value
if(lstrVal != null && lstrVal.length > 0){
lstrVal = validateFloat.arguments[0].replace(lreComma,"");
}else{
// If Null is passed then return false
return false;
}

if(lblnNegativeAllowed == null lblnNegativeAllowed.length == 0){
lblnNegativeAllowed = false;
}

if(lblnNegativeAllowed){
//To match positive or negative real numbers with or without a decimal point and 0 to <> decimal places.
lexp = "^-?\\d{0," + lstrDigitsBefDec + "}(\\.\\d{0," + lstrDigitsAfterDec + "})?$";
lreData = new RegExp(lexp);
lblnResult = lreData.test(lstrVal);
}else{
//To match positive real numbers with or without a decimal point and 0 to <> decimal places.
lexp = "^\\d{0," + lstrDigitsBefDec + "}(\\.\\d{0," + lstrDigitsAfterDec + "})?$";
lreData = new RegExp(lexp);
lblnResult = lreData.test(lstrVal);
}
return lblnResult;
}


Thursday, September 6, 2007

Trap Browser Close Button

// Tracking of Browser Close Button



Tuesday, May 1, 2007

DATABASE connectivity in JAVA using JDBC Driver

Different Typs of Driver Available in JAVA

Type 1: JDBC-ODBC Bridge

The type 1 driver, JDBC-ODBC Bridge , translates all JDBC calls into ODBC (Open DataBase Connectivity) calls and sends them to the ODBC driver. As such, the ODBC driver, as well as, in many cases, the client database code, must be present on the client machine.

Java--->JDBCStat-->JDBC-ODBC bridge-->ODBC-->Databases

Type 2: Native-API/partly Java driver

JDBC driver type 2 -- the native-API/partly Java driver -- converts JDBC calls into database-specific calls for databases such as SQL Server, Informix, Oracle, or Sybase. The type 2 driver communicates directly with the database server; therefore it requires that some binary code be present on the client machine.

Type 3: Net-protocol/ all-Java driver

JDBC driver type 3 -- the net-protocol/ all-Java driver -- follows a three-tiered approach whereby the JDBC database requests are passed through the network to the middle-tier server. The middle-tier server then translates the request (directly or indirectly) to the database-specific native-connectivity interface to further the request to the database server. If the middle-tier server is written in Java, it can use a type 1 or type 2 JDBC driver to do this.

Java-->JDBC statements-->SQLStatements- -> databases.

Type 4 Pure Java Driver

Type 4 JDBC drivers are direct-to-database pure Java drivers ("thin" drivers). A Type 4 driver takes JDBC calls and translates them into the network protocol (proprietary protocol) used directly by the DBMS. Thus, client machines or application servers can make direct calls to the DBMS server. Each DBMS requires its own Type 4 driver; therefore, there are more drivers to manage in a heterogeneous computing environment, but this is outweighed by the fact that Type 4 drivers provide faster performance and direct access to DBMS features.

Examples J

// Class.forName("sun.jdbc.odbc. JdbcOdbcDriver");//for MS Access
//con = DriverManager. getConnection("jdbc:odbc:dataSourc eName");//for Ms Access TYPE1


//Class.forName("sun.jdbc.odbc. JdbcOdbcDriver");//for SQL Server
//con=DriverManager .getConnection("jdbc:odbc:dataSourc eName","username","password");//for sQL Server TYPE1


Class.forName("com.microsoft. jdbc.sqlserver. SQLServerDriver"); //usign SQL SERVER 2K JDBC Driver
con=DriverManager. getConnection("jdbc:microsoft: sqlserver: //localhost: 1433;databaseNam e=dataSourceName ;selectMethod= cursor;","username","password");
TYPE 2

//Class.forName("net.avenir.jdbc2. Driver"); //atinav 2.5 JDBC driver(www.atinav. com:-30 days trial version jdm)
//con=DriverManager .getConnection("jdbc:AvenirDriver: //localhost: 1433/dataSourceN ame","username","password");
TYPE 3

//Class.forName("com.jnetdirect. jsql.JSQLDriver"); //JSQLConnect JDBC driver(http://www.j- netdirect. com/DownloadSoft ware.html: -30 days trial version )
//con=DriverManager .getConnection("jdbc:JSQLConnect: //localhost/ dataSourceName","username","password");
TYPE 3

//Class.forName("com.mysql.jdbc. Driver");// for mySQL
//con = DriverManager. getConnection("jdbc:mysql:/ /localhost/ dataSourceName? user=username&password=password");// need to download MySQL Connector/J

TYPE 4 because mysql connector is a type 4 driver

Thursday, April 19, 2007

class.Forename

Why We do not create Object of Class.forename();


What is Class class

It is a Class of declared class type.
Not have any public constructor, so due to this we can not create object of any class . and forName() is a static method, so it will cal with the help of class. This forName method take fully qualified class path which we want to execute at initialised time with the help of class loader.

java.lang Class Classjava.lang.Object
java.lang.Class
All Implemented Interfaces:
Serializable
public final class Class
extends Object
implements SerializableInstances of the class Class represent classes and interfaces in a running Java application.

Class has no public constructor. Instead Class objects are constructed automatically by the Java Virtual Machine as classes are loaded and by calls to the defineClass method in the class loader.

Tuesday, April 10, 2007

25 Tip For Job Search

25 TIPS FOR USING THE INTERNET IN YOUR JOB SEARCH

1. When typing your resume out with the intent of emailing, make sure it is in an ASCIIformat.

2. Use keywords heavily in the introduction of the resume, not at the end.

3. Keywords are almost always nouns, related to skills, such as financial analysis, marketing,accounting, or Web design.

4. When sending your resume via email in an ASCII format, attach (if you can) a nicely formattedone in case it does go through and the reader would like to see your creativityand preferred layout. If you do attach it, use a common program like MS Word.

5. Don’t focus on an objective in the introduction of the resume, but rather accomplishments,using keywords to describe them.

6. Don’t post your resume to your own Web site unless it is a very slick page. A poorlyexecuted Web page is more damaging than none at all.

7. Before you email your resume, experiment sending it to yourself and to a friend as a testdrive.

8. Look up the Web site of the company you are targeting to get recent news informationabout new products, etc., and look for their job posting for new information.

9. Before your interview or verbal contact, research the company’s Web site.

10. Use a font size between 10 and 14 point, make it all the same for an ASCII format resume,and don’t create your resume for emailing with lines exceeding 65 characters.

11. In case your resume may be scanned, use white paper with no borders and no creativefonts.

12. Include your email address on your resume and cover letter.

13. Don’t email from your current employer’s IP network.

14. Don’t circulate your work email address for job search purposes.

15. In the “subject” of your email (just below the “address to” part), put something morecreative than “Resume Enclosed.” Try “Resume showing 8 years in telecommunicationsindustry” (if that is your chosen industry), for example.

16. For additional sources of online job searching, do a “search” on the Web for job searching,your company, and your specific discipline for additional information.

17. Be careful of your spelling on the Internet. You will notice more spelling errors on emailexchanges than you will ever see in mailed letter exchanges.

18. Try to make sure your resume is scannable. This means it has a simple font, no borders,no creative lining, no bold face, no underlining, no italics, and limited if any columning.Though the practice of scanning is overestimated, it should still be a consideration.

19. Purchase or check out of a library an Internet directory listing the many links to job opportunitiesout there. There are thousands.

20. If you are using the email as your cover letter, keep it brief. If the reader is reading onscreen, their tolerance for reading long information is reduced dramatically.

21. Always back up what you can on a disk.

22. If you post your resume to a newsgroup, first make sure that this is acceptable to avoidany problems with other participants.

23. Remember that tabs and spaces are the only formatting you can do in ASCII.

24. Make sure you check your email every day. If you are communicating via the Internet,people may expect a prompt return.

25. Don’t send multiple emails to ensure that one gets through. Try to send it with aconfirmation of receipt, or keep a look out for a notice from you ISP that the messagedidn’t go through.

Global Tech Soft Solution

Smart software solution.

Webdesigning, software Development & Consultant GlobalTech Soft Solution