Wednesday, September 1, 2010

Answer of WBCS Preliminary Question Paper 2010 -II

24. The separation from a lover fills one’s mind with blues.
(A) Sadness
(B) Romanticism
(C) Nostalgia
(D) Colourfulness

Answer : A

26. Enzymes speed up biochemical reactions by
(A) Increasing the activation energy of the reaction
(B) Lowering the temperature of the reaction
(C) Increasing the temperature of the reaction
(D) Lowering the activation energy of the reaction

Answer : D

27. The narrow portion between uterus and vagina of higher mammals is known as
(A) Clitoris
(B) Urethra
(C) Oviduct
(D) Cervix

Answer : D

28. Presence of sunken stomata in leaves indicates the character of
(A) Hydrophytes
(B) Xerophytes
(C) Halophytes
(D) Mesophytes

Answer : D

29. Cardiac muscles do not undergo fatigue, because
(A) Interconnection of cells by intercalated disc
(B) Having numerous mitochondria
(C) Having more actins
(D) Having more myosin

Answer : B

31. At which Delhi Durbar the Queen of England was proclaimed the Empress of India?
(A) 1876-77 A.D.
(B) 1911 A.D.
(C) 1921 A.D.
(D) None of the above

Answer : A

35. Polytene chromosome is found in the cells of
(A) Salivary gland of larvae of flies
(B) Liver of man
(C) Neuron of insects
(D) None of the above

Answer : A

36. Chittaranjan in West Bengal is well known for its
(A) Fertiliser plant
(B) Locomotive works
(C) Iron and Steel industry
(D) None of the above

Answer : B

37. VAT is imposed on
(A) the final consumer of a commodity
(B) total value added at the final stage of production of a commodity
(C) the value added at each stage of production of a commodity
(D) aggregate value in terms of cost of production of the producer of a commodity

Answer : A

38. The gene for Haemophilia is
(A) X-linked recessive
(B) X-linked dominant
(C) Y-linked
(D) Located in autosome

Answer : A

39. Who was the main inspiration of the Young Bengal movement?
(A) Rammohan
(B) Derozio
(C) Debendranath
(D) David Hare

Answer : B

40. The minimum number of artificial satellites required for communication throughout the globe is
(A) i
(B) 2
(C) 3
(D) 4

Answer : D

41. The toxic chemical element that caused Minamata disease in Japan was
(A) Uranium
(B) Mercury
(C) Cadmium
(D) Arsenic

Answer : B

42. Who is called “A traditional moderniser”?
(A) Vidyasagar
(B) Swami Vivekananda
(C) RammohanRoy
(D) B.G.Tilak

Answer :A

43. The Right to Information Act is applicable to the whole of India except to the state of
(A) Jammu and Kashmir
(B) Mizoram
(C) Manipur
(D) Nagaland

Answer: A

45. The Muhammadan Anglo-Oriental College of Aligarh was founded in the year
(A) 1868 A.D.
(B) 1875 A.D.
(C) 1883 A.D.
(D) 1906 A.D.

Answer : B

46. India developed RISAT 2 satellite in collaboration with
(A) USA
(B) Russia
(C) France
(D) Israel

Answer : D

47. The earthquake in Latur is believed to have resulted from
(A) Excessive loading of water
(B) Plate movement
(C) Fault line underneath a dam
(D) Folding

Answer : C

48. has been declared the International Year of Astronomy.
(A) 2008
(B) 2009
(C) 2010
(D) None of the above

Answer : B

49. In photosynthesis, ‘Light reaction’ takes place in
(A) Cytosol
(B) Grana of chloroplast
(C) Stroma of chloroplast
(D) Ribosome

Answer :B

50. How much of India’s crude oil requirement is imported?
(A) 65%
(B) 70%
(C) 75%
(D) 80%

Answer :A

51. Haversian system is a part of
(A) Kidney
(B) Bone
(C) Heart
(D) Brain

Answer :B

52. With the people of which country Harappan people carried trade?
(A) China
(B) Iran
(C) Russia
(D) Sumer

