Make Out Aakash Tablet

I have seen Aakash in news since 2009. It was earlier known as Sakshat. In this blog I would like to write about both good and bad of Aakash tablet.

[important]Aakash tablet will be sold to Government of India at $49.[/important]

[warning]Though it received fair reviews, there is no hands-on test[/warning]

Cheapest Tablet Ever 

The device will be sold to Government of India at $49.  The Government of India even distributed 500 free tablets to students from different parts of India who had come to attend the press conference for release of Aakash tablet by HRD minister Kabil Sibal in the capital. The Aakash tablet will be available for students at a subsidized price, which would bring down its value to $35 (Rs. 17,00) making it the cheapest tablet ever.

Datawind, the manufacturer of Aakash tablet, it will start its new production center in Hyderabad.

Excitements of Aakash Tablet

  • 7 inch touch screen
  • 800 X 480 resolution
  • 2 GB internal flash memory
  • 32 GB expandable micro SD memory card
  • Android 2.2 Froyo OS
  • GPRS & WiFi enabled
  • available with an affordable Internet plan of Rs.98/2GB per month
  • 3G enabled using a dongle

Controversial of Aakash Tablet

  • Its Wi-Fi only version, meaning only those at the elite educational institutions can use it.
  • Though it received fair reviews, there is no hands-on test
  • The internet plan of Rs.98/2GB per month is only on its commercial version not in the subsidy version those being sold to the Government of India for distribution to students.
I am not seeing it as DOA (dead on arrival), but keeping the controversial part of Aakash tablet, would help to make out this device. Feel free to comment my post.

Permanent link to this article: https://blog.openshell.in/2011/10/make-out-aakash-tablet/

session-start – headers already sent

This happens when you try to start session more than once.

[php]
The solution for above problem is

1) in php.ini file set session.autostart to 0

session.auto_start = 0

2) Placing a .htaccess file in the root of your web directory with the following value:

php_flag session.auto_start 0

3) In your code use this line

if (!session_id()) session_start();

instead of

session_start();
[/php]

Permanent link to this article: https://blog.openshell.in/2011/10/1263/

PHP characters limitation

Characters limitation will helps to display limited number of characters to display.

[php]
function limit_characters( $str, $n )
{
if ( strlen ( $str ) <= $n )
{
return $str;
}
else {
return substr ( $str, 0, $n ) . ‘…’;
}
}
[/php]

Permanent link to this article: https://blog.openshell.in/2011/09/php-characters-limitation/

Resize image in specified height & width while upload

Resizing images in specified height & width while uploading files to the server.

[php]
/*
Create a thumbnail of $srcFile and save it to $destFile.
The thumbnail will be $width pixels.
*/
function createThumbnail($srcFile, $destFile, $new_w, $new_h, $quality = 75)
{
$thumbnail = ”;

if (file_exists($srcFile) && isset($destFile))
{
$size = getimagesize($srcFile);
$old_x = $size[0];
$old_y = $size[1];
$ratio1=$old_x/$new_w;
$ratio2=$old_y/$new_h;
if($ratio1>$ratio2) {
$thumb_w=$new_w;
$thumb_h=$old_y/$ratio1;
}
else {
$thumb_h=$new_h;
$thumb_w=$old_x/$ratio2;
}

$thumbnail = copyImage($srcFile, $destFile, $thumb_w, $thumb_h, $quality);
}

// return the thumbnail file name on sucess or blank on fail
return basename($thumbnail);
}

/*
Copy an image to a destination file. The destination
image size will be $w X $h pixels
*/
function copyImage($srcFile, $destFile, $w, $h, $quality = 75)
{
$tmpSrc = pathinfo(strtolower($srcFile));
$tmpDest = pathinfo(strtolower($destFile));
$size = getimagesize($srcFile);

if ($tmpDest[‘extension’] == "gif" || $tmpDest[‘extension’] == "jpg")
{
$destFile = substr_replace($destFile, ‘jpg’, -3);
$dest = imagecreatetruecolor($w, $h);
imageantialias($dest, TRUE);
} elseif ($tmpDest[‘extension’] == "png") {
$dest = imagecreatetruecolor($w, $h);
imageantialias($dest, TRUE);
} else {
return false;
}

switch($size[2])
{
case 1: //GIF
$src = imagecreatefromgif($srcFile);
break;
case 2: //JPEG
$src = imagecreatefromjpeg($srcFile);
break;
case 3: //PNG
$src = imagecreatefrompng($srcFile);
break;
default:
return false;
break;
}

imagecopyresampled($dest, $src, 0, 0, 0, 0, $w, $h, $size[0], $size[1]);

switch($size[2])
{
case 1:
case 2:
imagejpeg($dest,$destFile, $quality);
break;
case 3:
imagepng($dest,$destFile);
}
return $destFile;

}
[/php]

Permanent link to this article: https://blog.openshell.in/2011/09/resize-image-in-specified-height-width-while-upload/

PHP Automatic Session Logout

Automatic logout script if users have inactive more than 15 minutes

[php]
<?php
session_start();
$inactive = 900; // Set timeout period in seconds

