RSS

PHP v/s .net


This blog I write today that about to PHP vs .NET. I’m ex. Microsoft Student Partner and Microsoft Certified Developers even if I’m oppose to .NET. Why? Find my answers below.

PHP is a free open source. So, we should not need to pay any fees for PHP. PHP is runs on various operating system. Such like Windows, Linux, Mac etc. PHP is also run on many servers like Apache, IIS, *gix etc. Windows, Mac are not free. So, you should always use with Linux, Apache.

Many MNC companies are used Java, PHP. Because no need to pay for open source. For, open source there are many open community, projects available. Now a day many websites build in PHP. Facebook is also build with PHP, MySQL.
There are many software packages available for PHP on various operating system. There are many versions for PHP. But every new version, no need to upgrade your software such like OS, editor etc. You should have to upgrade only PHP, Servers and Database and its cost-free. But in .NET every year Microsoft upgrade the software version such like OS, visual studio, .NET framework etc… For e.g. Before 3 years ago. I was developed windows 8 apps using visual studio 2012 with win 8. But if you want to develop win 10 app then you must have to install visual studio 2015 with windows 10 OS. So, you have to pay fees for OS, visual studio etc. You have to invest every time while any upgrades available for .NET technologies. In, PHP there are many open community available for free help as well as forums. You should have modified the code as per your risk. But you never changed the code in .NET technologies because of close source.

There are many free editors available for PHP, MySQL. Like NetBeans and MySQL WorkBench.

PHP is an interpreter. So, you don’t need to compile unlike .NET technologies. Nowadays php supports pure OOPS. In.NET technologies, you want high configuration system. But in PHP no need of any high configuration system in Linux only.

So, as per my view and experience, PHP is a better than .NET in terms of Costs, Scalability and Performance.

 
 

Desktop v/s Web Application


Hello Folks! I hope you are all enjoying my blog. Today, I am sharing views on Desktop v/s Web Application. There are many advantages and disadvantages of both the applications. Both the applications are good and have their own great characteristics.

What is Desktop Application?

A Desktop application is an application that runs on various computer and you can access the same from where it is installed. The only drawback of such an application is that you can access it from a specific location only, which doesn’t allow you to use the same from any other location. In order to be able to use it on any other machine you need to install the same on other machine. Even with this drawback, Desktop Application is an amazing solution to opt for because it is a trustworthy and reliable solution. You can overcome this drawback by installing the application on a portable device such as laptop so that your access to the system is not constraint by the physical boundaries.

What is Web Application?

Unlike Desktop Application, Web application runs on various web browsers and various machines. You can access the application anywhere, anytime and on any device. Hence, you can say that it definitely overcome the drawback of Desktop Application and that the same is not constraint of physical boundaries or constraint of devices.

Let’s go to the core and find true dissimilarities between Desktop & Web application. This helps us understand the basic characteristics of both the Desktop & Web application respectively.

  1. Installation 

    You need to install the desktop application which you need to access, along with application drivers on a particular machine which may sometime depend on the operating as well. Nowadays, most people are using smart phones and crave to get each application on the phone as well, in such a case we need to create a different application which can be sued on phone and hence, you can say that it is not cost-effective.When it comes to web development all you need to do is install a web browser which enables you to access the same from anywhere & at any time. Today, you may find numerous web applications made with numerous technologies which all operates smoothly on any machine such as mobiles or tablets.

  2. Platform independent 

    Desktop applications are platform dependent which proves to be one of its major drawback.
    Web applications however are not platform dependent and hence they overcome the drawback of Desktop Application.

  3. Deploying 

    We need to deploy desktop applications in each individual machines. Whereas, you only need to deploy web application to the server and not in individual machines.

  4.  Piracy 

    It doesn’t matter if your desktop application is paid or licensed. It always has great chances of piracy.
    Whereas, in web application there is a threat of piracy and all your script’s remains secure.

  5. Accessibility 

    Desktop application can’t be accessed from anywhere or from any devices whereas Web applications can be accessed anywhere, anytime and from any devices.

  6. Security

    Web applications are exposed to more security risks than Desktop applications.

  7. Cost factor

    In most cases Desktop applications are purchased once and then there are no recurring charges associated with it. However, when it comes to Web applications, their development and maintenance may cost more depending on the requirements and may need changes from time to time.

  8. Ease of use 

    Desktop applications are confined to a physical location and hence have usability constraint. Web applications on the other hand makes it convenient for the users to access the application from any location using the Internet.

This is a huge subject matter and hence it is not possible to pen down each point. As a result of which I have shared a few points which I find important. You may understand that both the Desktop and Web applications are good options and have their own pro’s and con’s. In the end Web applications are easy to use and Desktop applications are Secure. You can select the either ones based on your precise requirement.

 
4 Comments