Answer :A

53. Nadir Shah invaded India in the year
(A) 1738 A.D.
(B) 1739 A.D.
(C) 1740 A.D.
(D) 1741 A.D.

Answer :B

54. The oldest school of Indian Philosophy is
(A) Yoga
(B) Sankhya
(C) Vaisesika
(D) Karma Mimansa

Answer :B

55. The Treaty of Amritsar was signed by the English with Ranjit Singh in the year
(A) 1807 A.D.
(B) 1809 A.D.
(C) 1811 A.D.
(D) 1813 A.D.

Answer :B

56. To which period of Indian history did Aryabhatta and Varahamihira (Scientist and Mathematician
respectively) belong?
(A) Maurya period
(B) Gupta period
(C) Pala period
(D) Delhi Sultanate

Answer :B

57. The apex body which operates micro-finance scheme by promoting self-help groups of individuals from a homogeneous class through banks or non-government organisations is
(A) Regional Rural Bank
(B) Grameen Bank
(C) State Bank of India
(D) National Bank for Agriculture and Rural Development

Answer : D

58. Who was the founder-President of theSwaraj Party?
(A) Motilal Nehru
(B) C.R.Das
(C) Rajendra Prasad
(D) Rajagopalachari

Answer : B

60. Under which Article of the Indian Constitution provision has been made for the formation of a Finance Commission to deal with various aspects of Centre-State financial relationship?
(A) Article 245
(B) Article 280
(C) Article 356
(D) Article 370

Answer : B.

62. Which of the following is a good nuclear fuel?
(A) Uranium 238
(B) Plutonium 239
(C) Neptunium 239
(D) Thorium 236

Answer : B

64. What did Iqta mean during Sultanate period?
(A) A form of Salutation
(B) An important official
(C) The grant of land revenue from a village or territory
(D) None of the above

Answer : C

66. Who founded the “Amrita Bazar Patrika”?
(A) Surendra Nath Banerjee
(B) Barindra Ghosh
(C) Krishna Kumar Mitra
(D) Sisir Kumar Ghosh

Answer : D

67. The technique of ‘DNA sequencing’ was discovered by
(A) H.G.Khorana
(B) Watson and Crick
(C) Frederick Sanger
(D) E.M. Southern

Answer :C

68. Which one of the following companies has recently entered into a memorandum of understanding with the Uranium Corporation of India for exploration of uranium deposits?
(A) ONGC
(B) GAIL
(C) Reliance Petroleum
(D) EssarOil

Answer : A

69. A Cladogram depicts the hypothesis of
(A) Evolutionary relationship
(B) Phenatic relationship
(C) Genetic relationship
(D) Taxonomic relationship

Answer : A

70. Which movement of Gandhiji joined with Khilafat movement?
(A) Civil Disobedience
(B) Non-Co-operation
(C) Quit India
(D) Against Indigo cultivation (1917)

Answer : B

72. The capital of Tipu Sultan was at
(A) Mysore
(B) Seringapattam
(C) Sringeri
(D) Belur

Answer : B

73. Who v/as the Governor-General of India when Widow Remarriage Act was passed?
(A) LordRipon
(B) Lord Canning
(C) Lord Dalhousie
(D) LordBentinck

Answer : C

74. The Muslim League joined the Interim Government in
(A) October 1946
(B) November 1946
(C) December 1946
(D) January 1947

Answer : A

75. Who translated ‘Nil Darpan’ in English?
(A) Madhusudan Dutt
(B) Rev. James Long
(C) Harish Chandra Mukherjee
(D) Kali Prasanna Singha

Answer : A

76. Consider the following statement
1. Definition of force is obtained from Newton’s first law of motion.
2. Definition of force is obtained from Newton’ s second law of motion.
3. In a house-hold wiring the appliances are connected in series.
4. The picture-tube of a television is basically a cathode ray tube.

(A) Only 1 is correct
(B) Only 2 is correct
(C) Only 2 and 4 are correct
(D) Only 1 and 4 are correct

