Thursday, June 16, 2016

Best cPanel Web Hosting Service

Looking for a good web host? It can be very difficult to find a reliable hosting service? that actually provides what they are offering.

JonaHost.com is a true professional cPanel web hosting company that is offering exceptional hosting service with 24hrs real support. All their services are fully managed with a 1hr support response time.

If your seeking shared hosting, Managed VPS Hosting, or a dedcicated server, then you should consider JonaHost.com. I have been using them for my personal websites and have recommended JonaHost to all my clients.

Over the years, I have never had an issue and none of my clients ever complained. I am not affiliated with JonaHost but would like to share my views with everyone who is looking a reliable hosting service with good value, 24hrs support and 100% uptime.

If your on a tight budget, you can get their premium web hosting for only $9.99/yr and the following year will be $24.

What is included for $9.99/yr

1. UNLIMITED Disk Space 2. UNLIMITED Bandwidth 3. UNLIMITED Email Accounts

Dont miss out on this great offer and Sign Up Here

Wednesday, December 24, 2014

Send Voice Email to Your Loved Ones


Send My Voice Mail is a free service for sending voice messages across the internet. Now You can send unlimited voice mails to anyone for free. Visit Website

Facebook : https://www.facebook.com/sendmyvoicemail
Twitter : https://twitter.com/sendmyvoicemail





Friday, May 3, 2013

Follow and Unfollow someone on twitter through API in PHP

Hello friends,

Today in Developer's Blog, I am going to tell you the way to follow and unfollow someone on twitter using API.

Below is the code to follow and unfollow someone on twitter :

<?php
require("twitteroauth/twitteroauth.php"); 

define('CONSUMER_KEY', 'Your Consumer Key Here');
define('CONSUMER_SECRET', 'Your Consumer Secret Here');
define('ACCESS_TOKEN', 'Your Access Token Here');
define('ACCESS_TOKEN_SECRET', 'Your Access Token Secret Here');

function auto_follow()
{
    $ob = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);

    $response=$ob->post('friendships/create',array('user_id'=>'783214'));
}


function auto_unfollow()
{
    $ob = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);

    $response=$ob->post('friendships/destroy',array('user_id'=>'783214'));
}
?>

Now, you must be thinking about how to get user id of twitter account. I will tell you that also. Here's the link which will give you twitter user id by passing twitter username.

https://api.twitter.com/1/users/show.xml?screen_name=Ravinder22

You can create twitter app by going to this link :

https://dev.twitter.com/apps/new

Download Source Files

So by this way, you will successfully follow and unfollow users on twitter.


I hope this will help you and you will like it and you will follow me also on twitter.

Don't forget to leave your comments.


Thank you
Ravinder




Monday, April 22, 2013

Redirect non-www domain to www using .htaccess file

Hello friends,

Today in Developer's Blog, I am going to tell you the way to Redirect your domain from non-www to www using .htaccess file.

Suppose you have domain named www.example.com and if users browse the url by example.com and you want the www in the url, so you can write the below code to redirect to non-www to www using .htaccess file.

Here's the code you will have to write in .htaccess file : 

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

So by this you will be able to Redirect to www from non-www using .htaccess file.

I hope this will help you and you will like it.

Don't forget to leave your comments.

Thank you
Ravinder

Friday, April 12, 2013

Format Numbers Using JavaScript

Hello friends,

Today in Developer's Blog, I will tell you the way to Format Numbers Using JavaScript.

We already have a function to format numbers in PHP, which is number_format(number,decimal_places).

So we also need a function which can format numbers in JavaScript, because a lot of times we need to calculate the cost or something and show it formatted using JavaScript.

So here's the function which will format your numbers using JavaScript.


function number_format(str) {
    var amount = new String(str);
    amount = amount.split("").reverse();

    var output = "";
    for ( var i = 0; i <= amount.length-1; i++ ){
        output = amount[i] + output;
        if ((i+1) % 3 == 0 && (amount.length-1) !== i)output = ',' + output;
    }
    return output;
}


So by this you will be able to Format Numbers Using JavaScript.

I hope this will help you and you will like it.

Don't forget to leave your comments.

Thank you
Ravinder

Monday, April 8, 2013

PHP Interview Questions for 0 - 1.5 years Experienced Developer

Hello friends,

Today In Developer's Blog, I am going to give you the Questions and Answers for the Interview.


I am sure it will help you a lot. Even if you are not preparing for any interview, but you can still read this for your knowledge and you can test yourself.



1. Which of the following functions allows you to store session data in a database?

A. session_start();

B. session_set_save_handler();