if (isset($_SESSION[‘timeout’])) {
$session_life = time() – $_SESSION[‘timeout’];
if ($session_life > $inactive) {
session_destroy();
header("Location: logoutpage.php");
}
}
$_SESSION[‘timeout’] = time();
?>
[/php]

Permanent link to this article: https://blog.openshell.in/2011/09/php-automatic-session-logout/

PHP MYSQL ORDER BY Multiple Columns

If you want to Order 2 or more columns in SQL Query. When ordering by more than one column, the second column is only used if the values are identical with the onces in the first column.

Example
[sql]
‘Order by Column
ORDER BY COLUMN1, COLUMN2
[/sql]

Order 2 or more columns with different orders

Example
[sql]
‘Order by Column
ORDER BY COLUMN1 ASC, COLUMN2 DESC
[/sql]

Permanent link to this article: https://blog.openshell.in/2011/09/php-mysql-order-by-multiple-columns/

String Function in PHP

nl2br():

The nl2br() function adds the
tag if it finds the carriage return (n) in the text. If you text is long and at many places carriage return is present, even then the nl2br() tag will replace all the occurrence of the carriage return with
tag.

Here is the syntax of the nl2br() tag:

[php]
<?php
$myString ="Welcome to openshell blog.nnHere you can share & earn knowledge";
echo nl2br($myString);

?>
[/php]

ucfirst():

The ucfirst() function converts the first character of a string to uppercase.

Here is the syntax of the ucfirst() tag:

[php]
<?php
echo ucfirst("welcome to openshell");
?>
[/php]

ucwords():

The ucwords() function converts the first character of each word in a string to uppercase.

Here is the syntax of the ucwords() tag:

[php]
<?php
echo ucwords("welcome to openshell");
?>
[/php]

quotemeta():

The quotemeta() function adds backslashes in front of some predefined characters in a string. This function can be used to escape characters with special meanings, such as ( ), [ ], and * in SQL.

Here is the syntax of the quotemeta() tag:

[php]
<?php
$str = "Welcome to our blog. (Whether its useful?)";
echo quotemeta($str);
?>

[/php]

Permanent link to this article: https://blog.openshell.in/2011/08/string-function-in-php/

String Functions in PHP [heredoc syntax]

The heredoc syntax:
In addition of the single quote and double quote syntaxex, PHP provides another way to specify a string called heredoc syntax. This syntax turns out to be a extremely useful for specifiying large chunks of variable-interpolated text, because it spares you from the need to escape internal quotation marks. It is especially useful in creating pages that contain HTML Forms.

The Operator in the heredoc syntax is < <

For Example:

[php]
<?php
$content = <<<EOD
Example of string’s
spanning multiple lines
using heredoc syntax.
EOD;
?>
[/php]

Permanent link to this article: https://blog.openshell.in/2011/08/string-functions-in-php-heredoc-syntax/

Setting up dual ip address in ubuntu

Hi,

here is a simple way to setup dual ip in your ubuntu system if you already have eth0 as 192.168.0.10 then if you want 192.168.1.10 then use the following command to bring up a alias but this is temporary

sudo ifconfig eth0:0 192.168.1.11 up

To have a permanent dual ip update the /etc/network/interfaces file like the below

gksudo gedit /etc/network/interfaces

andadd the following content to the end of the file

auto eth0:0

iface eth0:0 inet static

address 192.168.1.10

netmask 255.255.255.0

broadcast 192.168.1.255

network 192.168.1.0

Save the file and restart system or restart the network using the following command

sudo /etc/init.d/networking restart

Permanent link to this article: https://blog.openshell.in/2011/08/setting-up-dual-ip-address-in-ubuntu/

Using Dialup modems in ubuntu

hi all,

Everyone will be familiar with configuring wired and wireless network in Ubuntu. But still at some point of time we may have the need to use dialup modem in ubuntu. here is a simple way to configure dialup modems in ubuntu.

The following command will install gnome-ppp which is a gui based configuration tool for dialup modems.

sudo apt-get install gnome-ppp

after installation invoke the application using the following command

gksudo gnome-ppp

the above command will invoke the window where you can find all the option to configure a dialup connection and there you can find setup option where you will set the modem and other things.

alternate solution is to use wvdial using the following command

sudo apt-get install wvdial

Gnome-ppp uses wvdial as its backend to configure the dialup connection

wvdial uses “.wvdial.conf  ” hidden file which is available in your home directory. you have to configure all the options of the modem.

Another alternate is to use pppconf

sudo pppconf

the above command will invoke a terminal based gui with easy steps to configure the dial up connection. provide the above command and follow the onscreen function(easy like configuring in windows create a dial up connection wizard type).

pppconf gives the users to create more than one connection The following are the commands used to dial the connection disconnect the connection and to view the log

pon

poff

plog

If you have more than one connection

pon <connection name>

eg:

pon myairtelconn 

pon mybsnl

Note: the easy way is to use gnome-ppp

Permanent link to this article: https://blog.openshell.in/2011/08/using-dialup-modems-in-ubuntu/