Adsense

Drupal interview questions

1)what is views
2)what is regions. how to create regions in drupal
3)how to create themes in drupal
4)What are the performance techniques or cache techniqes to reduce the page load time/response time.
5)what is hooks, and learn some hooks.
6)how to create module.
--------------------

How to install drupal ?
what is the drupalvresion we have to install ?
Whatis thediff between page.tpl.php and page-front.tpl.php?
How to change the themefor page which have node id= 100? 
List out the steps involved assigning one blockin "topleft" region ?
How to set node/10 as home page?
Write a module to have form (just 2 fields) and theme the form?
How to assign permission for menu ?
What are the menu types available ?
What is the use of t() ?
Explain about base_path() & path_to_theme()?
What will happen if page call back is not defined ?
Which function can be used to redirect ?
What is the use of system table ?
What are the tables which get updated while creating a new node?

Indian Railways Accepts Virtual Reservation Message; No Printouts Needed




From now it is not mandatory to carry printed Electronic Reservation Slip (ERS) in train journey.


IRCTC has officially announced that a snapshot of e-ticket can be showed during the inquiry.


The snapshot of e-ticket is called Virtual Reservation Message(VRM),the screenshot of ticket can be showed in any of the electronic gadgets like Laptops/Mobile phones/Tablets/Palm tops etc...


Along with VRM, You should show the original photo-ID proof to authenticate you as owner of the ticket.


So from now you can carry ERS/VRM and a valid photo ID proof in train journey.

Here is the official message from IRCTC

How to change WordPress default FROM email address

Simply paste the following snippet into your functions.php file. Don't forget to put the desired email adress on line 5 and desired name on line 8.

add_filter('wp_mail_from', 'new_mail_from');
add_filter('wp_mail_from_name', 'new_mail_from_name');

function new_mail_from($old) {
 return 'admin@yourdomain.com';
}
function new_mail_from_name($old) {
 return 'Your Blog Name';
}

Premium WordPress Plugins

Query or show a specific post in wordpress


If you are looking for php code or a plugin for your WordPress that takes a post ID and returns the database record for that post then read on. This is very helpful when you want to show a specific post on your homepage or other pages to get more attention. It allows you to design your homepage or a page with the post(s) that you want to be shown on the page rather than the 10 recent posts that the WordPress automatically chooses for you.

PHP Code Example to Query a WordPress Post

Example 1

The following code will Query the post with post id 26 and Show the title and the content.

<?php
$post_id = 26;
$queried_post = get_post($post_id);
$title = $queried_post->post_title;
echo $title;
echo $queried_post->post_content;
?>

Example 2

The following style could be more useful as it lets the user customise the font easily.

<?php
$post_id = 26;
$queried_post = get_post($post_id);
?>
<h2><?php echo $queried_post->post_title; ?></h2>
<?php echo $queried_post->post_content; ?>

Example 3

Using an Array… The following code will query every post number in ‘thePostIdArray’ and show the title of those posts.

<?php $thePostIdArray = array("28","74", "82", "92"); ?>
<?php $limit = 4 ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); $counter++; ?>
<?php if ( $counter < $limit + 1 ): ?>
<div class="post" id="post-<?php the_ID(); ?>">
<?php $post_id = $thePostIdArray[$counter-1]; ?>
<?php $queried_post = get_post($post_id); ?>
<h2><?php echo $queried_post->post_title; ?></h2>
</div>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>

How to Display the Post Content Like WordPress

When you retrieve the post content from the database you get the unfiltered content. If you want to achieve the same output like WordPress does in its’ posts or pages then you need to apply filter to the content. You can use the following code:
<?php
$post_id = 26;
$queried_post = get_post($post_id);
$content = $queried_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);
echo $content;
?>

For a range of all the returned fields that you can use, check the WordPress site here.

Query X Number of Recent Posts

You can use the “wp_get_recent_posts” function to retrieve X number of recent posts and then display them however you want to. Here is an example:
<?php
//Query 5 recent published post in descending order
$args = array( 'numberposts' => '5', 'order' => 'DESC','post_status' => 'publish' );
$recent_posts = wp_get_recent_posts( $args );
//Now lets do something with these posts
foreach( $recent_posts as $recent )
{
    echo 'Post ID: '.$recent["ID"];
    echo 'Post URL: '.get_permalink($recent["ID"]);
    echo 'Post Title: '.$recent["post_title"];
    //Do whatever else you please with this WordPress post
}
?>
Using a Plugin to Query a Post
You can also use the Get-a-Post WordPress plugin to query a specific post.

JQuery Interview Questions


