CSS Hacks: A definite guide

April 25th, 2010

What are CSS-hacks?

While developing a web site or web application we need to check the webpage in different browsers to know if it is rendering as expected as per the design or not, when the rendered page differs from browser to browser we need to fix that part to make it looks the same in all browsers, at least major used browsers like IE6, IE8, FF2.0, FF3.0, Safari, Opera and Google Chrome for this we will use some code that code is nothing but a “hack” as we are coding in CSS its called a “CSS hack” in other words a “CSS work around”.

When do we use a CSS-hack?

As per W3C standards using CSS-hack is strictly not recommended. Nevertheless, at times there will be a need to use it at below situations:

  1. During last minutes changes when there is no time to fix.
  2. Upon specific client requests(very rare).
  3. While working on unfinished web jobs where there are code replicas, i.e. when CSS specificity doesn’t work.

Tageting IE

Internet Explorer in short IE is still the most used browser world wide. So its very important to tame IE, though there are number of IE specific hacks from IE5.5 through IE8 its highly recomended to use conditional comments instead of hacks.

Conditional comments as a CSS hack

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
   <head>
	<title>Test</title>
	<link href="all_browsers.css" rel="stylesheet" type="text/css">
	<!--[if IE]> <link href="ie_only.css" rel="stylesheet" type="text/css"> <![endif]-->
	<!--[if lt IE 7]> <link href="ie_6_and_below.css" rel="stylesheet" type="text/css"> <![endif]-->
	<!--[if !lt IE 7]><![IGNORE[--><![IGNORE[]]> <link href="recent.css" rel="stylesheet" type="text/css"> <!--<![endif]-->
	<!--[if !IE]>--> <link href="not_ie.css" rel="stylesheet" type="text/css"> <!--<![endif]-->
	</head>
	<body>
		<p>Test</p>
	</body>
</html>
  IE6 IE7 IE8 FF3 Safari Opera Chrome
_color: blue 1 0 0 0 0 0 0
*:first-child+html #box { color: blue } 0 1 0 0 0 0 0
*+html #box { color: blue } 0 1 0 0 0 0 0
color /*\**/: blue\9 0 0 1 0 0 0 0
:root *> #box { color: blue } 0 0 0 1      
*color: blue; 1 1 0 0 0 0 0
#color: blue; 1 1 0 0 0 0 0
color: blue\9 1 1 1 0 0 0 0
html>body #box { color: blue } 0 1 1 1 1 1  
color: blue; 1 1 1 1 1 1 1

Selector hacks

Red if * html matches in this browser
Red if *:first-child+html matches in this browser
Red if html>body matches in this browser
Red if html>/**/body matches in this browser
Red if html:first-child matches in this browser
Red if html[xmlns*=""] body:last-child matches in this browser
Red if body:nth-of-type(1) matches in this browser
Red if div:nth-of-type(1n) matches in this browser
Red if body:first-of-type matches in this browser
Red if @media screen and (-webkit-min-device-pixel-ratio:0) matches in this browser
Red if html[xmlns*=""]:root matches in this browser
Red if *|html[xmlns*=""] matches in this browser
Red if :root *> matches in this browser
Red if *+html matches in this browser
Red if * > matches in this browser
Red if html:only-child matches in this browser
Red if @media all and (min-width: 0px) matches in this browser
Red if html:lang(en)>body matches in this browser
Red if body:nth-of-type(1) matches in this browser
Red if x:-moz-any-link matches in this browser
Red if x:-moz-any-link, x:default matches in this browser

Attribute hacks

Blue if div { _background: blue} matches in this browser
Blue if div { *background: blue} matches in this browser
Blue if div { .background: blue} matches in this browser
Blue if div { background/**/: blue} matches in this browser
Blue if div { background: blue\9;} matches in this browser
Blue if div { background/*\**/: blue\9;} matches in this browser
Blue if div { background: blue !ie;} matches in this browser

I hope you found this information helpful and please don’t mind to include any if I left with your valuable feedback, Thanks!!

My first team outing in Wipro

April 10th, 2010

For me the fun started @ 7:30hrs itself, thinking that the bus from Madhapur(Where Wipro has its main office in Hyderabad) starts sharp at 8:30hrs(as the mail says) to the resort, I got up very early than my usual days packed my things(camera, mobile, iPod, wallet, a towel and a swimsuite) in my handbag, took an auto, started from my place at 8:20hrs. Unfortunately the auto that I boarded was caught by the traffic cop immediately after 5 mins of my hurry journey, as the auto driver voilated traffic rule. Cop: Driver, pay the fine. Autowala: Chodo, Sahab.. subah hai na, paise nahin hai. Cop: Nope, you pay and then leave. The argument continued, 8:30hrs, I decided that I would miss the bus so I called my friend and asked him to pick and drop me at my office. By the time he came and dropped me its 8:45hrs. To my surprise I couldnt find the bus outside the campus so I thought the bus has gone and thought of returning home back but thought for a minute and went inside the office to check some one of my kind. To my horrification I could only see only a few of my team mates when I asked them they said the bus is yet to come, then I slowly smiled in my self that its India and we are Indians… :-)

Finally the bus came and we started @ 10:00hrs… Some camera fathoms, Songs, all the way on our way, on the highway the bus took 3 long ‘U’ turns, finding out why? revealed, that the driver misssed the route. somehow we were on the right track just after a few minutes the passing by trees, houses, electric poles, pan shops stopped by. reason – a little accident, dono how? but when peeped outside the window we could find the 7 seeter auto got hooked to the bus (as if an iron sticks to the magnet). 30 minutes — we moved further after giving Rs.500/- to the auto driver. Slowly by 11:15hrs Hurray!! we could make it.


minor accident

minor accident

on the highway

on the highway

Anth-Akshari

Anth-Akshari


Click! Click!! Nice Shot!! Smile Please!! WOW!! Hmm… Good one!! Nice Fishes!! Ok, chalo lets start the fun… Ravi, please catch up a song… cheers, Click! Click! good attempt. Kranthi, how about… sure… Click! Click! great… big applause!! Sneha:Click!, Ganesh:Click! X, Y, Z

OK, Lets dumbsherads… Old or New? Hindi/English/Telugu? Two words or one word? Hero based or Heroien based? main persona?… any rape seen? blah. blah.. blah… ;-)

