Sanjoy Roy

[MCM, MCP, SCJP] – Senior PHP Programmer

Daily Archives: 03/10/2009

Daylight Saving in Victoria


https://i2.wp.com/www.vic.gov.au/kernel/user_files/Images/OnSite/DaylightSaving1forward.gif
At start of daylight saving period, move clock forward one hour at 2 am.

https://i0.wp.com/www.vic.gov.au/kernel/user_files/Images/OnSite/DaylightSaving2back.gif
At end of daylight saving period, move clock back one hour at 3 am.
2009/2010
Victoria’s period of daylight saving will start at 2:00am on Sunday 4 October 2009. At 2:00am move clocks forward one hour to 3:00am.
Victoria’s period of daylight saving will end on Sunday 4 April 2010. At 3:00am move clocks backward one hour to 2:00am.
2010/2011
Victoria’s period of daylight saving will start at 2:00am on Sunday 3 October 2010. At 2:00am move clocks forward one hour to 3:00am.
Victoria’s period of daylight saving will end on Sunday 3 April 2011. At 3:00am move clocks backward one hour to 2:00am.
Source

Advertisements

Ten Rules for a Good Day!


  • TODAY I WILL NOT STRIKE BACK – If someone is rude, if someone is impatient, if someone is unkindI will not respond in a like manner.
  • TODAY I WILL ASK GOD TO BLESS MY ENEMY – If I come across someone who treats me harshly or unfairly, I will quietly ask God to bless that individual. I understand the enemy could be a family member, neighbor, co-worker, or a stranger.
  • TODAY I WILL BE CAREFUL ABOUT WHAT I SAY – I will carefully choose and guard my words being certain that I do not spread gossip.
  • TODAY I WILL GO THE EXTRA MILE – I will find ways to help share the burden of another person.
  • TODAY I WILL FORGIVE – I will forgive any hurts or injuries that come my way.
  • TODAY I WILL DO SOMETHING NICE FOR SOMEONE, BUT I WILL NOT DO IT SECRETLY – I will reach out anonymously and bless the life of another.
  • TODAY I WILL TREAT OTHERS THE WAY I WISH TO BE TREATED – I will practice the golden rule Do unto others as I would have them do unto me with everyone I encounter.
  • TODAY I WILL RAISE THE SPIRITS OF SOMEONE I DISCOURAGED – My smile, my words, my expression of support, can make the difference to someone who is wrestling life.
  • TODAY I WILL NUTURE MY BODY – I will eat less; I will eat only healthy foods. I will thank God for my body.
  • TODAY I WILL GROW SPIRITUALLUY – I will spend a little more time in prayer today: I will begin reading something spiritual or inspirational today; I will find a quiet place (at some point during the day)!

Can u take 10 seconds away from ur busy schedule?


Here is a chance to make a difference, by devoting JUST 10 seconds a day.
You don’t need to go anywhere, donate money, stage protests or shout slogans.
How? If you use computer to work, just remember to switch off your monitor every time you leave your desk. Very simple, isn’t it?
What difference does it make? Roughly, normal monitors consume around 150 W.
Even if your screen remains ON for 1 hour per day without any use, energy wasted per day is 150 W-h (or 0.15 ‘units’).
This is enough to light a small lamp for 10 hours! If you care to switch off your monitor each time you leave your place, you save electricity enough for basic household needs of a small family in a village!
If your monitor remains ON overnight, this figure becomes 10-fold ,so you can probably save electricity for 10 families.
And supposing that you leave your seat 5 times a day and it takes 1 second to switch the monitor ON/OFF,
you spend only 10 seconds a day for this deed which saves LOTS of energy on a long run!
I hope you will follow this practice…
Energy saved is energy produced !!

How to change the default theme in ExtJS


  • Download a theme from the extjs server. Please note that you need to register before you download the theme.
  • Copy the .css file (e.g xtheme-slate.css) to the resouces/css/xtheme-slate.css directory.
  • Copy the slate folder to the resouces/images/slate directory.
  • Copy the following line to the head section of your html/php file.

Parse .xls (Excel) using PHP


XLSParser.php:

if ($fileType !='' && $fileType == 'application/vnd.ms-excel'){
		//parse xsl file
		 $ext = 'xls';
		 $filename 	= $user.'.'.$section.'.upload.'.date('Ymd').'.'.$ext;
		 copy($_FILES['file']['tmp_name'], $UPLOAD_CSV_PATH.$filename);
		 require_once '../includes/reader.php';

		$data = new Spreadsheet_Excel_Reader();
		 //set output encoding
		$data->setOutputEncoding('CP1251');
		//read the excel file through api
		$data->read($UPLOAD_CSV_PATH.$filename);
		//prepare to retun result
		$actual_data = $data->sheets[0]['cells'];

		$rowsLength	= array();
		for($i=1; $i<$max_nos; $j++){
				$allColumns[$j] = $actual_data[$i][$j];
			}
			$newRowData[] =  $allColumns;
		}
		$data = $newRowData;
  }

Parse .CSV using PHP


CSVParser.php:

if ($fileType !='' && $fileType == 'text/comma-separated-values'){
		//parse csv file
		 $ext = 'csv';
		 $filename 	= $user.'.'.$section.'.upload.'.date('Ymd').'.'.$ext;
		 copy($_FILES['file']['tmp_name'], $UPLOAD_CSV_PATH.$filename);

		 $row 				= 1;
		$fhandle 			= @fopen($UPLOAD_CSV_PATH.$filename, "r");
		$columnHeaders		= '';
		$columnNames		= '';
		$rawData			= array();
		$count = 0;
		while (($fdata = fgetcsv($fhandle, 1000, $terminated_by, $enclosed_by)) !== FALSE) {
			$len = count($fdata)-1;
			if (strlen($fdata[$len])==0) array_pop($fdata);
			$rawData[$count] = $fdata;
			$count++;
		}
		fclose($fhandle);

		$newRowData = array();

		for($i=0; $iencode($rawData);

  }

Parse XML Spreadsheet using PHP DOMDocument


xmlparser.html:

File Name:  
Options: Column Heading Included
Column Heading & Name Included
Just Data
 
Hidden Parameters:

 

xmlparser.php:

$fileType 	= isset($_FILES['file']['type']) ? $_FILES['file']['type']: '';
if ($fileType !='' && $fileType == 'text/xml'){
	  $ext = 'xml';
	  if ($_FILES['file']['tmp_name']){
	  	  //Copy to the backup directory
	  	  $filename 	= $user.'.'.$section.'.upload.'.date('Ymd').'.'.$ext;
		  copy($_FILES['file']['tmp_name'], $UPLOAD_CSV_PATH.$filename);
		  //parse xml spredsheet
		  $dom 		= DOMDocument::load($UPLOAD_CSV_PATH.$filename);
		  $rows 	= $dom->getElementsByTagName('Row');
		  $data		= array();

		  foreach ($rows as $row){
			  $index 	= 1;
			  $cells 	= $row->getElementsByTagName('Cell');
			  $tempdata = array();
			  foreach( $cells as $cell ){
				  $ind = $cell->getAttribute('Index');
				  if ( $ind != null ) $index = $ind;
				  //echo $cell->nodeValue."
"; $tempdata[] = $cell->nodeValue; $index += 1; }//inner for loop $data[] = implode(",", $tempdata); }//outer for loop }//outer if (file temp_name compare) }
%d bloggers like this: