2010-05-23


general keyboard shortcuts for photoshop

here i’ll share photoshop keyboard shortcuts, that will increase your working speed on photoshop.

Gradiants —————————————- shft+g

New layer ————————————— Ctl+shft+n

New document ———————————- Ctl+n

Delete Layer (Group) ————— ————— Ctrl+Shift+ -
Delete Layer (Group) (no dialog) —————– Ctrl+Alt+Shift+ -
Duplicate Layer (Group) —————————– Ctrl+Shift+Q
Duplicate Layer (no dialog) ————————- Ctrl+Alt+Shift+Q
Flatten Image ——————————————– Ctrl+Alt+Shift+0
Group into New Smart Object ———————- Ctrl+Alt+Shift+H
Merge Layers —————————————— Ctrl+E
Merge Visible —————————————— Ctrl+Shift+E
New Layer ——————————————— Ctrl+Shift+N
New Layer (no dialog) ——————————– Ctrl+Alt+Shift+N

Duplicate ———————————— Ctrl+Shift+A
Duplicate (no dialog) ——————— Ctrl+Alt+Shift+A
Hue / Saturation —————————- Ctrl+U
Hue / Saturation (last settings) ——- Ctrl+Alt+U
Image Size ———————————– Ctrl+Alt+I
Invert —————————————– Ctrl+ I
Levels —————————————– Ctrl+L
Levels (last settings) ——————— Ctrl+Alt+L
Reveal All ———————————– Ctrl+Alt+R
Rotate Arbitrary —————————- Ctrl+Alt+Shift+R
Trim ——————————————- Ctrl+Alt+Y

Path / Direct Selection Tool ————- ————– A
N Brush / Pencil / Color Replacement Tool ——— B
Crop Tool ————————————————- C
Default Colors ——————————————– D
Eraser Tool ————————————————- E
Cycle Screen Modes ————————————– F
Gradient / Paint Bucket Tool ————————— G
Hand Tool —————————————————- H
Eyedropper / Sampler / Measure Tool —————- I
N Spot Healing / Healing / Patch / Red Eye ———- J
Slice Tool —————————————————– K
Lasso Tool ————————————————— L
Marquee Tool ——————————————— M
Notes / Audio Annotation Tool ————————- N
Dodge / Burn / Sponge Tool —————————- O
Pen / Freeform Pen Tool ——————————– P
Standard / Quick Mask Mode ————————– Q
Blur / Sharpen / Smudge Tool ————————– R
Clone / Pattern Stamp Tool SShape Tool ———– U
Move Tool —————————————————— V
Magic Wand Tool —————————————— W
Switch Colors ———————————————– X
History / Art History Brush Tool ———————— Y
Zoom Tool ————————————————— Z
Hand Tool (toggle) —————————————— Space
Zoom In (toggle) —————————————— Ctrl+Space
Zoom Out (toggle) —————————————– Alt+Space

2010-05-23


conditional comments in html

Conditions can be applied in html

The syntax for conditional comments is as follows:

Positive

<!--[if condition]> HTML <![endif]-->