Answer : C

77. In West Bengal SEZ was planned
(A) Around Medinipur
(B) Around Jhargram
(C) Around Nandigram
(D) Around Haldia

Answer : D

78. The Central Government is to collect Rs crore from disinvestment in 2009-10.
(A) 1120
(B) 1125
(C) 1130
(D) 1150

Answer : A

79. The Himalayas are
(A) Fold Mountains
(B) Block Mountains
(C) Residual. Hills
(D) Tableland

Answer : A

81. Which of the following films was directed by Tapan Sinha?
(A) Zindagi Zindagi
(B) Sagina
(C) Ek Doctor Ki Maut
(D) All of the above

Answer:D

Friday, March 19, 2010

Truncate text using php

[sourcecode language="php"]
<?php
function truncate($string, $length='' , $k = ''){
if( $length == '') $length = 50;
if( $k == '') $k = '...';
settype($string, 'string');
settype($length, 'integer');
for($a = 0; $a < $length AND $a < strlen($string); $a++){
$output .= $string[$a];
}
if( strlen($string) > $length)
$output .= $k;
return($output);
}
?>
[/sourcecode]
truncate text using php


$my_string = 'I am kajal Mondol.I live in Kolkata.';
echo truncate($my_string);
echo truncate($my_string,10);
echo truncate($my_string,10,',,,');

This will output:

I am kajal Mondol.I live in Kolkata.
I am kajal...
I am kajal,,,

This function truncates a variable to a character length, default is 50.
'...' is the default text to append if truncation occurs.
Second parameter determines how many characters to truncate to.

Tuesday, March 9, 2010

How to Add a Field to Drupal Contact form

STEP 1 :

First you have to create a module. Create a folder into /sites/all/modules. Give the folder name your module name. Create a module file into the folder. Give the module a name. I have used “contactus.module”. In contactus.module file write the following lines. If you give different module name then the function name should be function yourmodulename_form_alter(&$form, $form_state).


#title    = Title of the input field.

#type     = Type of the input field (e.g. ‘textfield’ or ‘textarea’ etc.  )

#required = If the field is required then value will be true.

Unset function will disable the particular field. Here, in the example I unset copy field. You can re-order all the fields as per need. Just you have to the $ order array. For more information see http://api.drupal.org/api/function/hook_form_alter.

[sourcecode language="php"]

<?php

function contactus_form_alter(&$form, $form_state) {

$form['company'] = array(

'#title' => t('Your company'),

'#type' => 'textfield',

);

$form['phone'] = array(

'#title' => t('Your phone'),

'#type' => 'textfield',

'#required' =>'true',

);

unset($form['copy']);

// reorder the elements in the form to include the elements being inserted

$order = array('name','mail', 'subject', 'company', 'phone','message','submit');

foreach($order as $key => $field) {

$form[$field]['#weight'] = $key;

}

[/sourcecode]

STEP  2: Now you have to create a info file.File name should be your modulename.info . Here I’ve used contactus.info. Into the .info file write the following lines.

name = "contactus"


description = "contact with us"


dependencies[] = contact


core = 6.x


php = 5.1

Thursday, March 4, 2010

Function to create GD thumbnail using Php

function thumbnail($src,$destimagename,$dimension)
{
$src_path=explode("/",$src);
$name=$src_path[count($src_path)-1];
array_pop($src_path);
$oldpath=implode("/",$src_path);
$newpath=$oldpath;
$newpath=$newpath."/".$destimagename;

if(copy($src,$newpath))
{
$name_extension=substr($name,strrpos($name,".")+1);
if (preg_match("/gif/i",$name_extension))
{
$src_img=imagecreatefromgif($newpath);
}
if (preg_match("/jpg|jpeg/i",$name_extension))
{
$src_img=imagecreatefromjpeg($newpath);
}
if (preg_match("/png/i",$name_extension))
{
$src_img=imagecreatefrompng($newpath);
}
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);

$thumb_w = $dimension;
$thumb_h = floor(($old_y/$old_x) * $dimension);

$dst_img=@ImageCreateTrueColor($thumb_w,$thumb_h);
@imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);

if(preg_match("/png/i",$name_extension))
{
@imagepng($dst_img,$newpath);
}
if(preg_match("/jpg|jpeg/i",$name_extension))
{
@imagejpeg($dst_img,$newpath);
}
if(preg_match("/gif/i",$name_extension))
{

@imagegif($dst_img,$newpath);
}
@imagedestroy($dst_img);
@imagedestroy($src_img);

}

}

