Get me outta here!

Farsim

My Dream I Care Most…

Menu

Skip to content
  • Home
  • About
  • About Me
  • Contact

Author Archives

Farsimhttp://farsim.meI'am Simply Simple

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

October 18, 2012 by Farsim

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 →

23.709921 90.407143
Porgramming ajaxcolorboxjavascriptjqueryphp 2 Comments

Insert line breaks into a long string to fit a length : Minimizing the risk of cutting a word unexpectedly

July 16, 2012 by Farsim

import java.util.Calendar;
import java.util.Date;
 
 
public class test {
  public static void main(String[] argv) {
	  String s = "Here, startIndex specifies the beginning index, and endIndex specifies the stopping point. The string returned contains all the characters from the beginning index, up to, but not including, the ending index. The following program uses substring( ) to replace all instances of one substring with another within a string:";// used to insert any string or character at the specified position in the given string."; 	  
      int charsPerLine = 10;
      System.out.println(insertLinebreaks(s, charsPerLine));	     
  }
  
  public static String insertLinebreaks(String s, int charsPerLine){	  
      String[] tokens = s.split(" ");
      String temp="";
      String retS = "";
      int maxRightPadding = 5; // Increasing the value'll minimize the risk of cutting a word unexpectedly, but woun't give good performance to break continuous string(without space/br). 
	  
      for (int i=0; i charsPerLine){
	      if((charsPerLine - temp.length()) <= maxRightPadding){
		  retS = retS+temp+ "\n";				  
		  for(int o=0; o<= (tokens[i].length()/charsPerLine); o++){
		      if(o< tokens[i].length()/charsPerLine){						  
			  retS = retS + tokens[i].substring((o*charsPerLine), ((o*charsPerLine) + charsPerLine))+"\n";
		      }
						  
		      if(o == tokens[i].length()/charsPerLine){						  
			  temp = tokens[i].substring(o*charsPerLine);							  						 				 
		      }						  
		  }
	     }else{
		  retS = retS+temp+ "\n";
		  temp = tokens[i];				  				 
	     }
	 }else{
	     if((temp.length() + tokens[i].length()) <= charsPerLine){				  
		 temp = temp+" "+tokens[i];				 
	     }
	     else{				 
		 retS = retS+ temp + "\n";				 
		 temp = tokens[i];
	     }
         }		  		 		  
     }
     retS = retS +temp+ "\n";
     return retS;	  
  }  
}
23.709921 90.407143
Uncategorized JavaStringString processing Leave a comment

jQuery Ajax Tooltip

July 8, 2012 by Farsim

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)

Image

Continue reading →

23.709921 90.407143
Uncategorized ajaxjqueryphptooltipweb Leave a comment

Get JSON data using jQuery AJAX from a PHP page

June 29, 2012 by Farsim

Today I’ll show you simple procedure to get JSON data using jQuery AJAX from a PHP page.

Dependencies: Put jQuery library in same folder named after jquery.js. You can get jquery here .
Need a server to run php.

Now put jquery.js, AJAXtestJSON.php and AJAXJSONdata.php in same folder in server.

Here is the code of AJAXtestJSON.php

Here is the code of AJAXJSONdata.php

23.709921 90.407143
Uncategorized Leave a comment

Handling checkbox in a PHP form processor

March 25, 2012 by Farsim

This tutorial will introduce HTML check boxes and how to deal with them in PHP.

Single check box

Let’s create a simple form with a single check box.

<form action="checkbox-form.php" method="post">

 Do you need wheelchair access?

<input type="checkbox" name="formWheelchair" value="Yes" />

<input type="submit" name="formSubmit" value="Submit" />

</form>
Continue reading →
23.709921 90.407143
Uncategorized Leave a comment

25 Google Search Tips

March 22, 2012 by Farsim

We all love Google. It’s a great place to search and find things that we do not know about. The beauty of Google is its all powerful algorithm that executes billions of search queries. In addition to showing top notch search results, Google’s algorithm has a few interesting features.

We’ll be taking a look at a few tips that can help us tap into the full power of Google.

World Time

World Time

World Time

