Wednesday, May 30, 2007

JavaScript Conditional Compilation.

Below are few inbuilt JS variable using which we can know some details of Client machine.

Predefined conditional compilation variables
for JavaScript
Variable Description
@_win32 Returns true if running on a Win32 system, otherwise NaN.
@_win16 Returns true if running on a Win16 system, otherwise NaN.
@_mac Returns true if running on an Apple Macintosh system, otherwise NaN.
@_alpha Returns true if running on a DEC Alpha processor, otherwise NaN.
@_x86 Returns true if running on an Intel Processor, otherwise NaN.
@_mc680x0 Returns true if running on a Motorola 680x0 processor, otherwise NaN.
@_PowerPC Returns true if running on a Motorola PowerPC processor, otherwise NaN.
@_jscript Always returns true.
@_jscript_build The build number of the JScript scripting engine.
@_jscript_version A number representing the JScript version number in major.minor format.

IE4 supports JScript 3.x
IE5.x supports JScript 5.5 or less
IE6 supports JScript 5.6

The version number reported for JScript .NET is 7.x.

@_debug Returns true if compiled in debug mode, otherwise false.
@_fast Returns true if compiled in fast mode, otherwise false.

In most cases, you probably will be limited to just using @_win and @jscript_build:

@if (@_win32)
document.write("OS is 32-bit. Browser is IE.");
document.write("OS is NOT 32-bit. Browser is IE.");

User defined Variables

You can also define your own variables to use within the conditional compilation block, with the syntax being:

@set @varname = term

Numeric and Boolean variables are supported for conditional compilation, though strings are not. For example:

@set @myvar1 = 35
@set @myvar3 = @_jscript_version

The standard set of operators are supported in conditional compilation logic:

  • ! ~
  • * / %
  • + -
  • << >> >>>
  • < <= > >=
  • == != === !==
  • & ^ |
  • &amp;amp;& |

You can test if a user defined variable has been defined by testing for NaN:

@if (@newVar != @newVar)
//this variable isn't defined.

This works since NaN is the only value not equal to itself.


Friday, May 25, 2007

JavaScript No click links

No-click-links are link which you don't have to click.
While Googling for Eazy no click links, I found a Javascript code which enables us to navigate without clicking.
The example is given here

Other than no Clicks, there quite good number of other examples also like
  • mulitselect without control button use,
  • Visual Passwords,
  • Instant Form Validation,
  • etc. ;)
btw myself hoping to see a revolution in Web Navigation by use of more No click links and Visual passwords.

Thursday, May 24, 2007

Browser-Specific selectors (CSS)

These selectors are very useful when you want to change a style in one browser but not the others.

IE 6 and below

* html {}

IE 7 and below

*:first-child+html {} * html {}

IE 7 only

*:first-child+html {}

IE 7 and modern browsers only

html>body {}

Modern browsers only (not IE 7)

html>/**/body {}

Recent Opera versions 9 and below

html:first-child {}


html[xmlns*=""] body:last-child {}

To use these selectors, place the code in front of the style. E.g.:

#content-box {
width: 300px;
height: 150px;

* html #content-box {
width: 250px;
} /* overrides the above style and changes the width to 250px in IE 6 and below */

Get First Buisness day of Month- PHP

I have written a small function which calculates if given date is first buisness day of that month.
This can be set in cron job and run every day to check if this is first buisness day.
This can be useful for sending newsletters / promotional offers , etc on first buisness day of every month.

function definition is given below

* Function which checks if current date passed is a first buisness day of any month or NOT.

* Description - First it checks if given date is 01 if yes then check if its not sat/ sun / public holidays.
if 01st is nonbuisness day then ignore return false.
In this case when the function will be called again on 02, here it will check if 02 is buisness day, if yes then if 01 was non buisness day then 02 is definitely first buisness day of the month.
This check will be done until 06 of every month.

* @param integer $year year in YYYY format
* @param integer $month Month in MM format
* @param integer $day day in DD format
* @param mixed $non_buisness_days array containing all non buisness days values will be in format Sat, Sun, Tue
* @param mixed $public_holidays An array containing list of all holidays for given year, the dates should be in YYYY-MM-DD format
* @return bool true if given date is first buisness day else otherwise false.
* @author VN (02/05/2007)