Wednesday, March 3, 2010

PHP Headers and Popular Mime Types

Atom


header('Content-type: application/atom+xml');

Javascript


header('Content-type: text/javascript');

JPEG Image


header('Content-type: image/jpeg');

PDF


header('Content-type: application/pdf');

XML


header('Content-type: text/xml');

RSS


header('Content-Type: application/rss+xml; charset=ISO-8859-1');

CSS


header('Content-type: text/css');

Create Backup of MySQL Database Using PHP

[sourcecode language="php"]
<?php

$dbName = "db_name";

$dbhost="localhost";

$dbuser="root";

$dbpass="";

$backupFile = $dbName . date("Y-m-d-H-i-s") . '.gz';

$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbName | gzip > $backupFile";

system($command);

header('Content-disposition: attachment; filename='.$backupFile);

header('Content-type: application/x-gzip');

readfile($backupFile);

?>
[/sourcecode]

Configuring The Contact Form Module In Drupal

Drupal has a built in contact form module.

Activate The Module!


Browse to Administer / Site Building / Modules in your site and activate the Contact and Contact Forms module. Save the configuration and you’re ready to go.

Configure The Contact Form


Browse to Administer / Site Building / Contact Form to begin. Click the link at the top of the page to Add Category.




1. Give the category name. I have used Contact Us.

2. Configure recipients. You can put a single email address or multiple email address separated by comma(,).

You can configure the contact us from from the setting options. This page also allows you to set maximum messages per hour – an anti-spam setting that prevents you getting bombarded with contact form spam! You can also allow members to have a personal contact form which relays emails to the address they have in their profile.

Integrating Into Site Navigation


The path of the contact form is yoursite.com/contact. You can link this page from Administer / Site Building / Menus.

Tuesday, February 23, 2010

Fatal error: Allowed memory size of 8388608 bytes exhausted.

Fatal error: Allowed memory size of 8388608 bytes exhausted.

Sometime PHP script may returns the above error. Normally this error is generated when your script exhausted and used up the default memory requirement of 8 MB memory allocation.

* Default memory limit is set in php.ini file ( php configuration file.)
* memory_limit = 8M;

How can we manage with the memory problems comes in some php scripts?
you should check following things when such kind of memory errors occurs in your script.

1. check the default memory_limit variable in your php.ini file.
memory_limit = 8M;
you can change this memory limit and again check for the error.

a. Edit in php.ini

memory_limit = 12M;
restart the apache service.



b. code Level
@ini_set('memory_limit', '12M');



c. htaccess
php_value memory_limit 12M
___________________________________________________________________

2. If the error is not resolved after above step, then you should start debugging your code in order to find out the reason of memory limit exceed.
You have to first find out at what position in your code the memory limit is exceeding. you can use the php's built in function for this purpose.

Function description

memory_get_usage — This function returns the amount of memory allocated to PHP.

Syntax : int memory_get_usage ( true / false );

It returns the amount of memory, in bytes, that's currently being allocated to your PHP script.

Set the option to this function to TRUE to get the real size of memory allocated from system. If not set or FALSE only the memory used by emalloc() is returned.

How to use this function