Posted by on December 24, 2016 in Computers and Internet, difference

 

Tags: , ,

printing webpage without opening new window using jQuery


Print is a create a big problem to mostly developers (I’m one of them). The problem like “print without opening new window”.
Today, in this post I write a solutions of same problem.

The solutions is :

Use Jquery/Javascript with iframe elements. Small code for solution is below.

var theUrl="print.html"; 
$("<iframe>")                            // create a new iframe element
        .hide()                               // make it invisible
        .attr("src", theUrl) // point the iframe to the page you want to print
        .appendTo("body"); 
and Use window.print() method in the print file which you want to print.

If you have any confusion then comment it.

 
Leave a comment

Posted by on January 21, 2016 in Javascript & Jquery, PHP

 

Tags: , , , ,

Text to Speech | Synthesizer in PHP


I hope you all are well and enjoy my blog.
After long time a write a one blog for my best blog reader.

This post is regarding to text to speech. Its simply speech synthesizer. There are many things available but its limited to free.(open source).
In, this blog there is a free open source script for text to speech (Synthesizer) for all programming language. But for now I’m using PHP language for demo | example.

Here, there are many script for text to speech but mainly there are using other server for transferring the audio from third party server to own server.So, its take a time to execution | transferring the voice speech.
For example : Google, ResponsiveVoice.JS and many others.

There are many providers of Speech Synthesizer but mostly are paid , non-paid for non-commercial use , open source.
For example : Responsivevoice JS, Codecanyon Text To speech php js script, Espeak Sourceforge

Here, I’m using Espeak Sourceforge software because this is a free and open source.

Requirement:

Documents:

