Thursday, January 6, 2011

Convert Image To Text

Last time, Ivan wrote a tutorial to convert any image in to text format using PHP code. But that seems to have much friendliness with people having basic knowledge about coding. This time I researched in web if there are any free and small softwares that can do the job easily.

Shamelessly, I found it after 7 days of continuous search in several search engines, including Bing, Yahoo and Google. And you’ll be surprised to know that, this software is 11 years old. The original author of this tool is Steve Seymour.

Let’s have a look what it can do.

First of all download it from here.

You don’t need to install it, its an independent executable file.

The user interface is easily made and with no such hard turns. Click on Open image to load the image you want to convert to text. But make sure that the image is proper JPEG image.

Once the image is loaded, it will be displayed in the upper horizontal row. Below the right side of image, you can see the resolution and character numbers settings. This will determine the length of the characters in rows and columns. The lowest value 2 gives the highest possible resolution for the image. While the character’s size and resolution goes decreasing for the increasing value of 2+.

Once you are done with the image settings, click on Convert button to convert it to text.

The image will be converted to characters and you can easily copy or save it from Copy Text or Save Text button.

Paste it in any text editor, you’ll get the final result similar to the one below:

Monday, January 3, 2011

Defining a Function |PHP Tutorial For Beginners

Defining a Function |PHP Tutorial For Beginners

Posted: 12 Sep 2010 04:58 AM PDT

This is complete step by step tutorials that will help you learn basics about defining a PHP functions.


What is function?

A function is a named block of code that performs a specific task, possibly acting upon a set of values given to it, or parameters , and possibly returning a single value. Functions save on compile time no matter how many times you call them, functions are compiled only once for the page. They also improve reliability by allowing you to fix any bugs in one place, rather than everywhere you perform a task, and they improve readability by isolating code that performs specific tasks.


Function Syntax


To define a function, use the following syntax:

function [&] function_name ( [ parameter [, ... ] ] )
{
statement list
}


Example – sum of two numbers

Let’s take a look at a simple function. Example 1 takes two numbers, sum them, and then returns the result

function sum($number1, $number2)
{
$sumNumbers=$number1 + $number2 ;
return $sumNumbers;
}

?>

The function takes two arguments, $number1 and $number2. Using the + operator, the function sum the numbers in the variable $sumNumbers. Finally, we return the value $sumNumber.

How to call function sum?


echo sum(1, 2);

Output will be 3

or

$num1=1;
$num2=2;
echo sum($num1, $num2
);