Get rid of restarting problem in nokia 3110

nokia-3110-classicI have a nokia phone, it’s model is 3110 classic and i use it as a modem to connect with internet. So i don’t use this phone as any call purpose, only internet.

But most problem with this handset is the restarting problem. It don’t get restarted if you don’t use any memory card. But if you use any, in my case i can’t turn on my phone most of the time while the memory card remain inserted. It turns on and become switched of in a looping process.

I was so mad with this because i can’t use any memory card and can’t listen any songs and also can’t take any photo while visiting some place. Once i thought to take the phone to the customer care center, but it takes too many time in the nokia care at Rajshahi (a division of Bangladesh). A simple problem took 16 days to solve that i saw to happen to some of my friends. So it was a great problem for me because i use the set as a modem.

Now come to the point. To solve the problem you need to update your phone firmwire and i was not sure that i can update it with my usb data cable.

Nokia Software Update

My phone’s firmwire version was 6.01 or something but it was 6 LOL. After updating the firmwire the version becomes 7.21 To download the updater software visit the nokia web site.
It’s size is arround 23 MB, so download it. You can also check is there any update for your phone or not? Follow the link here.

Now install the updater and follow the instructions. It’s simple. In my case, the after installing the updater software again it downloaded a package of about 22 MB.
I am not sure that it was downloaded only in my case. So what, follow the process. It’s really simple. After installing the updates my mobile is running without any problem.

Happy mobiling :P

Image upload & Validation: My first class to phpclasses.org

Recently i had to work with image uploading on my some projects. The issue was to upload the user avatar and rename the avatar’s with their userid. So that it will be easy to work with avatar system.

I first used this idea to one of my project and i did this with procedural method. But again on my current projects i need this facility again. So i thought to finish the job for the last time and decided to make a class to re-use the codes. So here i go…

Firstly, i use my class constructor to define the maximum file size, width, height and also the upload directory. So now create a instance of my class like this-

<?php
//$image = new ImageUloader($max_size, $max_width, $max_height, $upload_dir)
$image = new ImageUploader(26, 200, 150, 'images/avatar/');
?>

Now you need to set the image name to upload. Don’t be afraid, it’s the file input field name of your html form if you have a input file name like this -

<form enctype="multipart/form-data" action="" method="POST">
	<input name="input_field_name" type="file" />
    <input type="submit" name="submit" value="Change Avatar" />
</form>

Then you need to setup the image name like this

<?php
$image->setImage('input_field_name');
?>

Now it’s time for validation process :D
you can check the image size, width, height and also file type by the following method

<?php
$image->checkSize();
$image->checkHeight();
$image->checkWidth();
$image->checkExt();
?>

This method’s return true, if the condition are passed. We have permitted to use only jpg, jped, png and gif files. So lets use them

<?php
if(!$image->checkSize())
	$errors[] = "File size is Big";
		
if(!$image->checkHeight())
	$errors[] = "File height is Big";
		
if(!$image->checkWidth())
	$errors[] = "File width is Big";
		
if(!$image->checkExt())
	$errors[] = "File ext is not supported";
?>

So if the condition are passed, we will set the name of the file to be uploaded and now it’s the time to check if there any file with the same user id. If their is any file with same user id, we delete them for the sake of our need and upload them. By deleting the existing file with same user id clears the confusion of repeating same file name with same user id. Because, their is a possibility to found images with same file name but with different extensions.

<?php
if(!isset($errors)){
		$image->setImageName($userid);
		$image->deleteExisting();
		$image->upload();
		
		echo "<h2>Avatar Changed Successfully</h2>";
	}
	else{
		echo "<h2>You must correct the errors to proceed</h2><br>";
		print_r($errors);
	}
?>

So here is the complete code for validating and uploading

<?php
if(isset($_POST['submit'])){
	require 'class.imageupload.php';
	
	//$image = new ImageUloader($max_size, $max_width, $max_height, $upload_dir)
	$image = new ImageUploader(26, 200, 150, 'images/avatar/');
	$image->setImage('input_field_name');
	
	if(!$image->checkSize())
		$errors[] = "File size is Big";
		
	if(!$image->checkHeight())
		$errors[] = "File height is Big";
		
	if(!$image->checkWidth())
		$errors[] = "File width is Big";
		
	if(!$image->checkExt())
		$errors[] = "File ext is not supported";
		
	if(!isset($errors)){
		$image->setImageName($userid);
		$image->deleteExisting();
		$image->upload();
		
		echo "<h2>Avatar Changed Successfully</h2>";
	}
	else{
		echo "<h2>You must correct the errors to proceed</h2><br>";
		print_r($errors);
	}
}
?>

<form enctype="multipart/form-data" action="" method="POST">
	<input name="input_field_name" type="file" />
    <input type="submit" name="submit" value="Change Avatar" />
</form>

Download the class form here