Posts

Create Directory in PHP

if (! is_dir ( 'path/to/directory' )) { mkdir ( 'path/to/directory' ); }

Generate CSV file in PHP

<?php     function query_to_csv ( $db_conn , $query , $filename , $attachment = false , $headers = true ) {                 if( $attachment ) {             // send response headers to the browser             header ( 'Content-Type: text/csv' );             header ( 'Content-Disposition: attachment;filename=' . $filename );             $fp = fopen ( 'php://output' , 'w' );         } else {             $fp = fopen ( $filename , 'w' );         }                 $result = mysql_query ( $query , $db_conn ) or die( mysql_error ( $db_conn ) );                 if( $headers ) {             // output header row (if at least one row exists)             $row = mysql_fetch_assoc ( $result );             if( $row ) {                 fputcsv ( $fp , array_keys ( $row ));                 // reset pointer back to beginning                 mysql_data_seek ( $result , 0 );             }         }                 while( $row = mysql_fetch

3 Ways To Import Data Into Microsoft Dynamics GP – Integration Manager, eConnect & Web Services

A powerful capability of Microsoft Dynamics GP is the ability to integrate data from other sources into GP.   Microsoft offers a couple technology solutions; some ISVs have leveraged those to provide tools with more sophisticated front-ends.   Microsoft tools for importing data into GP include: the Integration Manager, eConnect, and Web Services.  The Integration Manager (IM) is offered as a separate application from GP and is used to import data into GP. IM is a graphical application and is designed to be easy to use. Programming skills are not required to define data integrations.  IM might be considered a “power user” tool (specifically when designing and mapping integrations), although any user can run integrations that have been defined.  eConnect is a set of files, tools, and services that allow applications to integrate with Microsoft Dynamics GP data.  eConnect contains a special set of SQL stored procedures that are installed in each GP company database.  Th

How to create webservice ?

URL to call webservice:   http://mydomain.com/web-service.php?user=2&num=10   -------------------------------------------------------   Sample code : /* require the user as the parameter */ if ( isset ( $_GET [ 'user' ] ) && intval ( $_GET [ 'user' ] ) ) { /* soak in the passed variable or set our own */ $number_of_posts = isset ( $_GET [ 'num' ] ) ? intval ( $_GET [ 'num' ] ) : 10 ; //10 is the default $format = strtolower ( $_GET [ 'format' ] ) == 'json' ? 'json' : 'xml' ; //xml is the default $user_id = intval ( $_GET [ 'user' ] ) ; //no default /* connect to the db */ $link = mysql_connect ( 'localhost' , 'username' , 'password' ) or die ( 'Cannot connect to the DB' ) ; mysql_select_db ( 'db_name' , $link ) or die ( 'Cannot select the DB' ) ; /* grab the posts from the db */ $query = "SELECT

How to Add Cron Job in Hostmonster

Recently I had to create a cron job on a HostMonster server to run a PHP script every X minutes. If you’ve ever searched for a tutorial on how to do this, you’ll know it’s no easy thing to find. After fumbling around and failing for a while, I finally managed to work the kinks out of the job. For those interested, the method I used was: */15 * * * * /ramdisk/bin/php5 /home/—hostmonster username here—/public_html/path/to/script.php The asterisks designate time frequency of the job, in the following order: minute (0-59), hour (0-23), day (1-31), month (1-12 or jan, feb, mar, etc), weekday (0-6 where Sunday is 0 or 7 OR sun, mon, tue, etc). So mine means ‘run once every fifteen minutes’. The ‘*’ means every. If you wanted to run once an hour, it’d be ‘0 * * * *’ meaning ‘run at :00 of each new hour’. Because I want to run a PHP script, I called PHP through the shell with ‘/ramdisk/bin/php5′. Alternatively, I could’ve used [and have succesfully] ‘php’ and ‘/usr/bin/php’, but HostMo

How to get duplicate confirmation latter for service book/

Duplicate Service Book for Teachers

Password protect RAR files using WinRAR..

1)Right click on the file for which u want the password to b put. 2)Click on "Add to Archive". 3)Then go to Advanced tab. 4)Click on set password...choose any passwd. 5)Click ok. 6)A winrar file with ur filename will be created. 7)Next u may delete the original file,as u have now compressed it with a password. 8)Any1 tryin to open the rar file wont be able to,unless he knows the passwd.