I got to know that Scott Hanselman's 2009 Ultimate Developer and Power Users Tool List for Windows. This is very handy list. you can get more info of these lists from http://www.hanselman.com/blog/ScottHanselmans2009UltimateDeveloperAndPowerUsersToolListForWindows.aspx
Ultimate Developer and Power Users Tool List for Windows
Development Benedict Alphonse Tuesday, September 8, 2009 0 comments
Javascript - Multiple Email Addresses Validation
Function :
Javascript Benedict Alphonse Monday, June 8, 2009 0 comments
Cheatsheets - Every WebDeveloper Mush Have
JavaScript
Addison-Wesley’s JavaScript Reference Card
JavaScript and Browser Objects Quick Reference
CSS
Design 215 CSS Quick Reference
HTML/XHTML
HTML Character Entities Cheat Sheet
Character Entity References in HTML 4 and XHTML 1.0
AJAX
Scriptaculous Combination Effects Cheat Sheet
ASP.net AJAX Client Life-Cycle Events
Colors
Microformats
Microformats Helper Cheat Sheet
Jack Daniel’s Microformats Cheat Sheet
Browser Compatibility
Browser Compatibility Interactive Table
XML
XML TopicMaps 1.0 - Quick Reference Card
XML Schema - Structures Quick Reference
XML Schema - Data Types Quick Reference
PHP
Jack Daniel’s PHP Cheat Sheet (HTML)
Interactive PHP Cheat Sheet (HTML)
Blue Shoes Developer - PHP Cheat Sheet (HTML)
PHP Cheat Sheet (HTML)
PHP Cheat Sheet (HTML)
Regular Expressions Reference Sheet (HTML)
Tiger PHP Cheat Sheet (PDF)
PHP 4 Reference Card (PDF)
PHP Templates Cheat Sheet (PDF)
Ruby
Ruby Cheat Sheet (PDF)
Jack Daniel’s Ruby on Rails Cheat Sheet (HTML)
Textmate Rails Cheat Sheet (PDF)
Zen Spider Ruby Quick Reference (HTML)
Rails Reference 1.1 (PDF)
Rails Active Resource Cheat Sheet (PDF)
ActiveRecord Relationships (PDF)
Rails Strings Cheat Sheet (PDF)
What Goes Where Cheat Sheet (PDF)
Ruby on Rails Cheat Sheet (PDF)
Ruby on Rails Form Helpers (PDF)
Perl
Perl Quick Reference (PDF)
Perl Cheat Sheet (HTML)
Perl 5 Cheat Sheet (HTML)
Perl Testing Reference Card (PDF)
Perl Quick Reference Card (PDF)
ASP.net
ASP.net Page Lifecycle Diagram (PNG)
.NET Format String Quick Reference (PDF)
ASP.NET 2.0 Page Life Cycle & Common Events (PDF)
Visual Studio 2005 Built-in Code Snippets (C#) (PDF)
Visual Studio 2005 Default Keybindings C# (PDF)
Visual Studio 2005 Default Keybindings VB.net (PDF)
ASP.NET AJAX Client Life Cycle & Events (PDF)
VB.net and C# Comparison (PDF) (Word)
Casting in VB.net and C# (HTML)
ASP.net Basics (PDF)
Python
Python 2.4 Cheat Sheet (HTML)
Python 2.2 Quick Reference (HTML)
Python Cheat Sheet (HTML)
Python 101 Cheat Sheet (HTML)
Python PHP Cheat Sheet (PDF)
Python Quick Reference (PDF)
ColdFusion
ColdFusion Reference Sheet (PDF)
ColdFusion Cheat Sheet (HTML)
ColdFusion Quick Reference (HTML)
Java / JavaServer Pages
JavaServer Pages Syntax (PDF)
JSP 2.0 XML Cheat Sheet (HTML)
Java Cheat Sheet : Java Glossary (HTML)
Java Reference Sheet (PDF)
MySQL
Jack Daniel’s MySQL Cheat Sheet (PDF) (PNG)
MySQL Reference Card (PDF)
Neal Parikh MySQL Cheat Sheet (HTML)
MySQL Reference Sheet (PDF)
Handy Cheat-Sheet of MySQL Commands (HTML)
MySQL Commands (HTML)
SQL Injection Cheat Sheet (HTML)
SQL Server
Jack Daniel’s SQL Server Cheat Sheet (PDF) (PNG)
A to Z SQL Server 2005 (HTML)
SQL Injection Cheat Sheet (HTML)
General Benedict Alphonse Sunday, May 31, 2009 0 comments
Mistakes what we are doing frequently in Software Development
1. Not understanding the user’s needs. Lack of user input, or not even asking. 2. Underestimating the size of the project. 3. Rushing through the planning stage, or avoiding the planning all together. Code first, plan later! BAD! 4. Not testing early enough, often, or at all! Make it a habit! 5. Choosing the “Cool” methodology at the time, vs. one that has worked in the past. Which leads into my next point… 6. Not using a methodology. 7. Letting a software developer run the software development project. 8. Bored, unmotivated team! You have to motivate your developers! If you can’t motivate, don’t bother trying to lead. Your team will fall asleep, literally. 9. Planning on catching up later. You won’t… don’t even think it! 10. Non Source Control! Ouch.. not good people… and no, just installing a software package is not it… 11. Deciding to switch your development tools when you’re already into the project. 12. Allowing feature creep. Just say NO! Everyone will be happier in the end. 13. Omitting necessary tasks to shorten the project plan. Really, what’s the point of doing this? 14. Insufficient management controls in the development project. 15. Lack of high level business sponsorship. 16. Adding people at the end of the project to “speed things up”. You will only slow things down… 17. No unit testing. Heck if you can do it, use Visual Studio Team Foundation Server and set up some automated testing nightly. 18. Stressed out software developers. If you have managed to perform even one or two of these software development mistakes, you will have a stressed out bunch of programmers to deal with! 19. Lack of error handling. 20. “Off by one” errors. These happen a lot during the software development process.. *sigh*. 21. Typos… Just use option strict and explicit please.. during one software development project, which I was on as a consultant, they were getting ridiculous amounts of errors everywhere… turned out the developer couldn’t spell and would declare variables with incorrect spelling.. no big deal, until you use the correct spelling when you’re assigning a value to it… and you had option explicit off. Ouch to them… 22. No understand the deployment or hardware the software is to be installed on. Ohhhh it’s for a Macintosh… lol. Well hopefully not that bad, but you get the point. 23. No naming style or code conventions. Honestly it doesn’t matter what you use… as long as you are consistent with the rest of the team, and hopefully at least yourself. 24. Using global variables everywhere. These are NOT your friend and hog memory like nothing you have ever seen before! 25. Not asking for help at all during the software development process. If you’re stuck, don’t fight with it for hours on end! Ask for help! 26. Not commenting your code. 27. Hogging all information to yourself. You think you’re more valuable this way? You’re actually not and there is a plan brewing to get you kicked off the development project, and possibly out of the company. You might want to brush up your sign “Will code for pizza!”. 28. Performing database operations at the application layer instead of the database layer. Not only is this putting the processing juice on your application instead of your server, but you have put your database at risk of data integrity issues, and getting bad data! Some of my hipster cool friends are always saying “It’s alllll good”, well, if your database can be caught saying this… and If everything looks good to your database, then you should be worried. It is NOT all good! 29. Not validating your data! Yikes… Yes.. let’s just assume all the data is perfect! NOT! 30. No load testing. What.. This is supposed to run on 1,000 user’s machines through Citrix? Interesting… Shouldn’t be an issue! lol… NOT. Credit goes to Original Author : http://www.realsoftwaredevelopment.com/
Software Development Benedict Alphonse 0 comments
Software Developer - Must Know
1. Time spent writing great code
It’s not about the quantity it’s the quality! However a twist to this is: It is about the quantity, and the quality. Far too many times you will get one of two scenarios.
In scenario A, you have a developer that pumps out code like mad, things seem to be working… then bugs start happening, you don’t know why, seems to take forever to fix! Or they fix 10 and cause 5 more! But you get a lot of code…
In scenario B, you have a developer that seems so smart! You interview him and he knows everything about everything, can speak the theory up and down! Yet for some reason, you have assigned him three features, and three weeks later, he is still working on something that should have been done in 3 days! You are so confused! He is so smart! He knows everything about generics, multi-threading, and can explain pointers to your grandmother and make her excited to want to code! Why is nothing getting done?!
In your dream scenario, you get great code! Great code is done by a great developer that is super smart, knows what quality code is, and writes code like Tony Hawk rides his skateboard. It looks so natural! He or she is almost entertaining to watch! They also get it done at blinding speeds! They know how long each problem should take, and do not get caught up in finding the world’s best solution, that has multiple threads and layers, to write a game of pong. Bugs are nonexistent because they write unit tests for themselves, and just plain can code in their sleep! These guys are worth their weight in GOLD!
2. Interpretation of the problem
So there is a problem out there, with millions of ways to solve it. Some people are just natural quick thinkers and can come up with multiple solutions instantly. However, what a great developer would do is totally define the problem before doing anything! A great developer will create a document or whiteboard the problem out. They will email their managers and say things like “Can we meet so I can explain to you how I understand the problem?” Next they will start giving you various solutions, etc.
See, a great developer knows that the way they see the problem and interpret the problem, is probably not the way that the problem creator intended it to be understood. This is a key point, commit this to memory! A great developer will want to understand it fully, before attempting to approach a solution. Do you understand the problem 100%, no? 99%? Go ask more questions and be sure you are 100% clear!
3. How the problem is approached
So once you have clearly defined the problem, you start coding right? Wrong! A great developer will look at the layout, and start thinking of various options, and based on the problem, will start thinking about the best approach to solve the problem. I view this like a game of chess. You can know how all the pieces move, know all the rules of the game, but do you just start moving? No! You analyze the board, come up with a game plan, look at your opponent, and look at what he or she usually do. It’s the same case when you approach a problem.
Look at the problem, figure out what the outcome needs to be, what kind of time you have, the quality being expected, the tools you have to work with, etc. Then, start solving the problem.
4. Confidence in code
As a manager, how confident can you be in their code. Some developers you can say “I need this completed by Friday” come Friday, you get an email saying “I have checked the code into the branch, it is ready for testing” and you just know that there will be very little, if any, bugs found by the quality assurance team. On the flip side, there are some developers that will email you instead and say “I am still not done, and it will be done on Monday morning first thing.” And you are nearly 95% sure that it will be there, however it will be ridden with bugs, and basically unusable for days, if not weeks, until bugs are completely ironed out of the code.
Bottom line: The higher the confidence you can have in a developer, the closer they get to being great developers! Imagine being your manager, and the weight you lift off their shoulders if he doesn’t have to worry about your code!
5. Confidence in the solution
It’s one thing to be confident in the code. If you have a great developer on your hands, you are confident in the solution. These great developers will be great architects. They are able to dissect the whole problem, and figure out how the problem needs to be solved. See it’s not just about coding with great code, it’s also largely about how you architect the solution! This is a key point, and really what separates the good, from the great in the software world.
6. Meets user requirements
At the end of the day, you can have the best code, and the best solution possible, with all the best architecture, but does it meet the user’s requirement? It’s possible not! And you have completely failed. Now there are various degrees of missing the mark, but a great developer will hit the bull’s-eye consistently! They find out exactly what the user wants, come up with a great approach, show the user what they will get every step of the way with weekly builds that have no bugs, and continue to build upon the last version. Requirements are bang on, and the users do the jig!
7. Staying up to date
Great developers are constantly updating their skills independently and proactively! They thirst for new knowledge and perfection like a cat with milk. They don’t wait for their managers to come to them and set goals, ask them to take courses, or are given books to get up to speed on. They go and get these things on their own!
They find the conferences they want to go to, and send emails like “I would really love to go to Tech-Ed This Year! I will learn
Software Development Benedict Alphonse 0 comments
Javascript Custom Functions Part 2
addSpace
Add space to the beginning of an argument.Syntax
addSpace(stringValue, [numlength])
Description
When you want to align the value of the form text box, you can use this function.Examples
The following returns " 123.45". addSpace("123.45", 10); addSpace("123.45");Code
function addSpace(argvalue, numlength) { if (! numlength > 0) numlength = 10; if (argvalue.length < numlength) { for(var i = argvalue.length; i < numlength; i++) argvalue = " " + argvalue; } return argvalue; }
customSplit
Split the argument string into an array of strings.
Syntax
customSplit(strValue, separator, strArrayName)Description
Since some of the browsers does not support latest version of javascript, which has split() function. "customSplit" function can be used then.This function will return the length of the array created.
Examples
var strvalue = "abc##123##zzz##$$$"; var returnArraySize = customSplit(strvalue, "##", "NewArray"); The above will create the following: NewArray[0] has value "abc" NewArray[1] has value "123" NewArray[2] has value "zzz" NewArray[3] has value "$$$" returnArraySize has value "4"Code
function customSplit(strvalue, separator, arrayName) { var n = 0; if (separator.length != 0) { while (strvalue.indexOf(separator) != -1) { eval("arr"+n+" = strvalue.substring(0, strvalue.indexOf(separator));"); strvalue = strvalue.substring(strvalue.indexOf(separator)+separator.length, strvalue.length+1); n++; } eval("arr" + n + " = strvalue;"); arraySize = n+1; } else { for (var x = 0; x < strvalue.length; x++) { eval("arr"+n+" = \"" + strvalue.substring(x, x+1) + "\";"); n++; } arraySize = n; } eval(arrayName + " = new makeArray(arraySize);"); for (var i = 0; i < arraySize; i++) eval(arrayName + "[" + i + "] = arr" + i + ";"); return arraySize; }
DeleteCookie function
Delete the cookie.
Syntax
DeleteCookie(cookieName)cookieName is the cookie that you want to delete.
Description
Examples
Code
function DeleteCookie(cookiename) { var exp = new Date(); exp.setTime(exp.getTime() - 1); var cookieVal = getCookie(cookiename); if (cookieVal != null) document.cookie = name + "=" + cookieVal + "; expires=" + exp.toGMTString(); return; }
See also
getCookie functions.
formatDecimal function
Print the floating point number with certain decimal point.
Syntax
formatDecimal(number, boolean, decimal)number is the floating point number which will be formatted.
boolean is used to decide whether add "0" at the end of the floating point number or not.
decimal is how many decimal point you wnat. (Default is 2)
Description
This function will print the floating point number passed in with the decimal point that users need.
Examples
formatDecimal("123.2333", true, 2); will return "123.23". formatDecimal("123", true, 2); will return "123.00". formatDecimal("123", false, 2); will return "123". formatDecimal("123.2", true, 2); will return "123.20". formatDecimal("123.2", false, 2); will return "123.2". formatDecimal("123.456", true, 2); will return "123.46". formatDecimal(".235", true, 2); will return "0.24". formatDecimal("0.9999", true, 2); will return "1.00". formatDecimal("0.9999", false, 2); will return "1".Code
function formatDecimal(argvalue, addzero, decimaln) { var numOfDecimal = (decimaln == null) ? 2 : decimaln; var number = 1; number = Math.pow(10, numOfDecimal); argvalue = Math.round(parseFloat(argvalue) * number) / number; // If you're using IE3.x, you will get error with the following line. // argvalue = argvalue.toString(); // It works fine in IE4. argvalue = "" + argvalue; if (argvalue.indexOf(".") == 0) argvalue = "0" + argvalue; if (addzero == true) { if (argvalue.indexOf(".") == -1) argvalue = argvalue + "."; while ((argvalue.indexOf(".") + 1) > (argvalue.length - numOfDecimal)) argvalue = argvalue + "0"; } return argvalue; }
See also
formatCurrency function.
formatValue function
Print a number according to the format specified. Used for currency format.
Syntax
formatValue(argvalue, format)argvalue is the number which will be formatted.
format is the format of the result.
Description
The number passed in will be formatted according to the format specified by the user. This function is written for formatting a currency number.And formatDecimal function is needed.
Examples
formatValue(1223.434, "$##,###.##") will return "$1,223.43" formatValue(1223.43, "$##,###.##") will return "$1,223.43" formatValue(1223., "$##,###.##") will return "$1,223.00" formatValue(1223, "$##,###.##") will return "$1,223.00" formatValue(23., "$##,###.##") will return "$23.00" formatValue(23.3, "$##,###.##") will return "$23.30" formatValue(124343423.3, "$###,###,###.##") will return "$124,343,423.30"Code
function formatValue(argvalue, format) { var numOfDecimal = 0; if (format.indexOf(".") != -1) { numOfDecimal = format.substring(format.indexOf(".") + 1, format.length).length; } argvalue = formatDecimal(argvalue, true, numOfDecimal); argvalueBeforeDot = argvalue.substring(0, argvalue.indexOf(".")); retValue = argvalue.substring(argvalue.indexOf("."), argvalue.length); strBeforeDot = format.substring(0, format.indexOf(".")); for (var n = strBeforeDot.length - 1; n >= 0; n--) { oneformatchar = strBeforeDot.substring(n, n + 1); if (oneformatchar == "#") { if (argvalueBeforeDot.length > 0) { argvalueonechar = argvalueBeforeDot.substring(argvalueBeforeDot.length - 1, argvalueBeforeDot.length); retValue = argvalueonechar + retValue; argvalueBeforeDot = argvalueBeforeDot.substring(0, argvalueBeforeDot.length - 1); } } else { if (argvalueBeforeDot.length > 0 || n == 0) retValue = oneformatchar + retValue; } } return retValue; }
See also
formatDecimal function.
GetCookie function
Get the value of a cookie.
Syntax
GetCookie(CookieName)CookieName is the cookie whose value that you want to get.
Description
If the cookie specified doesn't exist, "null" will be returned.
Examples
If the document.cookie contains: USER_ID=abc USER_GP= // variable "userid" has value "abc". var userid = GetCookie("USER_ID"); // variable "usergp" has value "". var usergp = GetCookie("USER_GP"); // variable "userpw" has null value. var userpw = GetCookie("USER_PW");Code
function GetCookie(name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return GetCookieVal(j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function GetCookieVal(offset) { var endstr = document.cookie.indexOf(";", offset); if (("" + endstr) == "" || endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); }
isEmail function
Determine an argument if it is an email address format.
Syntax
isEmail(testValue)testValue is the value that you want to check.
Description
This function only check if the argument has email address's format, i.e. id@some.host, it will not connect to some.host to check if it is valid. There is not any method to validate an email address except you ask the user to key in their correct email address.It is better you use trim to remove both the leading and the trailing space/s before you pass the value to this function.
Examples
The following return "true".
isEmail("abc@some.host");
The followings return "false".
isEmail("abc");
isEmail("abc@somehost");
isEmail("abc@.some.host");
isEmail("abc@some.host.");
Code
function isEmail(argvalue) {
if (argvalue.indexOf(" ") != -1)
return false;
else if (argvalue.indexOf("@") == -1)
return false;
else if (argvalue.indexOf("@") == 0)
return false;
else if (argvalue.indexOf("@") == (argvalue.length-1))
return false;
// arrayString = argvalue.split("@"); (works only in netscape3 and above.)
var retSize = customSplit(argvalue, "@", "arrayString");
if (arrayString[1].indexOf(".") == -1)
return false;
else if (arrayString[1].indexOf(".") == 0)
return false;
else if (arrayString[1].charAt(arrayString[1].length-1) == ".") {
return false;
}
return true;
}
isURL function
Determine an argument if it is a URL.
Syntax
isURL(testValue)testValue is the value that you want to check.
Description
Examples
The followings will return "true". isURL("http://some.host"); isURL("http://some.host/"); isURL("http://some.host/dir"); isURL("http://some.host/dir/"); isURL("http://some.host/dir/htmlfile"); isURL("http://some.host:123"); isURL("http://some.host:123/"); The followings will return "false". isURL("http://.some.host/"); isURL("http://some.host./"); isURL("http://some.host:/"); isURL("http://some.host:.123/"); isURL("http://some.host:123./"); isURL("http://some.host:123./dir"; isURL("http://"); isURL("htp://");Code
function isURL(argvalue) { if (argvalue.indexOf(" ") != -1) return false; else if (argvalue.indexOf("http://") == -1) return false; else if (argvalue == "http://") return false; else if (argvalue.indexOf("http://") > 0) return false; argvalue = argvalue.substring(7, argvalue.length); if (argvalue.indexOf(".") == -1) return false; else if (argvalue.indexOf(".") == 0) return false; else if (argvalue.charAt(argvalue.length - 1) == ".") return false; if (argvalue.indexOf("/") != -1) { argvalue = argvalue.substring(0, argvalue.indexOf("/")); if (argvalue.charAt(argvalue.length - 1) == ".") return false; } if (argvalue.indexOf(":") != -1) { if (argvalue.indexOf(":") == (argvalue.length - 1)) return false; else if (argvalue.charAt(argvalue.indexOf(":") + 1) == ".") return false; argvalue = argvalue.substring(0, argvalue.indexOf(":")); if (argvalue.charAt(argvalue.length - 1) == ".") return false; } return true; }
isW function
Determine an argument if it only contains "word" characters.
Syntax
isW(testValue)testValue is the value that you want to check.
Description
"Word" characters are alphanumeric plus "_".
Example
The followings will return "true". isW("abc123") isW("ABC123") isW("aBc_123") The followings will return "false". isW("abc 123") isW("@#+=") isW("! Abc")Code
function isW(argvalue) { var onechar = ""; for (var n = 0; n < argvalue.length; n++) { onechar = argvalue.substring(n, n+1); if ((onechar < "0" || onechar > "9") && (onechar < "A" || onechar > "Z") && (onechar < "a" || onechar > "z") && (onechar != "_")) { return false; } } return true; }
ltrim function
Remove the leading space/s of an argument.
Syntax
ltrim(stringValue)stringValue is the string which the leading space/s will be removed.
Description
Examples
The following will return "abc ". ltrim(" abc ") The following will return "a b c ". ltrim(" a b c ")Code
function ltrim(argvalue) { while (1) { if (argvalue.substring(0, 1) != " ") break; argvalue = argvalue.substring(1, argvalue.length); } return argvalue; }
makeArray function
Create an array object.
Syntax
makeArray(intArraySize)intArraySize is the length of the array created.
Description
Some browser does not support latest javascript which has Array object. This function can be used in those browser.
Examples
The following will create an array with 3 in length. newArray = new makeArray(3);Code
function makeArray(IntarrSize) { for (var n = 0; n < IntarrSize; n++) this[n] = ""; return this; }
numCheck function
Determine an argument if it only contains number.
Syntax
numCheck(testValue)testValue is the value that you want to check.
Description
numCheck function will return true if the argument only contains "0-9".
Examples
The followings will return "true". numCheck("1234") numCheck("0123") The followings will return "false". numCheck("abcd") numCheck("a123") numCheck("123a") numCheck("12.3")Code
function numCheck(argvalue) { if (argvalue.length == 0) return false; for (var n = 0; n < argvalue.length; n++) if (argvalue.substring(n, n+1) < "0" || argvalue.substring(n, n+1) > "9") return false; return true; }
ParseCookies function
Parse the cookies data and assign these data to "document.Cookie_cookie_name".
Syntax
ParseCookies()
Description
The value of cookie, cookieName, is stored in "document.Cookie_cookieName.value".
Examples
If the server returns the following cookie: Set-Cookie: Cookie1=Value1; Cookie2=Value2 After you call the ParseCookies(). parseCookies(); "document.Cookie_Cookie1.value" will contains value "Value1"; "document.Cookie_Cookie1.name" will contains value "Cookie1"; "document.Cookie_Cookie2.value" will contains value "Value2"; "document.Cookie_Cookie2.name" will contains value "Cookie2";Code
function ParseCookies() { var cookie_string; var cookie_name; var cookie_value; var tmpcookie = document.cookie; var cookie_count = 0; while (tmpcookie.indexOf("; ") != -1) { cookie_string = tmpcookie.substring(0, tmpcookie.indexOf("; ")); cookie_name = cookie_string.substring(0, cookie_string.indexOf("=")); cookie_value = cookie_string.substring(cookie_string.indexOf("=") + "=".length, cookie_string.length); eval("document.Cookie_" + cookie_name + " = new Cookies(cookie_name, cookie_value);"); tmpcookie = tmpcookie.substring(tmpcookie.indexOf("; ") + "; ".length, tmpcookie.length); cookie_count++; } cookie_name = tmpcookie.substring(0, tmpcookie.indexOf("=")); cookie_value = tmpcookie.substring(tmpcookie.indexOf("=") + "=".length, tmpcookie.length); eval("document.Cookie_" + cookie_name + " = new Cookies(cookie_name, cookie_value);"); cookie_count++; return cookie_count; } function Cookies(argname, argvalue) { this.name = argname; this.value = unescape(argvalue); return this; }
replace function
Substitute a string X to a string Y in an argument.
Syntax
replace(stringValue, X, Y)stringValue is the string which has all X will be substituted by Y.
Description
This function will replace all the string X to string Y in the argument, it can not change the string X in certain place.
Examples
The following will return "abcABCdefgh". replace("abc123defgh", "123", "ABC");Code
function replace(argvalue, x, y) { if ((x == y) || (parseInt(y.indexOf(x)) > -1)) { errmessage = "replace function error: \n"; errmessage += "Second argument and third argument could be the same "; errmessage += "or third argument contains second argument.\n"; errmessage += "This will create an infinite loop as it's replaced globally."; alert(errmessage); return false; } while (argvalue.indexOf(x) != -1) { var leading = argvalue.substring(0, argvalue.indexOf(x)); var trailing = argvalue.substring(argvalue.indexOf(x) + x.length, argvalue.length); argvalue = leading + y + trailing; } return argvalue; }
rtrim function
Remove the trailing space/s of an argument.
Syntax
rtrim(stringValue)stringValue is the string that you want to remove its trailing space/s.
Description
Examples
The following will return "abc". rtrim("abc ") The following will return "a b c". rtrim("a b c ") The following will return " abc". rtrim(" abc ")Code
function rtrim(argvalue) { while (1) { if (argvalue.substring(argvalue.length - 1, argvalue.length) != " ") break; argvalue = argvalue.substring(0, argvalue.length - 1); } return argvalue; }
SetCookie function
Setting new cookie value.
Syntax
SetCookie(cookiename, cookievalue, expires, path, domain, secure)
Description
To retrieve the cookie's value, try parseCookie function.For more information about cookie, see Netscape's Cookie Specification at http://home.netscape.com/newsref/std/cookie_spec.html.
Examples
SetCookie("Cookie1", "Value1", null, "/");
SetCookie("Cookie2", "Value2", new Date(), "/");
document.cookie will have value "Cookie1=Value1; Cookie2=Value2".
Code
function SetCookie(cookiename, cookievalue) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = cookiename + "=" + escape(cookievalue) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path )) +
((domain == null) ? "" : ("; domain=" + domain )) +
((secure == true) ? "; secure" : "");
return;
}
trim function
Remove both the leading and the trailing space/s of an argument.
Syntax
trim(stringValue)stringValue is the string which the leading and the trailing space/s will be removed.
Description
When you use this function, make sure ltrim and rtrim are inside the same html file too.
Examples
The following will return "abc".
trim(" abc ")
The following will return "a b c".
trim(" a b c ")
Code
function trim(argvalue) {
var tmpstr = ltrim(argvalue);
return rtrim(tmpstr);
}
Benedict Alphonse Friday, May 29, 2009 0 comments
Microsoft's New Decision (Search) Engine - Bing
Microsoft Corp. unveiled Bing, a new Decision Engine and consumer brand, providing customers with a first step in moving beyond search to help make faster, more informed decisions. Bing is specifically designed to build on the benefits of today’s search engines but begins to move beyond this experience with a new approach to user experience and intuitive tools to help customers make better decisions, focusing initially on four key vertical areas: making a purchase decision, planning a trip, researching a health condition or finding a local business.
The result of this new approach is an important beginning for a new and more powerful kind of search service, which Microsoft is calling a Decision Engine, designed to empower people to gain insight and knowledge from the Web, moving more quickly to important decisions. The new service, located at http://www.Bing.com, will begin to roll out over the coming days and will be fully deployed worldwide on Wednesday, June 3.
The explosive growth of online content has continued unabated, and Bing was developed as a tool to help people more easily navigate through the information overload that has come to characterize many of today’s search experiences. Results from a custom comScore Inc. study across core search engines show that as many as 30 percent of searches are abandoned without a satisfactory result. The data also showed that approximately two-thirds of the remaining searches required a refinement or requery on the search results page.
“Today, search engines do a decent job of helping people navigate the Web and find information, but they don’t do a very good job of enabling people to use the information they find,” said Steve Ballmer, Microsoft CEO. “When we set out to build Bing, we grounded ourselves in a deep understanding of how people really want to use the Web. Bing is an important first step forward in our long-term effort to deliver innovations in search that enable people to find information quickly and use the information they’ve found to accomplish tasks and make smart decisions.”
More Details : http://www.microsoft.com/presspass/press/2009/may09/05-28NewSearchPR.mspx
General Benedict Alphonse 0 comments