Hungry Kya? A BIG YES!! Ok everybody note that all has to come to the same place after having food. Sarey padandi… atu kaadhu itu.. Click! Click!! aaa akkadey, Hey!! itu chudu, ikkada baaguntundhi.. malli Click! Click!! ok enuff.. welcome sir! Give coupon – Take plate – F.O.O.D – Eat – Drink – Ho gaya, chalo lets go back to tents…

Click! Click!! Chandra and Bharat enounces – Guys, now we have some slips/chits to pick up and you have to perform the same what you get on the slips. Romeo Rajesh – grumbles, nope!! I cant… ok atleast walk like a girl. Sneha – Black Love Proposal to Chava – Good job!! Applause. Srini – Mirror makeup – Thats Excellent!! Chandra – Bruslee(the other side of him :-) ) Kranthi – Excellent!! Sumaiha – Nope! I cant, ok another one – no not again – Ok.. bulb+tap+shoe polish – huh!! Poornima – Fainted for singing a song. Ravi – hmm… Rajkumar – good… Chava – OranGe – esp the ‘G’ – Awesome. big applause. X, Y, Z. Any volunteer?

Tug-of-War: Here, there, here, there – Heyyyyyyyyyyyy, won. Chalo, aur do keelengey(best of three) 2. Cheating Cheating. 3.Waow!! we won. we did it. yes, see I even spill blood. Abbaa… evado na kaalu tokkesadu… ayyo… ammaa…

ok packup – Let’s pool… Gents here, Ladies there – custumes on – Jump. Ammo naaku eetha raadhu, I’ll do it here. Balls, Flying disks, water polo… 16:30, 17:30, 18:30 – whistle – ok dressup… Have Tea, Click! Click!! Samosa, Bajji 19:30hrs – Click! Click!! Chandra How about a group photo? but? no problem. ok. Click! Click!! Done

Bye! Bye!! for Total – X = y heads

The rest into the bus – 45, 23, 78, dot vundha? aithey 6, 11 – Hey Jaldi 5… Wow!! Housiee

Anybody @ Kottapeta? Madhapur? Ok, bye! See you on Monday!!

Thanks dude for your lift. See ya on Monday!!

Photo Gallery


Chandra

Chandra

well... hmm...

well... hmm...

Lord Ganesha

Lord Ganesha

Ravi - performing DS

Ravi - performing DS

Alhad - Lunch disappointed

Alhad - Lunch disappointed

@ Lunch

@ Lunch

Manager, Uthuthi Bank

Manager, Uthuthi Bank


Raj captured

Raj captured

a croc

a croc

team watching crocodiles

team watching crocodiles

the Foto guys

the Foto guys

boyz

boyz

in the sunskimo

in the sunskimo

a casual click!

a casual click!

Definetly Male team

Definetly Male team

VLCC team - Winners

VLCC team - Winners

gals posing to the camera

gals posing to the camera

Chava being so eco-friendly

Chava being so eco-friendly

drinking rasna @ entrance

drinking rasna @ entrance

at the entrance

at the entrance

The 30% Team

The 30% Team

Tires Chava

Tires Chava

still active Shiva

still active Shiva

BOND - 000

BOND - 000

Mega Bond - 000

Mega Bond - 000

Beautiful Roses

Beautiful Roses

gals posing to camera

gals posing to camera


Video Gallery

U/UI/UX Engineering Interview Questions

March 15th, 2010

01. What is Usability?

The extent to which a product can be used by specified users to achieve specified goals in a specified context with effectiveness, efficiency and satisfaction.

The simplest definition would be: The shortest time taken to accomplish the task with ease.


02. What does usability measure? or What are components of usability? or What are usability factors?