1. Write this code ( echo memory_get_usage( true ); ) repeteadly after some no of lines.
2. Run it in browser
3. Compare the counts given by each echo and you can check which block of your code needs extra memory.
4. Once you identify the block of code which needs extra memory then you can start deallocating the unused memory spaces allocated by some unused variables and some infinite loops.
5. use following wherever necessary.
a. unset($var_name);
b. mysql_free_result($result_set); — Free result memory
c. Look for include("file.php") in loops, by mistake.
Just try to free the memory everywhere if the variable / array is no longer used.
6. Best of luck.


Function description

bool
mysql_free_result ( resource $result )
It frees all the memory associated with the result identifier result .

Object Oriented Programming with PHP




Object Oriented Programming With PHP 5 #1[gigya width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=oop1-090302214803-phpapp02&stripped_title=object-oriented-programming-with-php-5-1" quality="high" wmode="tranparent" ]

Object Oriented Programming with PHP




Object Oriented Programming With PHP 5 #2[gigya width="455" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=oop2-090302220926-phpapp02&stripped_title=object-oriented-programming-with-php-5-2" quality="high" wmode="tranparent" ]

BASIC COMPUTER OPERATIONS

1. Input: This is the process of entering data and programs in to the computer system. You should know that computer is an electronic machine like any other machine which takes as inputs raw data and performs some processing giving out processed data. Therefore, the input unit takes data from us to the computer in an organized manner for processing.

f1.gif (4622 bytes)

Fig. 2.1 Basic computer Operations

2. Storage: The process of saving data and instructions permanently is known as storage. Data has to be fed into the system before the actual processing starts. It is because the processing speed of Central Processing Unit (CPU) is so fast that the data has to be provided to CPU with the same speed. Therefore the data is first stored in the storage unit for faster access and processing. This storage unit or the primary storage of the computer system is designed to do the above functionality. It provides space for storing data and instructions.

The storage unit performs the following major functions:

  • All data and instructions are stored here before and after processing.

  • Intermediate results of processing are also stored here.


3. Processing: The task of performing operations like arithmetic and logical operations is called processing. The Central Processing Unit (CPU) takes data and instructions from the storage unit and makes all sorts of calculations based on the instructions given and the type of data provided. It is then sent back to the storage unit.

4. Output: This is the process of producing results from the data for getting useful information. Similarly the output produced by the computer after processing must also be kept somewhere inside the computer before being given to you in human readable form. Again the output is also stored inside the computer for further processing.

5. Control: The manner how instructions are executed and the above operations are performed. Controlling of all operations like input, processing and output are performed by control unit. It takes care of step by step processing of all operations in side the computer.

Monday, February 22, 2010

How to get current page URL using PHP?

<?php

function currentPageURL()

{

$pageURL = 'http';

if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}

$pageURL .= "://";

if ($_SERVER["SERVER_PORT"] != "80")

{

$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];

} else {

$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];

}

return $pageURL;

}

?>

You can now get the current page URL using the line:

<?php
echo currentPageURL ();
?>

Thursday, February 18, 2010

Date format converting Code In PHP

In database date are stored with a format like 0000-00-00.But sometime we need to change the format.The following function help you to change the time format.

function dateFormat($Date)

{

$Date =explode("-",$Date);

$new_date= $Date[2]."/".$Date[1]."/".$Date[0]; //date format will be like21/12/2010

return $new_date ;

}

Breaking a big array into small parts

<?php

$smallarray1=array_slice($bigarray, 0, sizeof($bigarray) / 2);
$smallarray2=array_slice($bigarray, sizeof($bigarray) / 2);

?>

Code for Fav icon

<LINK REL="SHORTCUT ICON" href="images/shortcut.jpg" />

how to get File extention using PHP

<?php

$file_extension = strtolower(substr(strrchr($filename,"."),1));

?>

Monday, February 1, 2010

Essential Joomla Extensions

Artio JoomSEF – Artio.cz


This extension will rewrite your Joomla! URLs into a more human friendly form, which at the same time enhances its SEO value. A multi-language interface    support is included, and updates can be made online easily. It also offers API for adding SEF functionality for other 3rd party Joomla! Modules easily. This is a great plug-in for Joomla! Users who wish to make their


Sites more prominent in the search engines.