C. mysql_query();

D. You cannot store session data in a database.
Answer : B


2.
What will the following script output?


<?php

$x = 3 - 5 % 3;

echo $x;
?>

A. 2

B. 1

C. Null

D. True

E. 3
Answer : B
 



3.
Which data type will the $a variable have at the end of the following script?

<?php

$a = “1”;
?>

A. (int) 1

B. (string) “1”

C. (bool) True

D. (float) 1.0

E. (float) 1

Answer : B



4. What will the following script output?

<?php
$a = 1;
$a = $a-- + 1;
echo $a;
?>

A. 2

B. 1

C. 3

D. 0

E. Null
Answer : A


 5.  
What will the following script output?

<?php

class a {     

    private $c;     

    public function a($pass) {
         $this->c = $pass;
     }  
 

    public function print_data() { 
 
         echo $this->$c;
     }
 

 }  
 

 $a = new a(10);  
 
 $a->print_data();

?>

A. An error

B. 10

C. “10”

D. Nothing

E. A warning
Answer : A



6.   How do I find out the number of parameters passed into function?

A.    By using func_num_args()

B.    By using func_get_arg()

C.    By using func_get_args()

D.    None of the above
Answer : A


7.  What will the following script output?

<?php
error_reporting(E_ALL);
class a {
   var $c;
   function a() {
       $this->c = 10;
   }
}
class b extends a {
   function print_a() {
       echo $this->c;
   }
}
$b = new b;
$b->print_a();
?>

A. Nothing

B. An error because b does not have a constructor

C. 10

D. NULL

E. False
Answer : C


8. Is it possible to pass data from PHP to JavaScript?

A. No, because PHP is server-side, and JavaScript is client-side.

B. No, because PHP is a loosely typed language.

C. Yes, because JavaScript executes before PHP.

D. Yes, because PHP can generate valid JavaScript
Answer : D

9. Which types of form elements can be excluded from the HTTP request?


A. text, radio, and check box

B. text, submit, and hidden

C. submit and hidden

D. radio and check box


Answer : D




10.  When processing the form, what is the difference between a hidden form element and a non-hidden one, such as a text box?


A. The hidden form element does not have a name.

B. There is no difference.

C. The hidden form element does not have a value.

D. The hidden form element is excluded from the request.
Answer : B





11. Which of the following form element names can be used to create an array in PHP?

A. foo

B. [foo]

C. foo[]

D. foo[bar]
Answer : C,D



12. When an expiration date is given in a Set-Cookie header, what is the resulting behavior in subsequent requests?

A. If the expiration date has expired, the cookie is not included.

B. The behavior is the same; the expiration date is included in the Cookie
header, and you can access this information in the $_COOKIE superglobal
array.

C. The cookie persists in memory until the browser is closed.

D. The cookie is deleted and therefore not included in subsequent requests.
Answer : A





13. If you set a cookie with either setcookie() or header(), you can immediately check to see whether the client accepted it.

A. True, you can check the $_COOKIE superglobal array to see if it contains the
value you set.

B. True, but only if register_globals is enabled.

C. False, you can only use setcookie() if you need to test for acceptance.
Using header() does not work.

D. False, you must wait until you receive another HTTP request to determine
whether it includes the Cookie header.
Answer : D

14. Why must you call session_start() prior to any output?

A. Because it is easy to forget if not placed at the top of your scripts.

B. Because you can no longer access the session data store after there has been output.

C. Because session_start() sets some HTTP headers.

D. Because calling session_start() causes the HTTP headers to be sent.


Answer : C
 


15. Which of the following represents the proper way to set a session variable?

A. $_SESSION[‘foo’] = ‘bar’;

B. session_start();

C. session_set_save_handler (‘myopen’, ‘myclose’, ‘myread’,‘mywrite’, ‘mydelete’, ‘mygarbage’);

D. $foo = $_SESSION[‘foo’];


Answer : A
  

16. Which of the following types can be used as an array key? (Select three.)

A. Integer

B. Floating-point

C. Array

D. Object

E. Boolean
Answer : A,C,D

 
17. Which of the following functions can be used to sort an array by its keys in descending order?

A. sort

B. rsort

C. ksort

D. krsort

E. reverse_sort


Answer : D




18. What will the following script output?



<?php

$a = array (‘a’ => 20, 1 => 36, 40);

array_rand ($a);

echo $a[0];

?>

A. A random value from $a

B. ‘a’

C. 20

D. 36

E. Nothing


Answer : E



19.  Given

$email = ‘bob@example.com’;
which code block will output example.com?

