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

Using colorbox(a jquery plugin) ajax in a complex situation

Colorbox is a lightweight customizable lightbox plugin for jQuery.

I am using colorbox for another perpose: to show a (semi!) modal window to show information on ajax call.

You can get the plugin here .

Here I’ll give a simple example how to load ajax data and show through colorbox plugin. In second phase i’ll try to give the scenario of the complex situation and give the solution. Though the solution looks so obvious now, i had to go through lots of other solutions (Not worthy for that situation).

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!

ফরম ব্যবহার না করে js দিয়ে newTab-এ data পাঠানো…

আমার মনে হয় এই পোস্টটি অনেকের কাজে আসবে।

খুবি সোজা technique. আমি example দিচ্ছি।

ধরুন আপনি ফরম submit/use না করেই javascript ব্যবহার করে কোন page -এ data পঠাতে চাচ্ছেন, এবং new page’ টি আপনি new Tab-এ open করতে চাচ্ছেন।

আনাকে যা করতে হবে তা হল-

এ্কটি js function লেখা।- Continue reading