Download Here:


http://www.artio.cz/en/downloads/joomla-extensions/



AllVideosPlugin - Joomlaworks.gr


The AllVideos Plugin gives you the ability to easily embed online streaming videos/audios within your webpage as well as have your own videos/audios uploaded on your server. No HTML is required at all and all you have to do is to place tags within our content where you want the videos or audios to appear. There are two ways you can use the AllVideosPlugin. If you want to save on your bandwidth, simply upload your videos to a Youtube.com and then embed the video onto your own webpage with the plugin. An alternative will be upload the


video itself to your website, after which you can stream the audios/videos via simple tags. One common complaint is that only 10 videos are allowed per page for this plugin. As long as that is not a problem, the AllVideosPlugin is very useful for all your videos/audios streaming needs.


Download Here:


http://www.joomlaworks.gr/


Jombackup - Jomres.net


Jombackup is an extension used for performing daily mysql backups and emailing them to an address of your choice. You can use the cron jobs function to enable daily backups Joomla! mySQL data. This is a must-have extension to saveguard all your precious data in your databases. It is easy to install as well, and works like a charm.


Download Here:


http://www.jomres.net/index.php?option=com_docman&task=doc_details&gid=72&Itemid=7


9


Phil-A-Form - Phil-taylor.com


Phil-A-Form allows you to generate dynamic forms in Joomla!, without sophisticated programming knowledge. Results can be emailed to anyone, or saved in a database. Phil-AForm was the worlds FIRST EVER mambo/Joomla! Form Generator, and is extremely beginnerfriendly as well. Solid and reliable, a great extension if you need forms on your site.


Download Here:


http://www.phil-taylor.com/Joomla/Components/Phil-A-Form/


VirtueMart - Virtuemart.org


VirtueMart is the leading Online-Shop solution for Joomla! (more than 1.5 Million downloads so far). You can download, use and modify it without any restrictions, for free, just like Joomla!. VirtueMart is not a stand-alone script, but a Plug-in and requires the PHP Content Management System Joomla!. Multiple translations can be readily found in the included


Language pack.


Download Here:


http://www.virtuemart.org/


AdSense Module (ClickSafe - Special Edition) - Joomlaspan.com


This extension is simple solution for implementing Google AdSense ads in Joomla!. As they are, Adsense ads are supposed to be easy to insert by themselves, but this extension provides other useful functionalities like blocking certain IP numbers from seeing Google ads. This helps prevent click fraud as you cannot accidentally click on your own ads. It also has chameleon codes that can make the ad colors automatically change with each page load, as determined


by you.


Download Here:


http://www.joomlaspan.com/joomla-downloads/Download/-JoomlaspanModules/GoogleAdSenseRelatedModules/

Saturday, January 30, 2010

Code for tab in drupal.

This conditional statement controls the tabs.
if ($tabs = theme('menu_local_tasks')) {
$output .= $tabs;
}

How to build joomla templates

Step 1:

Create  a  folder into the templates folder.This folder name must be the template name.


Step 2:

Create a folder named "style" for stylesheet,

Create a folder named "javascript" for javascript,

Create a folder named "images" for images,

Create a folder named "html" for components,

Create a file index.php into you template folder. After that copy and paste the following lines.

<?php
/**
* @copyright    Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license        GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/


defined('_JEXEC') or die('Restricted access');
$url = clone(JURI::getInstance());
?>


Step 3: Copy and paste the follwing lines

<?php echo '<?xml version="1.0" encoding="utf-8"?'.'>'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" >
<head>
<jdoc:include />
<link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/css/[your css].css" rel="stylesheet" />
if any javascript file is needed, write the following lines

<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template;?>/javascript/[your script].js"></script></head>
<body>


Step 4: For displaying primary links paste thi following codes into the appropriate <Div>

<jdoc:include type="modules" style="" />

Step 5:

For displaying your site content write the following code within appropriate <Div>

<jdoc:include type="component" />

Step 6:
Colse all the opened html tag.