Negative
<!–[if !condition]><![IGNORE[--><![IGNORE[]]> HTML <!–<![endif]–>

condition is one of the following:

IE
    Any version of IE
lt IE version
    Versions less than version
lte IE version
    Versions less than or equal to version
IE version
    Only version version
gte IE version
    Versions greater than or equal to version
gt IE version
    Versions greater than version

version is the version of Internet Explorer, typically 5, 5.5, 6, or 7

HTML is the HTML to be included if the condition does or doesn’t match, depending on the type of conditional comment. When included, the HTML is placed right where the conditional comment is in the source.

For negative conditions,
<![IGNORE[--><![IGNORE[]]> can be replaced with –> if the condition is simply IE. The longer version is only needed when Internet Explorer might parse the contents.

The <![IGNORE[ ... ]]> directive is not available in XML, so it is illegal to use it in XHTML. A solution would be to split it up into two special conditional comments:
<!–[if !condition]> XHTML <![endif]–> <!–[if !IE]>–> XHTML <!–<![endif]–> where XHTML is the same both places. Note that Internet Explorer 7 and below don’t yet recognize XHTML as a form of XML, so this is merely forward-looking.

2010-05-23

html tags for formatting text

Html provides tags for all needs to format your text on the page. Using all the tags properly certainly helps in improving you site ranking and it is also useful for you search engine optimization.

Here i’m writing all the valid html tags that can be used to format your text properly.

These all the valid html tags and are not deprecated at this time.
Valid Tags

From this <abbr>

You get this


Denotes an abbreviation, use the title attribute to give the full meaning.
[html4] — not yet fully supported

From this <acronym>

You get this


Much the same as the one above, really. The difference is between abbreviations and acronyms. And you can look that up yourself.
[html4] — not yet fully supported

From this <address >

You get this


You’re supposed to put this around your name, address or email address on your pages. Pff.

From this <b>

You get this


The simple bold tag.

From this <bdo dir=”rtl” > </bdo>

You get this


If your text is meant to be read right-to-left (like Hebrew, or something), using this tag and the attribute dir=”rtl” tells the browser this.
[html4] — not yet fully supported

From this <big>

You get this


A quick way to increase the font size by one.

From this <blockquote>

You get this

Indents the whole block of text in from both sides and adds line-breaks top and bottom. Use for long quotations.

From this <cite>

You get this


Shows a citation (the title of a work that you’re quoting or referencing).

From this <code>
You get this
Sets text off as code, used for examples of source code. Usually rendered as mono-spaced text.

From this <del>

You get this


Stands for deleted text, and visually appears with a strike-through.
[html4]

From this <dfn>

You get this


Denotes a definition.
[html4] — not yet fully supported

From this <em>

You get this


Creates emphasis on the selected text.

From this <h4>

You get this


Creates headings. There are 6 levels of heading, from h1 to h6.

From this <i>

You get this


The basic italic tag.

From this <ins>

You get this


Stands for inserted text. You are meant to use this in conjunction with the del tag.
[html4]

From this <kbd>

You get this


Surrounds text that is supposed to be entered by the reader on their keyboard.

From this <pre>

You get this

Stands for Preformatted text. If you wrap this around some text, it will follow the form of the text in your code — i.e. no extra formatting needs to be put in. If you have spaced it out in your code, it will appear spaced out on your page.
[html4]

From this <q>

You get this


Used for smaller, inline quotations (as opposed to a blockquote). Adds quotation marks around the text. Cool.
[html4] — not yet fully supported

From this <samp>

You get this


Stands for sample, and is used when you’re using an example, usually of an output from a program.

From this <small>

You get this


Simple tag to drop the font size by one.

From this <strong>

You get this


Makes the text bold.

From this <sub>

You get this


Renders the text in sub-script, below the normal line.

From this <sup>

You get this


Renders the text in super-script, above the normal line.

From this <tt>

You get this


Makes the text ‘typewriter text’, and sets it in a mono-spaced font.

From this <var>

You get this


Used to denote variables in equations.

2010-05-13


HTML form validations on submission of form using javascript

To interact with user, html forms are good method. they are used to take information from user. Various type of data can be taken from user. To get the data in correct desired format, webmaster have to check all the data filled by user. If any error found then user will be redirected to form with an error message. But checking data on server is a long and slow process.

It would be better if we can check the data entered by user in browser. It will save request time on server. Data entered by user can be validated by using javascript. There can be many type of algorithms from simple to complex for form validations. I’m presenting here overview of the possible methods for form validations.

In javascripts every process starts with some event. any activity in html triggers an event. Submitting a form, clicking on button, changing value of input elements will all trigger an event. so we can start js process on any of these events.

For validating a form either we can user value change in input element or we can use form submit event.


1. validation on value change of input element


A javascript can be attached to all the input elements which are to be validated. Suppose we’ve a text box where we need to get user’s email id. So we can write the code like this

here onchange is a javascript function which will be called when value of element, where it is attached changes. So whenever value of input box changes and user removes focus from input box function “validateEmail” will be called. “this” argument is passed in validateEmail function. “this” is an object of the input box and with this all the properties of text box can be accessed. “validateEmail” will be something like this :


If we use this method for validations then user have to enter correct value to proceed next, once he entered in the specified input box. It is a vary tedious method for validations. we have to write a new function for every new field to be verified. and we have to write validation code on each html form where we want validations.


2. Validation on form submit event


This method is much better then previous one. Here many algorithms can be applied to make code reusable and to make javascript unobtrusive. This method is used to make a generalized code for form data validations. Here javascript validation process will be triggered on form submit event, means when user finally presses submit button.
Process can be attached in this way :

function “validateForm” will be something like this:

This code is very easy to use and manage. Just you have to put this code on bottom of any html file where you want validations. But you have to change input fields name according to where you uses it.
This code is much better then first method, but still not so good. it is not perfectly reusable code, and it is not a generalized code also it is not unobtrusive.

Generalized form validation algorithm

If we can free above “validateForm” function from field name and what to validate in form, then this function would become a generalized code. That means we need some intutive way to know that what to validate in input fields and which input fields are to be validated. in “validateForm” function we can fetch all the properties of all the input fields in the form we are validating. So, we need there be some property of input fields by which function can know how to validate this field. For this we should be able to add properties to input’s that can tell us to validate fields. so, we can add these properties in fields like this :


Now these properties can be accessed and fields can be validated according to that. So, now “validateForm” function becomes a generalized code and can be used anywhere.
But this method won’t work in all the browsers. some browsers do not allow such properties to be attached and accessed in input fields.
Another better way is to add “classes” to the fields that can insist function how to validate any input field. “class” property will work in all the browsers and more then one classes can be added. Class property of any input field can be easily accessed.
Class property of any input can be get by this :

input.className


If multiple classes are attached then this classname can be split using regular expression and then all parts can be get easily.
Now function can easily find what to validate in input filed.
class names can be intutive like:

jsfv_blank, jsfv_email, jsfv_date, jsfv_num, jsfv_0

here “jsfv_” prefix is added to make it unique, also it stands for
“javascript form validatoin”

Now our code becomes fully reusable and generalized code.