- Object cloning
- Inheritance
- Interfaces
- Abstract classes
- Namespaces
- 4:31:00 PM
- Achappan Mahalingam
- No comments
- 3:07:00 PM
- Achappan Mahalingam
- No comments
1. Which of the following is NOT a valid
border-style
property value?dotted
inset
glazed
groove
solid
glazed
2. Which of the following is NOT a valid CSS length unit?
cm
dm
em
mm
Ans: dm
cm
and mm
are absolute length units. em
is a font-relative length.3. What is the CSS selector which allows you to target every element in a web page?
Ans: The universal selector (
*
).4. Which CSS property allows you to hide an element but still maintain the space it occupies in the web page?
Ans:
visibility
or opacity
There are several ways to hide an HTML element with CSS.
Setting the
visibility
property of the element to hidden
will hide the element. The element will still occupy space equal to its
geometric size in the web page. For example, if the hidden element’s
dimensions are 100x100px, you will see an empty 100x100px space in the
area where the element is located. Hiding an element can also be
accomplished by assigning opacity: 0
to an element.Hiding an element without maintaining the space it occupies in the web page can be done by setting the element’s
display
property to none
. Setting display
to none
renders the element as though it doesn’t exist.
5. There are 16 basic color keywords in CSS. Which of the following are NOT basic color keywords?
olive
fuchsia
cyan
aqua
maroon
cyan
cyan
is a valid color keyword. But it’s not one of the basic color keywords.6. The
font-style
CSS property has four different valid values. Three of these values are inherit
, normal
, and italic.
What is one other valid value?Ans:
oblique
7. Which of the following two selectors has a higher CSS specificity?
Selector 1:
#object h2::first-letter
Selector 2:body .item div h2::first-letter:hover
Ans:
Selector 1:#object h2:first-letter
The specificity value of Selector 1 is 102. The specificity value of Selector 2 is 24.
8. What is the ideal order of the following pseudo-class selectors in a stylesheet?
:active
:hover
:link
:visited
:link
:visited
:hover
:active
9. Which of the following CSS properties DOES NOT influence the box model?
content
padding
margin
outline
border
outline
The outline created with the outline properties is drawn “over” a box, i.e., the outline is always on top, and does not influence the position or size of the box, or of any other boxes. Therefore, displaying or suppressing outlines does not cause reflow or overflow.
10. When using media queries, which of the following is NOT a valid media type?
tv
all
voice
print
braille
tty
embossed
voice
voice
is not a valid media type. Though there is a speech
media type.
11. There are five generic font family values that can be assigned to the
font-family
property. Three of them are listed below. What are the other two generic font family values? serif
sans-serif
monospace
- ?
- ?
cursive
fantasy
12. What is the color keyword that will always be equal to the calculated
color
property value of the selected element/elements?Ans:
currentColor
Below is an example where the
background-color
and the border
color will be equal to the color property value of .box
elements:.box {
color: green;
background-color: currentColor;
border: 1px dashed currentColor;
}
The benefit of using the currentColor
keyword is that we only need to change the color value in one place. We can just change the value of the color
property, and the change will cascade to the other properties. This keyword works much the same way as CSS variables.13. Which of the following is NOT a valid CSS unit?
ch
turn
px
ems
dpcm
s
hz
rem
ems
ch
andrem
are font-relative length units.turn
is an angle unit.px
is an absolute length unit.dpcm
is a resolution unit.s
is a time unit.hz
is a frequency unit.
14. Which of the following color keywords has NOT yet been proposed in a W3C specification?
blanchedalmond
dodgerblue
peachpuff
orchidblack
navajowhite
tomato
orchidblack
15. What is the CSS at-rule that can allow you to define the character encoding of a stylesheet?
Ans:
@charset
UTF-8 should always be used as your CSS file’s character encoding. If this is the case, then you don’t need to declare a
@charset
rule.- 2:27:00 PM
- Achappan Mahalingam
- No comments
In JQuery, this activity is called as chaining which means you can chain together actions/methods. Below snippet is the example of Jquery Chaining.
<script>
$(document).ready(function(){
$("button").click(function(){
$("#p1").css("color", "red").slideUp(2000).slideDown(2000);
});
});
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#p1").css("color", "red").slideUp(2000).slideDown(2000);
});
});
</script>
- 2:23:00 PM
- Achappan Mahalingam
- No comments
JavaScript statements are executed line by line. However, with effects,
the next line of code can be run even though the effect is not finished. This will cause to trigger the errors.
To prevent this, you can create a callback function.
A callback function is executed after the current effect is finished.
With Callback function:
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").hide("slow", function(){
alert("The paragraph is now hidden");
});
});
});
</script>
Without Callback function:
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").hide(1000);
alert("The paragraph is now hidden");
});
});
</script>
The difference between these two function is without callback function will throw the alert box before the hide event is finished.
To prevent this, you can create a callback function.
A callback function is executed after the current effect is finished.
With Callback function:
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").hide("slow", function(){
alert("The paragraph is now hidden");
});
});
});
</script>
Without Callback function:
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").hide(1000);
alert("The paragraph is now hidden");
});
});
</script>
The difference between these two function is without callback function will throw the alert box before the hide event is finished.
- 2:56:00 PM
- Achappan Mahalingam
- No comments
jQuery selectors are used to "find" (or select) HTML elements based
on their id, classes, types, attributes, values of attributes and much
more.
All selectors in jQuery start with the dollar sign and parentheses: $().
The jQuery element selector selects elements based on the element name.
You can select all <p> elements on a page like this:
The jQuery #id selector uses the id attribute of an HTML tag to find the specific element.
An id should be unique within a page, so you should use the #id selector when you want to find a single, unique element.
To find an element with a specific id, write a hash character, followed by the id of the HTML element:
All selectors in jQuery start with the dollar sign and parentheses: $().
The jQuery element selector selects elements based on the element name.
You can select all <p> elements on a page like this:
$("p")
An id should be unique within a page, so you should use the #id selector when you want to find a single, unique element.
To find an element with a specific id, write a hash character, followed by the id of the HTML element:
$("#test")
Syntax | Description | |
---|---|---|
$("*") | Selects all elements | |
$(this) | Selects the current HTML element | |
$("p.intro") | Selects all <p> elements with class="intro" | |
$("p:first") | Selects the first <p> element | |
$("ul li:first") | Selects the first <li> element of the first <ul> | |
$("ul li:first-child") | Selects the first <li> element of every <ul> | |
$("[href]") | Selects all elements with an href attribute | |
$("a[target='_blank']") | Selects all <a> elements with a target attribute value equal to "_blank" | |
$("a[target!='_blank']") | Selects all <a> elements with a target attribute value NOT equal to "_blank" | |
$(":button") | Selects all <button> elements and <input> elements of type="button" | |
$("tr:even") | Selects all even <tr> elements | |
$("tr:odd") | Selects all odd <tr> elements |
- 2:50:00 PM
- Achappan Mahalingam
- No comments
This is used to restrict any jQuery code from running before the document is finished loading or document is ready.
It is good practice to wait for the document to be fully loaded and ready before working with it.
This also allows you to have your JavaScript code before the body of your document, in the head section.
Here are some examples of actions that can fail if methods are run before the document is fully loaded:
Alternate Syntax instead of using document ready event
$(function(){
// jQuery methods go here...
});
It is good practice to wait for the document to be fully loaded and ready before working with it.
This also allows you to have your JavaScript code before the body of your document, in the head section.
Here are some examples of actions that can fail if methods are run before the document is fully loaded:
- Trying to hide an element that is not created yet
- Trying to get the size of an image that is not loaded yet
Alternate Syntax instead of using document ready event
$(function(){
// jQuery methods go here...
});
- 2:34:00 PM
- Achappan Mahalingam
- No comments
Our actual question is why we do not need to have type="text/javascript" inside the <script> tag in HTML5?
Ans: This is not required in HTML5 because javascript is the default scripting language in HTML5 and in all modern browsers!
Ans: This is not required in HTML5 because javascript is the default scripting language in HTML5 and in all modern browsers!
- 2:52:00 PM
- Achappan Mahalingam
- No comments
Yesterday I got a chance to write sample build.xml for one of my colleague. He has default build.xml for his project which is written by someone based on random directories (similar to war directory structure). This build.xml is used to pack the directory sturctures and place it into the tomcat server webapp directory. In this type scenario he did not able to debugging his application from eclipse.
I advised them to create one more build.xml based on eclipse directory structure for production or uat deployment. For development purpose try to setup a tomcat server and debugging your application in eclipse without worrying about deployment. I provided that sample build.xml below. Please look it and provide your comments.
<?xml version="1.0" encoding="UTF-8"?>
<project name = "tems" basedir = "." default = "war">
<property name="project-name" value="${ant.project.name}" />
<property name="builder" value="Achappan Mahalingam" />
<property name="war-file-name" value="${project-name}.war" />
<property name="source-directory" value="src" />
<property name="classes-directory" value="build/classes" />
<property name="web-directory" value="WebContent" />
<property name="web-xml-file" value="WebContent/WEB-INF/web.xml" />
<property name="libs-directory" value="WebContent/WEB-INF/lib" />
<property name="build-directory" value="build" />
<target name = "info">
<echo message = ""/>
<echo message = "${project-name} Build File"/>
<echo message = "-----------------------------------"/>
<echo message = "Run by ${builder}"/>
</target>
<target name="war" depends="info">
<mkdir dir="${build-directory}" />
<delete file="${build-directory}/${war-file-name}" />
<war warfile="${build-directory}/${war-file-name}" webxml="${web-xml-file}">
<classes dir="${classes-directory}" />
<fileset dir="${web-directory}">
<exclude name="WEB-INF/web.xml" />
</fileset>
</war>
</target>
</project>
I advised them to create one more build.xml based on eclipse directory structure for production or uat deployment. For development purpose try to setup a tomcat server and debugging your application in eclipse without worrying about deployment. I provided that sample build.xml below. Please look it and provide your comments.
<?xml version="1.0" encoding="UTF-8"?>
<project name = "tems" basedir = "." default = "war">
<property name="project-name" value="${ant.project.name}" />
<property name="builder" value="Achappan Mahalingam" />
<property name="war-file-name" value="${project-name}.war" />
<property name="source-directory" value="src" />
<property name="classes-directory" value="build/classes" />
<property name="web-directory" value="WebContent" />
<property name="web-xml-file" value="WebContent/WEB-INF/web.xml" />
<property name="libs-directory" value="WebContent/WEB-INF/lib" />
<property name="build-directory" value="build" />
<target name = "info">
<echo message = ""/>
<echo message = "${project-name} Build File"/>
<echo message = "-----------------------------------"/>
<echo message = "Run by ${builder}"/>
</target>
<target name="war" depends="info">
<mkdir dir="${build-directory}" />
<delete file="${build-directory}/${war-file-name}" />
<war warfile="${build-directory}/${war-file-name}" webxml="${web-xml-file}">
<classes dir="${classes-directory}" />
<fileset dir="${web-directory}">
<exclude name="WEB-INF/web.xml" />
</fileset>
</war>
</target>
</project>
- 1:48:00 AM
- Achappan Mahalingam
- No comments
By using ob_start(), the page and headers aren't sent to the browser until they've loaded completely, or until we call ob_end_flush().
- 1:42:00 AM
- Achappan Mahalingam
- No comments
Wow! I got this error when i am creating a below table with FULLTEXT indices. The reason for this exception is "Full-Text Search is supported only with MyISAM Engine before MySQL version 5.6"
CREATE TABLE comment
(
commentid int unsigned NOT NULL AUTO_INCREMENT,
userid int unsigned NOT NULL,
comment text NOT NULL,
PRIMARY KEY (commentid),
FULLTEXT KEY comment (comment)
) ;
Solution:
You specify MyISAM engine at end of the table creation.
CREATE TABLE comment
(
commentid int unsigned NOT NULL AUTO_INCREMENT,
userid int unsigned NOT NULL,
comment text NOT NULL,
PRIMARY KEY (commentid),
FULLTEXT KEY comment (comment)
) ENGINE=MyISAM;
CREATE TABLE comment
(
commentid int unsigned NOT NULL AUTO_INCREMENT,
userid int unsigned NOT NULL,
comment text NOT NULL,
PRIMARY KEY (commentid),
FULLTEXT KEY comment (comment)
) ;
Solution:
You specify MyISAM engine at end of the table creation.
CREATE TABLE comment
(
commentid int unsigned NOT NULL AUTO_INCREMENT,
userid int unsigned NOT NULL,
comment text NOT NULL,
PRIMARY KEY (commentid),
FULLTEXT KEY comment (comment)
) ENGINE=MyISAM;
Subscribe to:
Posts (Atom)