time cityname
cityname time

Want to know what’s the current local time in a city across the globe? Google can help you. Continue reading →

23.709921 90.407143
Uncategorized googlesearchingTips Leave a comment

Useful Links for XSS

March 18, 2012 by Farsim

Open Web Application Security Project (OWASP): OWASP
The Hackersonline club: Hackersonlinehelp

23.709921 90.407143
Uncategorized usefull linksweb securityweb technologiesXSS Leave a comment

Php page redirection problem

March 3, 2012 by Farsim

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);
	        exit;
	} 
	else {
	        //If headers are sent... do javascript redirect
	        echo '';
	        echo 'window.location.href="'.$url.'";';
	        echo '';
	        echo '';
	        echo '';
	        echo '';
	        exit;
	}
}

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!

23.709921 90.407143
Uncategorized javascriptphpSESSIONweb Leave a comment

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

March 1, 2012 by Farsim

MAX_SIZE*1024){
echo "You have exceeded the size limit";
$errors=1;
}

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);
}

list($width,$height)=getimagesize($uploadedfile);

$newwidth=60;
$newheight=($height/$width)*$newwidth;
$tmp=imagecreatetruecolor($newwidth,$newheight);

$newwidth1=25;
$newheight1=($height/$width)*$newwidth1;
$tmp1=imagecreatetruecolor($newwidth1,$newheight1);

imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);

imagecopyresampled($tmp1,$src,0,0,0,0,$newwidth1,$newheight1,$width,$height);

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

imagejpeg($tmp,$filename,100);
imagejpeg($tmp1,$filename1,100);

imagedestroy($src);
imagedestroy($tmp);
imagedestroy($tmp1);
}
}
}
//If no errors registred, print the success message

if(!$errors)
{
// mysql_query("update SQL statement ");
echo "Image Uploaded Successfully!";
}
23.709921 90.407143
Uncategorized image uploadphpweb 1 Comment

Google map embedding problem in website

February 23, 2012 by Farsim

Have you ever face an error like “ Refused to display document because display forbidden by X-Frame-Options.” in error console while nothing is shown after embedding google map to your website?

There is a very easy solution to that. Just add “&output=embed” in the source link.

23.709921 90.407143
Uncategorized googleMapmaps.googleweb development Leave a comment

Post navigation

← Older posts
Newer posts →

Search

Calendar

February 2023
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728  
« Mar    

Tag Cloud

.htaccess ajax AngularJS Animation apache barrel roll Basic C++ colorbox configure Debugging Dependancy Injection design Eclips Eclipse eCommerec File Framework fun Game google HR Management I/O illustrator image upload Interview Java javascript Java Swing JEE jquery JSE Map maps.google Motivation MVC mySql opencart OpenGL pagination photoshop php phpMyAdmin pyGame python RMI searching Security server SESSION software Software Engineering Spring String String processing Symbian Symbian C++ Symbina UI Design Tips tooltip Troubleshooting UI UI Design usefull links web web development web security website web technologies windows7 xampp XSS

Top Posts & Pages

  • jHipster step by step - null to hello world
  • Eclipse (Juno) is not initializing suddenly!
  • Size conversion filter using AngularJS
  • Funny JSP parser!
  • Eclipse Debugging

Archives

  • March 2016 (1)
  • August 2013 (1)
  • April 2013 (2)
  • January 2013 (2)
  • December 2012 (1)
  • November 2012 (2)
  • October 2012 (2)
  • July 2012 (2)
  • June 2012 (1)
  • March 2012 (5)
  • February 2012 (4)
  • January 2012 (2)
  • December 2011 (1)
  • November 2011 (5)
  • October 2011 (1)
  • August 2011 (1)
  • July 2011 (3)
  • June 2011 (1)
  • May 2011 (3)
  • January 2011 (1)

Blogs I Follow

Author Grid

সাদাসিধে কথা আর্কাইভ

মুহম্মদ জাফর ইকবাল এর কলামগুলোর সংগ্রহ

Farsim
  • Follow Following
    • Farsim
    • Already have a WordPress.com account? Log in now.
    • Farsim
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...