Drupal: Add module for Local languages
20th Mar 2010 at 12:08 PM | Posted in Drupal | 1 Comment1. Download “Google AJAX Language Transliteration API” module (http://drupal.org/project/googleLanguageApi).
2. extract and copy it into your drupal installention folder/sites/all/modules.
3. Go to administrator -> Site Building -> Modules.
Enable the “Google AJAX Language Transliteration API” and save configuration (screen shot below).
4. Then go to administrator -> Site Building -> Translate interface.
From “search”, “importe”, “export” tab you can select languages (screenshot below).
Thats it.
5. Now create a page and select languae from drop down language list.
PHP Class Example
6th Mar 2010 at 11:10 AM | Posted in PHP | Leave a commentCreate a simple class.
<?php
class validateClass
{
public function validatePass($pass,$pass1)
{
if($pass=='' || $pass1=='')
return("Enter in Both Pasword Fields.<br/>");
else
if($pass!=$pass1)
return "Two Passwords Are Not Same.<br/>";
}//End function
}//End class
$validate = new validateClass; //creating object of this class
$validate->validateName("abc","abc"); //calling the funtion
/* If passwords(the two parameter) are same it returns true else return false
*/
?>
Pointer in C
3rd Mar 2010 at 9:16 AM | Posted in C - Pointer Concept, C-Language | Leave a comment& – “address of” operator.
* – “value at address” operator.
main()
{
int i = 3 ;
printf ("\nAddress of i = %u", &i);
printf ("\nValue of i = %d", i);
printf ("\nValue of i = %d", *(&i));
}
The output of the above program would be:
Address of i = 65524
Value of i = 3
Value of i = 3
Explaination:
%u – is format specifier for unsigned decimal integer.
&i – is address of i
%d – is format specifier for signed decimal integer.
i – is variable of integer type. It contain value 3.
*(&i) – is value at adress (&i). More clearly value at adress 65524.
Now declearation of pointer:
int *alpha ; //alpha is a pointer of type integer
char *ch ; //ch is a character type pointer
float *s ; //s is a pointer of type float
The declaration float *s does not mean that s is going to contain a floating-point value. What it means is, s is going to contain the address of a floating-point value. Similarly, char *ch means that ch is going to contain the address of a char value. Or in other words, the value at address stored in ch is going to be a char.
int i, *j, **k ;
Here k is a pointer to an integer pointer.
main()
{
int i = 3, *j, **k ;
j = &i ;
k = &j ;
printf ("\nAddress of i = %u", &i);
printf ("\nAddress of i = %u", j);
printf ("\nAddress of i = %u", *k);
printf ("\nAddress of j = %u", &j);
printf ("\nAddress of j = %u", k);
printf ("\nAddress of k = %u", &k);
printf ("\nValue of j = %u", j);
printf ("\nValue of k = %u", k);
printf ("\nValue of i = %d", i);
printf ("\nValue of i = %d", * (&i));
printf ("\nValue of i = %d", *j);
printf ("\nValue of i = %d", **k);
}
The output of the above program would be:
Address of i = 65524
Address of i = 65524
Address of i = 65524
Address of j = 65522
Address of j = 65522
Address of k = 65520
Value of j = 65524
Value of k = 65522
C Program-Call By value& Call By Reference(Swaping Program)
3rd Mar 2010 at 9:02 AM | Posted in C - Pointer Concept | 1 CommentSwap program:
Call By Value:
void swapv(int x, int y); //prototype declaration
main( )
{
int a = 10, b = 20 ;
swapv ( a, b ) ;
printf ( "\na = %d b = %d", a, b ) ;
}
swapv ( int x, int y )
{
int t ;
t = x ;
x = y ;
y = t ;
printf ( "\nx = %d y = %d", x, y ) ;
}
Outpot:
x = 20 y = 10
a = 10 b = 20
Call By Reference:
void swapr(int *x, int *y); //prototype declaration
main( )
{
int a = 10, b = 20 ;
swapr ( &a, &b ) ; //sending the address of a and b
printf ( "\na = %d b = %d", a, b ) ;
}
swapr( int *x, int *y ) //*x is taking value at address send by &a, *y is taking value at address send by &b
{
int t ;
t = *x ;
*x = *y ;
*y = t ;
}
Outpot:
a = 20 b = 10
here we send the address of a and b.
Then just swap the value at these addresses.
GK-India States, Capitales & Language
2nd Mar 2010 at 10:33 AM | Posted in General Knowledge, GK-India States,Capitales & Languages | Leave a commentINDIA STATES
| States | Capital | Languages |
|---|---|---|
| Andra Pradesh | Hyderabad | Telugu and Urdu |
| Arunachal Pradesh | Itanager | Miji, Apotanji, Merdukpen, Tagin,Adi, Honpa, Bangini-Nishi. |
| Assam | Dispur | Assamese |
| Bihar | Patna | Hindi |
| Chhattisgarh | Raipur | Hindi |
| Goa | Panaji | Marathi and Konkani |
| Gujarat | Gandhinagar | Gujarati |
| Haryana | Chandigarh | Hindi |
| Himachal Pradesh | Shimla | Hindi and Pahari |
| Mizoram | Aizawl | Mizo and English |
| Jammu & Kashmir | Srinagar (Summer)
Jammu (Winter) |
Kashmiri,Dogri, Urdu, Ladakhi,
Pahari,Punjabi and Dadri |
| Jharkhand | Ranchi | Hindi |
| Karnataka | Bangalore | Kannda |
| Kerala | Trivandrum | Malayalam |
| Madhya Pradesh | Bhopal | Hindi |
| Maharashtra | Bombay | Marathi |
| Manipur | Imphal | Manipuri |
| Meghalaya | Shillong | Khasi, Jaintia and Garo |
| Nagaland | Kohima | Ao, Konyak, Angami, Sema and Lotha |
| Orissa | Bhubaneswar | Oriya |
| Punjab | Chandigarh | Punjabi |
| Rajasthan | Jaipur | Rajasthani and Hindi |
| Sikkim | Gangtok | Bhutia, Hindi, Nepali, Lepcha, Limbu |
| Tamil Nadu | Chennai | Tamil |
| Tripura | Agartala | Bengali, Tripuri, Manipuri, Kakborak |
| Uttar Pradesh | Lucknow | Hindi |
| Uttaranchal | Dehra Dun | Hindi |
| West Bengal | Calcutta | Bengali |
GK- First Indian
2nd Mar 2010 at 7:27 AM | Posted in General Knowledge, GK-First Indian | Leave a comment
First in India Men
|
GK-FIFA World Cup
1st Mar 2010 at 10:41 AM | Posted in General Knowledge, GK-FIFA World Cup | Leave a commentIntroduction to javascript regular rxpression
1st Mar 2010 at 3:38 AM | Posted in Javascript regular expression | Leave a commentUsing literal syntax:
var reExample = /pattern/;
Using the RegExp() constructor:
var reExample = new RegExp(“pattern”)
test() & exec():
The regular expression method in JavaScript has two main methods for testing strings: test() and exec().
The exec() Method
The exec() method takes one argument, a string, and checks whether that string contains one or more matches of the pattern specified by the regular expression. If one or more matches is found, the method returns a result array with the starting points of the matches. If no match is found, the method returns null.
The test() Method
The test() method also takes one argument, a string, and checks whether that string contains a match of the pattern specified by the regular expression. It returns true if it does contain a match and false if it does not. This method is very useful in form validation scripts. The code sample below shows how it can be used for checking a social security number. Don’t worry about the syntax of the regular expression itself. We’ll cover that shortly.
My 1st Regular expression script
1st Mar 2010 at 3:37 AM | Posted in Javascript regular expression | Leave a comment<html>
<head>
<title>Test</title>
<script type=”text/javascript”>
var RE_EXP =/^[0-9]{1}$/;
function checkSsn(ssn){
if (RE_EXP.test(ssn)) {
alert(“VALID”);
} else {
alert(“INVALID”);
}
}
</script>
</head>
<body>
<form onsubmit=”return false;”>
<input type=”text” name=”ssn” size=”20″>
<input type=”button” value=”Check”
onclick=”checkSsn(this.form.ssn.value);”>
</form>
</body>
</html>
Explaination:
var RE_EXP =/^[0-9]{1}$/;
1. A caret (^) at the beginning indicates that the string must start with this pattern.
( so ^foo is found in fooding but not in abcfood)
2. A dollar sign ($) at the end of indicates that the string must end with this pattern.
(so foo$ is found in abcfoo but not in abcfood)
3. Square brackets ( [] ) are used to group options.
(so the pattern f[aeiou]d can be found in “fad” and “fed”, but not in “food”, “faed” or “fd”.)
[0-9] means no character allowed only digits allowed. [a-zA-Z] means small a to z and capital A to Z.
Backslash-d ( \d ) also represents any digit. It is the equivalent of [0-9]. We can use [\d] in place of [0-9].
\w represents any word character (letters, digits, and the underscore (_) ).
[backslash ( \ ) is used to escape special characters. The pattern fo\.d can be found in "fo.d", but not in "food" or "fo4d". ]
4. Curly brackets with one parameter ( {n} ) indicate that the preceding character should appear exactly n times in the pattern.
(so The pattern fo{1}d can be found in “fod” , but not “food” or “fooood”.)
Curly brackets with two parameters ( {n1,n2} ) indicate that the preceding character should appear between n1 and n2 times in the pattern.
( so The pattern fo{2,4}d can be found in “food”,”foood” and “fooood”, but not “fod” or “foooood”.)
Curly brackets with one parameter and an empty second paramenter ( {n,} ) indicate that the preceding character should appear at least n times in the pattern.
(so The pattern fo{2,}d can be found in “food” and “foooood”, but not “fod”.)
Use var RE_EXP =/^[\d]{1,2}$/; for 2 digits.
Use var RE_EXP =/^[\d]{1,}$/; for more then one digit.
Use var RE_EXP =^\d{3}([\- ]?)\d{2}([\- ]?)\d{4}$
for number format like: 123-45-6789
123 45 6789
123456789
123-45 6789
123 45-6789
123-456789
[Explaination:
1. /^ Start of expression.
2. \d{3} Takes three digits.
3. ([\- ]?) After 3 digits takes ‘-’ or a ‘space’ no ‘nothing’. A questionmark (?) indicates that the preceding character should appear zero or one times in the pattern.( so The pattern foo? can be found in “food” and “fod”, but not “faod”.).
4. After this \d{2} Takes 2 digits and \d{4} Takes 4 digits.
]
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.