a. Ease of Learning.
b. Efficiency of use.
c. Memorability.
d. Error frequency.
e. Subjective satisfaction.


03. What is a User-Centered Design(UCD)?

UCD is an approach for employing usability.
It is a structured product development methodology that involves users throughout all stages of web site development considering business objective, user needs, limitations and preferences.


04. What is UCD process?

a. Plan your site.
b. Collecting data from users.
c. Developing prototypes.
d. Writing content.
e.Conducting usability testing with users.


What is Card-Sorting?

Card sorting is a user-centered design method for increasing a system’s findability. The process involves sorting a series of cards, each labeled with a piece of content or functionality, into groups that make sense to users or participants.

Open Card Sorting: Participants are given cards showing site content with no pre-established groupings. They are asked to sort cards into groups that they feel are appropriate and then describe each group. Open card sorting is useful as input to information structures in new or existing sites and products.

Closed Card Sorting: Participants are given cards showing site content with an established initial set of primary groups. Participants are asked to place cards into these pre-established primary groups. Closed card sorting is useful when adding new content to an existing structure, or for gaining additional feedback after an open card sort.


Advantages and disadvantages of Card-Sorting methods?

Advantages – Simple, Cheap, Quick to execute, Established, Involves users, Provides a good foundation.

Disadvantages – Does not consider users’ tasks, Results may vary, Analysis can be time consuming, May capture “surface” characteristics only.


When should card sorting be used?

It should be used as an input to:

a. designing a new site

b. designing a new area of a site

c. redesigning a site

Card sorting is not an evaluation technique and will not tell you what is wrong with your current site.


How to avoid paying taxes on interest income?

March 3rd, 2010

Do you wonder why interest earned from your FDs or interest bearing securities like bonds gets reduced due to tax deducted at source?

Does it irritate you that tax has been charged even though you aren’t eligible to pay taxes? Here, we tell you about why TDS applied and ways to avoid this tax deduction if you meet certain criteria.

Why should I know this?

If you are like most Indians, chances are the bulk of your liquid savings are in a bank account or in an FD. Some of us are invested in bonds. While these fixed income instruments are good for guaranteed returns, they are relatively tax inefficient instruments because you end up paying taxes on the interest income that you earn.

This tax is usually deducted at source, and there might be a situation where tax is being deducted even though you are not eligible for paying taxes. This could result in a cash flow problem because your tax outflow is today, but your refund might take many months to arrive.

How much is the TDS on interest from deposits and securities?

The tax on interest income is deducted at source, i.e., at the bank where you hold your deposit, or from the issuer of the bond who pays you interest. The rate of this TDS is a flat 10% if your interest income exceeds a certain limit. Unlike salary income where TDS is according to your tax slab, the TDS on your interest income is irrespective of the tax slab applicable to you.

Type of Interest Income Section of the Income Tax Act Rate of TDS
(Applicable for Individuals and HUF)
Interest Income Limit after which TDS occurs (in Rs.)

Interest on Securities

193

10%

Rs. 2,500

Interest other than interest on Securities. For example, interest on FDs

194A

10%

Rs. 10,000 if paid by banks and co-operative societies

Rs. 5,000 if paid by others

Lets understand the above by way of an example. Radha, a 27-year-old woman, is employed and also has an FD at a bank. The following is her income and taxability situation.

Salary income: Rs. 1.40 lakhs per annum
FD interest income: Rs. 30,000 per annum
Statutory exemption limit for women: Rs. 1.90 lakhs annually

As Radha earns more than Rs. 10,000, she will be liable to a tax deduction at source. However, as we can see, Radha’s total income (salary + interest income) is below the annual exemption of Rs. 1.90 lakhs available to women. Nevertheless, taxes will be deducted from her interest income at the bank where she holds her FD.

As you can imagine, this can cause some cashflow problems for Radha if she is going to get lesser cash in hand, even though she should never have been taxed on the interest.

How can I avoid undue deduction from interest income?

If your analysis shows that your total income is below the taxable slab, then there are provisions in the Income Tax Act under which you legally avoid having tax deducted from your interest earned on your FDs and bonds.

You will need to furnish a declaration using the prescribed form to the bank or entity responsible for deducting tax. This declaration needs to state that no tax deduction is required because the income level does not fall into the taxable slab.

What are these prescribed forms?

Different forms are used for different sources of income and types of taxpayers.

Form 15G: Applicable for a resident individual, other than a senior citizen

Form 15H: Applicable for a senior citizen (These forms can be downloaded online)

What incomes can be declared in the above forms?

The declaration in Forms 15G and 15H can be furnished mainly if the taxpayer has income from:

Interest on securities

Interest other than interest on securities, like FDs

What should I take care of while using these forms?

1. The declaration should be filed only if tax on total estimated income for the relevant year is nil.

2. Delivery of the form to the entity deducting your TDS must be made any time before receiving the income either directly or by credit to the account.

3. The entity to whom the declaration is given must file one copy of the declaration with Commissioner Income Tax before 7th day of the next month.
4. A false declaration is liable to prosecution and fine.