A. print substr($email, -1 * strrpos($email, ‘@’));

B. print substr($email, strrpos($email, ‘@’));

C. print substr($email, strpos($email, ‘@’) + 1);

D. print strstr($email, ‘@’);
Answer : C

 
20.  
Which question will replace markup such as img=/smiley.png with <img src=”/smiley.png”>?

A. print preg_replace(‘/img=(\w+)/’, ‘<img src=”\1”>’, $text);

B. print preg_replace(‘/img=(\S+)/’, ‘<img src=”\1”>’, $text);

C. print preg_replace(‘/img=(\s+)/’, ‘<img src=”\1”>’, $text);

D. print preg_replace(‘/img=(\w)+/’, ‘<img src=”\1”>’, $text);


Answer : B
 


21.
Which of the following functions is most efficient for substituting fixed patterns in strings?

A. preg_replace()

B. str_replace()

C. str_ireplace()

D. substr_replace()


Answer : A
 

 
22.
What are the contents of output.txt after the following code snippet is run?

<?php
$str = ‘abcdefghijklmnop’;
$fp = fopen(“output.txt”, ‘w’);
for($i=0; $i< 4; $i++) {
fwrite($fp, $str, $i);
}

?>

A. abcd

B. aababcabcd

C. aababc

D. aaaa


Answer : C




23. Which of the following can be used to determine if a file is readable?

A. stat()

B. is_readable()

C. filetype()

D. fileowner()

E. finfo()


Answer : B




24.
If you have an open file resource, you can read data from it one line at a time with the _____ function. 
Answer : fgets()




25. Which of the following functions require an open file resource?

A. fgets()

B. fopen()

C. filemtime()

D. rewind()

E. reset()

Answer : B


26. Which of the following sentences are incorrect?
A. date() returns the current UNIX datestamp.

B. date() returns a formatted date string.

C. date() requires a time stamp to be passed to it.

D. date() returns a date array.


Answer : D

27. The ________ function will return the current UNIX time stamp.

Answer : time()



28. Which of the following functions will output the current time as 11:26 pm?
A. print date(‘H:m a’);

B. print date(‘G:M a’);

C. print date(‘G:i a’);

D. print strftime(‘%I:%M %p’);


Answer : C,D


29. Which of the following is not an aggregate function?
A. AVG

B. SUM

C. COUNT

D. GROUP BY

E. MIN


Answer : D

30. What is the default execution time set in set_time_limit()?

A.   20 secs

B.   30 secs

C.   40 secs
Answer : B

 
I hope this will help you and you will like it.

Don't forget to leave your comments.

Thank you
Ravinder

Convert Numbers into Words Using JavaScript

Hello friends,

Today in Developer's Blog, I am going to tell you the way by which we will be able to easily convert Numbers into Words using JavaScript.

First of all you will have to create a JavaScript file (.js) using below code :
var th = ['','thousand','million', 'billion','trillion'];
var dg = ['zero','one','two','three','four', 'five','six','seven','eight','nine']
var tn = ['ten','eleven','twelve','thirteen', 'fourteen','fifteen','sixteen', 'seventeen','eighteen','nineteen'];
var tw = ['twenty','thirty','forty','fifty', 'sixty','seventy','eighty','ninety']

function toWords(s)
{  
    s = s.toString(); 
    s = s.replace(/[\, ]/g,''); 
    if (s != parseFloat(s)) return 'not a number'
    var x = s.indexOf('.'); 
    if (x == -1) x = s.length; 
    if (x > 15) return 'too big'
    var n = s.split(''); 
    var str = ''
    var sk = 0; 
    for (var i=0; i < x; i++
    {
        if ((x-i)%3==2) 
        {
            if (n[i] == '1'
            {
                str += tn[Number(n[i+1])] + ' '
                i++; 
                sk=1;
            }
            else if (n[i]!=0) 
            {
                str += tw[n[i]-2] + ' ';
                sk=1;
            }
        }
        else if (n[i]!=0) 
        {
            str += dg[n[i]] +' '
            if ((x-i)%3==0) str += 'hundred ';
            sk=1;
        }

        if ((x-i)%3==1)
        {
            if (sk) str += th[(x-i-1)/3] + ' ';
            sk=0;
        }
    }
    if (x != s.length)
    {
        var y = s.length; 
        str += 'point '
        for (var i=x+1; i<y; i++) str += dg[n[i]] +' ';
    }
    return str.replace(/\s+/g,' ');
}

So by this you will be able to Convert Number into Words Using JavaScript.

I hope this will help you and you will like it.

Don't forget to leave your comments.

Thank you
Ravinder