How can we apply css in odd childs of parent node using JQuery library.
$(”tr:odd”).css(”background-color”, “#bbbbff”);
How can we apply css in even childs of parent node using JQuery library.
$(”tr:even”).css(”background-color”, “#bbbbff”);
How can we apply css in last child of parent using JQuery library.
$(”tr:last”).css({backgroundColor: ‘yellow’, fontWeight: ‘bolder’});
How can we modify css class using JQuery library.
Suppose that Css class has following defination
.class
{
font-size:10px;
font-weight:normal;
color:#000000;
}
now we want to add border property on above class, so we should follow below code.
$(“.class”).css(“border”,”1px solid blue”);
Where $(“.class”) name of css class. Now .class will automatically add border property in his class definition.
How can we apply css in div element using JQuery library.
This is example to apply css on a div element which have id name myDivId.
$(”#myDivId “).css(”border”,”3px solid red”);
To apply css on all div elements use below code.$(“div”).css(“border”,”3px solid red”);
Where$(“div”) pointing all div elements in the page.For You need to use.$(”P”) on above code.
How can we submit a form by ajax using Jquery.
Please follow below code to submit a form by ajax using jquery
$(‘#formid).submit(function() {
$.ajax({
type: “POST”,
url: “back.php”,
data: “name=php&location=india”,
success: function(msg) {
alert( “Data Saved: ” + msg );
}
});
}
Where formid is the form ID.”POST” is the method by which you want to send data.You can also use “GET” method.”back.php” is the php file which you want to call.”name=php&location=india” This is values of control. success: function(msg){ alert (“Data Saved: ” + msg); } This is a success function, This will execute after success of you post.Often in Ajax back.php does not refresh because this is cached by browser. To avoid this issue add [cache: false,] in above code.Loads data synchronously. Blocks the browser while the requests is active. It is better to block user interaction by other means when synchronization is necessary.
To avoid this issue add [async: false,] in above code.
How can we get value of textbox in jquery.
Include jquery library in the head section of page. Then use below code.
$(“#id”).val();
jQuery(“#id”).val();
What is Jquery? How Jquery will work?
Jquery is lightweight javascript library file.
Jquery run in all browsers.
Jquery is client side scripting language.
Jquery browser depended framework.
Jquery developed by javascript.
Jquery combined with other library?
Jquery combined with other java script libraries like prototype, mootools that time Jquery coding will be conflict with other libraries.
So that time use this command for non -conflict jquery with other java script libraries.
jQuery.noConflict();


JavaScript interview questions and answers


1. Difference between window.onload and onDocumentReady?

The onload event does not fire until every last piece of the page is loaded, this includes css and images, which means there’s a huge delay before any code is executed.
That isnt what we want. We just want to wait until the DOM is loaded and is able to be manipulated. onDocumentReady allows the programmer to do that.

2. What is the difference between == and === ?

The == checks for value equality, but === checks for both type and value.

3. What does “1″+2+4 evaluate to? What about 5 + 4 + “3″?

Since 1 is a string, everything is a string, so the result is 124. In the second case, its 93.

4. What is the difference between undefined value and null value?

undefined means a variable has been declared but has not yet been assigned a value. On the other hand, null is an assignment value. It can be assigned to a variable as a representation of no value.
Also, undefined and null are two distinct types: undefined is a type itself (undefined) while null is an object.
Unassigned variables are initialized by JavaScript with a default value of undefined. JavaScript never sets a value to null. That must be done programmatically.

5. How do you change the style/class on any element?

document.getElementById(“myText”).style.fontSize = “20″;
-or-
document.getElementById(“myText”).className = “anyclass”;

6. What are Javascript closures?When would you use them?

Two one sentence summaries:

* a closure is the local variables for a function – kept alive after the function has returned, or
* a closure is a stack-frame which is not deallocated when the function returns.

A closure takes place when a function creates an environment that binds local variables to it in such a way that they are kept alive after the function has returned. A closure is a special kind of object that combines two things: a function, and any local variables that were in-scope at the time that the closure was created.

The following code returns a reference to a function:

function sayHello2(name) {
var text = ‘Hello ‘ + name; // local variable
var sayAlert = function() { alert(text); }
return sayAlert;
}

Closures reduce the need to pass state around the application. The inner function has access to the variables in the outer function so there is no need to store the information somewhere that the inner function can get it.

This is important when the inner function will be called after the outer function has exited. The most common example of this is when the inner function is being used to handle an event. In this case you get no control over the arguments that are passed to the function so using a closure to keep track of state can be very convenient.

7. What is unobtrusive javascript? How to add behavior to an element using javascript?

Unobtrusive Javascript refers to the argument that the purpose of markup is to describe a document’s structure, not its programmatic behavior and that combining the two negatively impacts a site’s maintainability. Inline event handlers are harder to use and maintain, when one needs to set several events on a single element or when one is using event delegation.

1
<input type="text" name="date" />
Say an input field with the name “date” had to be validated at runtime:

1
document.getElementsByName("date")[0].
2
                   addEventListener("change", validateDate, false);
3

4
function validateDate(){
5
// Do something when the content of the 'input' element with the name 'date' is changed.
6
}
Although there are some browser inconsistencies with the above code, so programmers usually go with a javascript library such as JQuery or YUI to attach behavior to an element like above.

8.  What is Javascript namespacing? How and where is it used?

Using global variables in Javascript is evil and a bad practice. That being said, namespacing is used to bundle up all your functionality using a unique name. In JavaScript, a namespace is really just an object that you’ve attached all further methods, properties and objects. It promotes modularity and code reuse in the application.

9.  What datatypes are supported in Javascript?
Number, String, Undefined, null, Boolean

10. What is the difference between innerHTML and append() in JavaScript?

InnerHTML is not standard, and its a String. The DOM is not, and although innerHTML is faster and less verbose, its better to use the DOM methods like appendChild(), firstChild.nodeValue, etc to alter innerHTML content.

newest questions on wordpress