Size conversion filter using AngularJS

Following code should give you a clean and simple example of custom filter using AngularJS.

HTML code:

<!doctype html>
<html >
<script src=”src=””></script >
<script src=”filter.js“></script>
<div ng-app=”testFilterApp“>
<label>Size in Byte:</label>
<input type=”text” ng-model=”sizeInB” placeholder=”Enter a name here”>
<h2>Human Readable Size (precision:3) {{sizeInB | sizeConverter:3}}!</h2>
<h2>Human Readable Size (precision: not defined) {{sizeInB | sizeConverter}}!</h2>

Continue reading

jQuery Ajax Tooltip

This is very much based on the Coda Popup Bubble example for jQuery that’s been going around with a few important differences:

  1. The information is requested via AJAX, so you don’t have to include all of this extra information in a hidden div. This keeps your markup smaller for grids with tons of names in it.
  2. When you mouse over another name, the previous one will disappear. If you tried this with the original Coda example, you’d end up with a weird streaking animation since there’s a delay before the div is hidden.
  3. Works in IE (just turned off the fade animation)


Continue reading

Php page redirection problem

So far i did web development I used javascript redirection. But recently i needed to do that with php. But i got stacked with some annoying problems.
1. Headers are already sent.
2. SESSION variables are not setting.

1. Ok, now here javascript again rescue me see how.

function redirect($url) {
	if(!headers_sent()) {
	        //If headers not sent yet... then do php redirect
	        header('Location: '.$url);
	else {
	        //If headers are sent... do javascript redirect
	        echo '';
	        echo 'window.location.href="'.$url.'";';
	        echo '';
	        echo '';
	        echo '';
	        echo '';

What you need to do just call this method with your desired parameter.

2.-> And now number second! SESSION variables are not setting means you are not getting SESSION variables from redirected page.
The solution is never forget to add “exit;” like a added here.

If you are stilling facing second problem, may you forgot to start session in that page!

A nice script to upload a image and re-sizing them

echo "You have exceeded the size limit";

if($extension=="jpg" || $extension=="jpeg" ){
$uploadedfile = $_FILES['file']['tmp_name'];
$src = imagecreatefromjpeg($uploadedfile);
else if($extension=="png"){
$uploadedfile = $_FILES['file']['tmp_name'];
$src = imagecreatefrompng($uploadedfile);
else {
$src = imagecreatefromgif($uploadedfile);






$filename = "images/small/". $_FILES['file']['name'];
$filename1 = "images/small/". $_FILES['file']['name'];


//If no errors registred, print the success message

// mysql_query("update SQL statement ");
echo "Image Uploaded Successfully!";