function is_first_buisness_day($year,$month,$day,$non_buisness_days='',$public_holidays='')
$tmpstamp = mktime(1,1,1,$month,$day,$year);
//echo $year,$month.$day."
$ymd = date('Y-m-d',$tmpstamp);

if($public_holidays == ''){
$public_holidays = array();
if($non_buisness_days == ''){
$non_buisness_days = array();

$d = date('d',$tmpstamp);
$day = date('D',$tmpstamp);
$month = date('m',$tmpstamp);
$year = date('Y',$tmpstamp);

$previous_d = $d-1;
$previous_day = date('D',mktime(1,1,1,$month,$previous_d,$year));

$tp_first_day = mktime(1,1,1,$month,01,$year);
$day_first_day = date('D',$tp_first_day);
$day_first_ymd = date('Y-m-d',$tp_first_day);

if(($d == 01 && (!in_array($day,$non_buisness_days) && !in_array($ymd,$public_holidays)))
($d != 01 && (in_array($day_first_day,$non_buisness_days) in_array($day_first_ymd,$public_holidays)) &&
(!in_array($day,$non_buisness_days)) && (!in_array($ymd,$public_holidays)) &&amp;amp;
($d <=5 && (in_array($previous_day,$non_buisness_days) (in_array($day_first_ymd,$public_holidays)))))){ $return_value = true; } else { $return_value = false; } unset($d); unset($day); unset($month); unset($year); unset($non_buisness_days); unset($previous_d); unset($previous_day); unset($tp_first_day); unset($day_first_day); unset($public_holidays); return $return_value; }


$pb = array('2007-05-01','2007-12-25');
$dt = $_GET['getdate'];;
$dt = explode('-',$dt);

$non_buisness_days = array('Sat','Sun');

echo "Non Buisness days array:
foreach($non_buisness_days as $i => $v){
echo "'".$v."'";
echo " ";
echo "

echo "Public holiday array:
foreach($pb as $i => $v){
echo $v;
echo "
echo "


$bool = is_first_buisness_day($dt[0],$dt[1],$dt[2],$non_buisness_days,$pb);

echo 'YES
'.$_GET['getdate'].' is a first buisness day of Month '.date('F - Y',mktime(1,1,1,$dt[1],$dt[2],$dt[0]));
echo 'NO
'.$_GET['getdate'].' is not a first buisness day of Month '.date('F - Y',mktime(1,1,1,$dt[1],$dt[2],$dt[0]));

Wednesday, May 23, 2007

Navigation Without Mouse Clicks

Have you ever wondered how Surfing would be without mouse-clicks.
Still thinking what I mean.
Let me make it straight then.
lets Say there exist a "Link". Now inorder to view this page, people would normally click it.
Navigating without mouse clicks is that -all we need to do is just do mouseover on it and the link will be clicked and we will be taken to the desired page.

This is very much possible and many research projects are made online based on No-Click Idea.
If this idea is accepted by Internet Users then there would be no sound of mouse clicking while surfing internet,it would be a Quite expedition and number of people complaining of finger pains due to mouse clicks will also gradually decrease ;).

One such research project is here .

I would strongly recommed you all to visit it so as to get that weird-nice experience while navigating this site.

I thoroughly enjoyed my experience and even played few games there.

Monday, May 21, 2007

Search Engines

These days most search engines will automatically index your web page.But if you are interested to do it manually, here is a list of few popular search engines wherein you can feed in your web page address ;)

Search Engines that will accept your URL


Web Glossary

This is a short glossary list for some commonest and few lesser known terms used over www.

Web Glossary

A web technology for streaming movies from a web server to a web client. Developed by Microsoft.

A programming interface (API) that allows web browsers to download and execute Windows programs.

An open source web browser editor from W3C, used to push leading-edge ideas in browser design.

A computer program to locate files on public FTP servers.

API (Application Programming Interface)
An interface for letting a program communicate with another program. In web terms: An interface for letting web browsers or web servers communicate with other programs.

Banner Ad
A (most often graphic) advertisement placed on a web page, which acts as a hyperlink to an advertiser's web site.

The number of symbols per second sent over a channel.

Clickthrough Rate
The number of times visitors click on a hyperlink (or advertisement) on a page, as a percentage of the number of times the page has been displayed.

Information from a web server, stored on your computer by your web browser. The purpose of a cookie is to provide information about your visit to the website for use by the server during a later visit.

Web development software for most platforms (Linux, Unix, Solaris and Windows).

Dynamic IP
An IP address that changes each time you connect to the Internet.

A computer program for transferring (and reformatting) data between incompatible applications or networks.

The number of times a web object (page or picture) has been viewed or downloaded.

Trojan Horse
Computer program hidden in another computer program with the purpose of destroying software or collecting information about the use of the computer.

Addressing a web page or an e-mail with a false referrer. Like sending an e-mail from a false address.

Web Spider
A computer program that searches the Internet for web pages. Common web spiders are the one used by search engines like Google and AltaVista to index the web. Web spiders are also called web robots or wanderers.

A computer virus that can make copies of itself and spread to other computers over the Internet.

Exhaustive list of glossary is available

Thursday, May 17, 2007

Label / Tag Cloud for Blogger

After a bit googling, I finally managed to find a good piece of code for making my own tag cloud.
This person "phydeaux3" has made it so simple that even a kindergarten kid can do all by his own.
Hats off to this person.I wont speak much about it here, you should better check out here, If you like it, go ahead and praise phydeaux3.

For those who couldn't find the link here it is once again

Wednesday, May 16, 2007

SEO Types

Types of SEO

SEO techniques are classified by some into two broad categories: techniques that search engines recommend as part of good design, and those techniques that search engines do not approve of and attempt to minimize the effect of, referred to as spamdexing. Professional SEO consultants do not offer spamming and spamdexing techniques amongst the services that they provide to clients. Some industry commentators classify these methods, and the practitioners who utilize them, as either white hat SEO, or black hat SEO. Different hat colors do not necessarily imply differences in ethics as much as differences in business models. White hats tend to produce results that last a long time, whereas black hats anticipate that their sites will eventually be banned once the search engines discover what they are doing.

White hat

An SEO tactic, technique or method is considered white hat if it conforms to the search engines' guidelines and involves no deception. As the search engine guidelines are not written as a series of rules or commandments, this is an important distinction to note. White hat SEO is not just about following guidelines, but is about ensuring that the content a search engine indexes and subsequently ranks is the same content a user will see.

White hat advice is generally summed up as creating content for users, not for search engines, and then making that content easily accessible to the spiders, rather than attempting to game the algorithm. White hat SEO is in many ways similar to web development that promotes accessibility,although the two are not identical.

Spamdexing / Black hat

Black hat SEO attempts to improve rankings in ways that are disapproved of by the search engines, or involve deception. One black hat technique uses text that is hidden, either as text colored similar to the background, in an invisible div, or positioned off screen. Another method redirects users from a page that is built for search engines to one that is more human friendly. A method that sends a user to a page that was different from the page the search engined ranked is black hat as a rule. The black hat practice of serving one version of a page to search engine spiders and another version to human visitors is called cloaking.

Search engines may penalize sites they discover using black hat methods, either by reducing their rankings or eliminating their listings from their databases altogether. Such penalties can be applied either automatically by the search engines' algorithms, or by a manual site review.

One infamous example was the February 2006 Google removal of both BMW Germany and Ricoh Germany for use of deceptive practices.Both companies, however, quickly apologized, fixed the offending pages, and were restored to Google's list.

Saturday, May 12, 2007

Google bomb

A Google bomb (also referred to as a 'link bomb') is Internet slang for a certain kind of attempt to influence the ranking of a given page in results returned by the Google search engine, often with humorous or political intentions. Because of the way that Google's algorithm works, a page will be ranked higher if the sites that link to that page use consistent anchor text. A Google bomb is created if a large number of sites link to the page in this manner. Google bomb is used both as a verb and a noun. The phrase "Google bombing" was introduced to the New Oxford American Dictionary in May 2005. Google bombing is closely related to spamdexing, the practice of deliberately modifying HTML pages to increase the chance of their being placed close to the beginning of search engine results, or to influence the category to which the page is assigned in a misleading or dishonest manner.

Life Cycle of a Bomb
A Google bomb begins as a webmaster prank. A website manager convinces fellow website managers to put on their sites a hyperlink to the target site containing the desired search words. If enough of those links appear in the various sites on the web, Google's algorithms will recognize that site as being a potential search result for those keywords. Eventually, the site may work its way to the top of the search results.
Google bombs often end their life by becoming too popular or well known: they typically end up being mentioned in multiple well-regarded websites, which themselves then knock the bomb off the top spot. Wikipedia, a notable example, has beaten many Google bombs to the top just by mentioning them in this and other articles.

Friday, May 11, 2007

Whack your Boss

Time to Whack your Boss.
Its PayBack time....
(this is how u embed games in a webpage)


About Pit

True source of inspiration to start this blog were these two adages
  • Knowledge without sharing is worthless.
  • Knowledge without sharing is as a stagnant water so Experience Learning with Sharing.

This is called Web Developers Pit. Hence all articles / news and every damn thing related to web will be published here. Yeah you can mine this pit to any level.

Contact Me

I would love to hear what you have to say about my writing and what I do. If you have any positive or negative feed back, please take a moment of yours to give back to me, so I can help give you and everyone else a lot more.

If you come across anything that you think would interest me and it can feature on my blog, let me know I would love to publish something that our readers like especially if it matches our site's content.

You can contact me at sinless dot hypocrite at gmail dot com

Thursday, May 10, 2007

Google Logo's

Google Logo's

Well call it googlogy or googleX. I just can't stop exploring google. Google has provided so many tools / pages / features to its users, just to prevent them moving out of and invite more new users.

One of its steps in doing so was to connect with peoples emotions and google did it with logo's.

Initially Google developers mostly Larry Page customised Google logos just to represent mood @ google center but later they played it quite often and it assumed a big time role.Now google represents all global, unbiased days like remembering Man's first step on moon, thanks giving, Edvard Munch's Birthday etc.

Louis Braille's Birthday - January 4, 2006

Happy Halloween - October 31, 2006

They have now got their own team of Creative designers who regularly keep designing new logos for Google.

You can view all official and unofficial logos of google at

Official Logos

Holiday Logos

Fan Logo's

Enjoy and be creative to send ur version of google logo to Google Team

Google and You = iGoogle

Google and You = iGoogle

Google has transformed its rather plain-sounding Google Personalized Homepage into the new, (hopefully) sexier iGoogle. Apparently it's something of an old idea; according to Marissa Mayer, Google's VP of search products and user experience, iGoogle was floated as a name for the Personalized Homepage back in 2005 when the service was being assembled. Google then decided to offer Personalized Homepage as a feature rather than a distinct product, however, and intentionally went with the mundane title. Now, two years later, Google has slapped an "i" on the front, intending it to represent a personalized Google experience—I Google, you Google, etc. Either that, or the Google CEO's tenure on Apple's Board of Directors is showing.

One of the major new features of iGoogle is the ability to build gadgets without any prior programming experience. In Google parlance, a gadget is a feature you can design and send to a friend or a family member. Examples of current gadgets include photos, GoogleGrams, YouTube channels, a quote-of-the-day, and a handy personalized anniversary (or other holiday) reminder.

Gadgets can also be set to update automatically, so that your friends and family receive a new one every day. Given just how much most people love getting their "Joke of the Day" from
Santa Banta JOkes.

iGoogle, Google is trying to push the concept of Google as more than just a search engine, while allowing users to selectively incorporate the additional data they see rather than simply throwing it at them a la Yahoo. Encouraging users to create personal spaces at iGoogle not only increases the amount of time users spend on Google's site, it also opens additional advertising and promotional opportunities, all of which the company would welcome as it continues to look beyond its search engine for additional revenue sources.