Steps:

  1. Download Software & install it. (If you are using windows then you can use windows install file otherwise you can use mac-os x or linux.)
  2. Set Path for “C:\Program Files (x86)\eSpeak\command_line”  espeak.exe  using environment variable.
    Set Path in Environment

    Set Path in Environment

    3. Check your path in command prompt:

    Check set path in cmd

    Check set path in cmd

     

    4. You can use text to speech (espeak) command directly to command prompt.
    For Example :  espeak “Darshak Shah”

    You can use many options like change voice of speaker, language, pitch etc… (Please refer document section for that).

    or 4. You can use this function (espeak) in any programming language.
           For Example (PHP) :

    <?php
    $rand=rand();
    $text=”Darshak Shah”;
    shell_exec(‘espeak -ven-us+f5  -z -s 160  -w “audio\\test\\’.$rand.’.wav” “‘.$text.'”‘);
    ?>
    Here, where : shell_exec()  is a function to call any external program from php.
    espeak : is a command
    -ven-us+f5  : -v is use for change the language | en-us for usa english and +f means female voice |   5 means version of female voice
    (please refer document section for more details of parameter)
    -w : save audio file into wav files

    Download Demo

    I hope you understand this tutorial. If you have any questions or confusion then please comment it.

 

 

 

 

 
Leave a comment

Posted by on January 18, 2016 in PHP

 

Tags: , , , , , , , , ,

how to handle dynamic multiple checkbox in php


<?php

if($_SERVER[‘REQUEST_METHOD’]==’POST’)
{
$str=””;
// if the chkbox selected then selected checkbox values are come otherwise its not come
foreach($_POST[‘chkbox’] as  $chkbox)
{
$str .=$chkbox.”,”;
}
echo $str;
echo substr($str,0,-1);//remove last one char (, comma) from this string
}

?>
<!– suppose you have dynamic checkbox. Those comes from database  . So, you can use loop but in this small example We used static. –>
<form action=”” method=”post”>
Name : <input type=”text” name=”nm” >
Check Box : <input type=”checkbox” name=”chkbox[]” value=”1″ > FootBall
<input type=”checkbox” name=”chkbox[]” value=”9″ > Cricket
<input type=”checkbox” name=”chkbox[]”  value=”3″> VollyBall
<input type=”checkbox” name=”chkbox[]”  value=”5″> Tennis
<input type=”submit” value=”Save”>

</form>

 
1 Comment

Posted by on July 14, 2015 in PHP

 

Tags: , ,

Remove the elements from array in php


<?php

$String_array=array(“a”,”b”,”c”,”d”);
$string_search=”c”;
echo “<pre>”;
print_r($String_array);
/*
OUTPUT OF print_r($string_array);
Array
(
[0] => a
[1] => b
[2] => c
[3] => d
)
Now, We have to remove “c” value of element [2] from array
*/
 unset($String_array[array_search($string_search, $String_array)]);

/*
* From Above code  :
* first search the element from the array using array_search($value_to_be_search,$array) function
* if search found the give the integer value otherwise not.
* if found then it unset the value using unset($variable); function
**/
print_r($String_array);
/*
OUTPUT OF print_r($string_array);
Array
(
[0] => a
[1] => b
[3] => d
)
I don’t like this above output because array key index are not in proper manner.
*/
 $String_array = array_values($String_array);
 print_r($String_array);
/*
* From Above code :
* array_values($array) function  is used (simple language) to rearrage the elemenets keys
* If not used this function then above output will be given.
* Using this function I will get below output.
* Array
(
[0] => a
[1] => b
[2] => d
)
*
* This method is very simple and sweet.
* More Info. :  
* http://php.net/manual/en/function.array-search.php
* http://php.net/manual/en/function.array-values.php
* http://php.net/manual/en/function.unset.php
*/

?>

 
Leave a comment

Posted by on July 4, 2015 in PHP

 

Tags: , , ,

Rotate Image using Jquery & PHP


Many Library available for rotating the image object.
But, here we are rotating the image object using Jquery, Ajax and PHP.

Here using PHP GD library for rotating the image object.

There are many options to rotate the image object.
But, here we using simple method.

Note: In this example We used jpeg format Image. If you have to use png or gif then you have to use other function for create image. For example : for jpeg => imagecreatefromjpeg($filename), imagejpeg($rotate,”test_rot.jpeg”); You have to change underline text according to image format.

PHP function for rotating the image object : imagerotate ==> Rotate an image with a given angle
Syntax :
resource imagerotate ( resource $image , float $angle , int $bgd_color [, int $ignore_transparent = 0 ] )

Where,
image : An image resource, returned by one of the image creation functions, such as imagecreatetruecolor().
angle : Rotation angle, in degrees. The rotation angle is interpreted as the number of degrees to rotate the image anticlockwise.
bgd_color : Specifies the color of the uncovered zone after the rotation
ignore_transparent : If set and non-zero, transparent colors are ignored (otherwise kept).

More info : http://php.net/manual/en/function.imagerotate.php

Simple Example :
          php_img_rotate.php :

<html>
<head>
<title>Simple Example : Rotating Images using PHP,Jquery & AJAX</title>
<!–  Include Jquery Lib. –>
<script type=”text/javascript” src=”http://code.jquery.com/jquery-2.1.4.min.js”></script >
</head>
<body>
<!– Image which We have to rotate –>
<img id=”img_” src=”test_rot.jpeg”>
<!– There are controllers which used for rotate the images Anti Clock or Clock wise  –>
<div>
<div class=”anti” style=”cursor: pointer”>Rotate Anti Clock Wise</div>
<div class=”clock” style=”cursor: pointer”>Rotate Clock Wise</div>
</div>
<!– Jquery Ajax Function for anti clock & Clock wise Rotate –>
<script type=”text/javascript”>
$(“.anti”).click(function()
{
$.ajax({
type:’POST’,
url:’ajax_img_rotate.php’,
data:”wh=anti”,
success:function(data)
{
//here we use this code for override the image. We use ?  because If we not write that then your image is not refesh and
// If you refesh whole page then it will be changed., So, we write ? .
document.getElementById(“img_”).src = document.getElementById(“img_”).src+ “?”;
}
});
})
$(“.clock”).click(function()
{
$.ajax({
type:’POST’,
url:’php_img_rotate.php’,
data:”wh=clock”,
success:function(data)
{
document.getElementById(“img_”).src = document.getElementById(“img_”).src+ “?”;
}
});
})
</script>
</body>
</html>

Now,
ajax_img_rotate.php
<?php
// File name. We can pass the image name for more dynamic
$filename = ‘test_rot.jpeg’;
if($_POST[‘wh’]==”clock”)  //Check Its clock wise rotate request or anti clock wise
{
$degrees = 360-90; // If clock wise then Degree is calculated here.
}else if($_POST[‘wh’]==”anti”)
{
$degrees = 90; /// If anti clock wise then Degree is calculated here.
}

// Load
//This function for jpeg format only if you have to use png or gif then you have to use different functions as per the image format
$source = imagecreatefromjpeg($filename);

// Rotate
$rotate = imagerotate($source, $degrees, 0);

// Output
//This function for jpeg format only if you have to use png or gif then you have to use different functions as per the image format
imagejpeg($rotate,”test_rot.jpeg”);

// Free the memory
imagedestroy($source);
imagedestroy($rotate);
?>

 
1 Comment

Posted by on June 27, 2015 in AJAX, Javascript & Jquery, PHP

 

Tags: , , , , , ,

 
%d bloggers like this: