satishgaudo.com

Understanding technology

Archive for June, 2009

Function to get the recursive folder structure of the destionation folder

/** * getDirStructure * get the recursive folder structure of the destionation folder * @param string $path folder path * @param array array resultant folders and files * @access public */ public function getDirStructure($path, &$a, $sOriginalZipFilepath){ $aDir=array(); $aFiles=array(); $nd=0; $nf=0; $hndl=opendir($path); while($file=readdir($hndl)){ if ($file ==’.’ || $file==’..’) continue; if (is_dir($path.’/’.$file)){ $aDir[$nd++]=$file; } else{ $aFiles[$nf++]=$file; } } closedir($hndl); $n=1; for ($i=0;$i<count($aDir);$i++){ $this->getDirStructure($path.’/’.$aDir[$i].’/', $a[$n]); $a[$n++][0]=str_replace("//","/",$path.$aDir[$i]); } for ($i=0;$i<count($aFiles);$i++){ $a[$n++]=str_replace("//","/",$path.$aFiles[$i]); } }

15 June 2009 at 20:24 - Comments
twmujczf at 23:50 on 14 July 2009
thanks . i was searching for this code
Vaibhav at 11:20 on 29 January 2010
Hi Satish, Good work dude ...

Example script for exexuting an mssql stored procedure in php

$package_code = ‘AUS03B’; $client_id = 499; $conn = odbc_connect(DSN,USER,PASS,SQL_CUR_USE_ODBC); //SQL_CUR_USE_IF_NEEDED,SQL_CUR_USE_ODBC ,SQL_CUR_USE_DRIVER SQL_CUR_DEFAULT $sql_result = odbc_prepare($conn, "EXEC usp_packagesearch_xml ‘$package_code’,'$client_id’"); $result = odbc_execute($sql_result); //$string = odbc_result($sql_result,1); $string = odbc_result_all($sql_result,"border=1");

15 June 2009 at 20:22 - Comments

Send mail :Through sql / pl in oracle

create or replace PROCEDURE send_mail (p_sender IN VARCHAR2, p_recipient IN VARCHAR2, p_message IN VARCHAR2) as l_mailhost VARCHAR2(255) := ‘192.168.1.21′; l_mail_conn utl_smtp.connection; BEGIN l_mail_conn := utl_smtp.open_connection(l_mailhost, 25); utl_smtp.helo(l_mail_conn, l_mailhost); utl_smtp.mail(l_mail_conn, p_sender); utl_smtp.rcpt(l_mail_conn, p_recipient); utl_smtp.open_data(l_mail_conn ); utl_smtp.write_data(l_mail_conn, p_message); utl_smtp.close_data(l_mail_conn ); utl_smtp.quit(l_mail_conn); end; /

Now execute the procedure above:

begin send_mail( ’satishg@imageonline.co.in’, ‘rolvy@imageonline.co.in’, ‘Hello Tom’ ); end; /

14 June 2009 at 00:42 - Comments
jacky green at 19:20 on 18 August 2009
I really liked your blog! keep it up

Bit of oracle

All the system tables that stores the user defined tables/sequences/object types :   user_types   USER_TYPE_ATTRS   user_sequences   user_tables   USER_TAB_COLUMNS   Code for creating a table for already existing table:   CREATE TABLE HIP_TASK_INFO_satish as SELECT HIP_TASK_ID ,   HIP_TASK_ID as HIP_TASK_BUDGET_ID, HIP_TASK_ID as HIP_DUTY_DETAIL_ID, IS_ACTIVE, IS_DELETE, ADDDT FROM HIP_TASK_INFO   Command to rename table :   RENAME HIP_TASK_INFO_satish TO HIP_TASK_INFO ;   Code example for limits implementaion:   SELECT temp.*,rownum FROM (   SELECT sp.company_name, sp.contact_phone, sp.office_fax, sp.sub_id, sb.branch_id, sb.branch_url, sp.Office_Address.Address1 || ‘, [...]

14 June 2009 at 00:40 - Comments

function to check for valid date

function validDate(sDatePassed) { //if the date is in dd/mm/yyyy format then valid date returns 1else 0 if (sDatePassed.length > 0) { aDate = sDatePassed.split("/"); if (aDate.length != 3) return(0); if (aDate[1].length == 1) aDate[1]= "0"+aDate[1]; var iLeapyear = 0; // check whether the year is leap year – aleap year is div by 4 ,100, 400 if ((aDate[2] % 4) == [...]

14 June 2009 at 00:30 - Comments
livelybrowsers at 22:54 on 19 October 2010
Thanks for good stuff
aparadekto at 03:11 on 27 October 2010
Hey, I can't view your site properly within Opera, I actually hope you look into fixing this.

Google Wave

Google Wave is a new tool for communication and collaboration on the web, coming later this year. The service seems to combine Gmail and Google Docs into an interesting free-form workspace that could be used to write documents collaboratively, plan events, play games or discuss a recent news.

“In Google Wave you create a wave and add [...]

14 June 2009 at 00:22 - Comments