Latest recipes tagged "old"http://code.activestate.com/recipes/tags/old/new/2013-02-10T00:40:26-08:00ActiveState Code Recipesphp backwards compatibility porting tips (PHP) 2013-02-10T00:40:26-08:00imam feriantohttp://code.activestate.com/recipes/users/633541/http://code.activestate.com/recipes/578452-php-backwards-compatibility-porting-tips/ <p style="color: grey"> PHP recipe 578452 by <a href="/recipes/users/633541/">imam ferianto</a> (<a href="/recipes/tags/backwards/">backwards</a>, <a href="/recipes/tags/compatibility/">compatibility</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/php4/">php4</a>, <a href="/recipes/tags/php5/">php5</a>). </p> <p>Hello again, on december 2012, I was porting my old php code (php4) to new php 5.4.3. There are to many errors within code, especially for session, eregi, global variables and others. This some pieces step for compatibility porting:</p> <ol> <li><p>add global variable definiton on some function that need outside variable &lt;code&gt; function getuser(){ global $loginid,$password; } &lt;/code&gt;</p></li> <li><p>replace eregi(/find/,str) with preg_match(//,str)</p></li> <li><p>add function exists for function that not exists in php5.4.3. for example: &lt;code&gt; if(!function_exists("session_is_registered")){ function session_is_registered($var){ return isset($_SESSION[$var]); } } if(!function_exists("session_register")){ function session_register($var){ $_SESSION[$var]=$_GLOBALS[$var]; } } &lt;/code&gt;</p></li> </ol> <p>Ok there is my tips, how about you? </p> Windows Registry: Search & Destroy (Python) 2012-07-12T12:23:05-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578209-windows-registry-search-destroy/ <p style="color: grey"> Python recipe 578209 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/delete/">delete</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/search/">search</a>, <a href="/recipes/tags/windows_registry/">windows_registry</a>). </p> <p>If you know that your registry has useless information in it and want to remove entries, this recipe was provide you with a simple way of accomplishing such a purpose. After entering strings to match and causing an EOF, the program will search for what you entered, and is designed to automatically delete what was requested. This is committed for archival to be run under Python 2.5 or later versions.</p> Human Population Simulator (Python) 2012-07-13T14:37:26-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578208-human-population-simulator/ <p style="color: grey"> Python recipe 578208 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/human/">human</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/populate/">populate</a>, <a href="/recipes/tags/simulation/">simulation</a>). Revision 2. </p> <p>After wondering about how populations can increase in size, a simulator was written with a very simplistic model for total human growth. This is the result of an old experiment and served its purpose well at the time. This is committed for archival to be run under Python 2.5 or later versions.</p> Console CD Player (Python) 2012-07-11T12:26:10-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578207-console-cd-player/ <p style="color: grey"> Python recipe 578207 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/console/">console</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/playback/">playback</a>). </p> <p>You have probably seen many different GUI programs that can play music on CDs. Well, here is a console-based recipe that can do the same thing. This is committed for archival to be run under Python 2.5 or later versions.</p> Zero (Batch) Programs (Python) 2012-07-10T12:37:37-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578205-zero-batch-programs/ <p style="color: grey"> Python recipe 578205 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/batch/">batch</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/processing/">processing</a>, <a href="/recipes/tags/utility/">utility</a>). Revision 2. </p> <p>Having written many programs that work with groups of files, the zero programs were written based on a simple batch engine in the <code>zero</code> utility. All of the other programs import the first program to take advantage of its batch processor while supplementing there own functionality in place of zeroing out file data. This is committed for archival to be run under Python 2.5 or later versions.</p> Custom Windows Alarm Clock (Python) 2012-07-10T17:27:48-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578204-custom-windows-alarm-clock/ <p style="color: grey"> Python recipe 578204 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/alarm/">alarm</a>, <a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/clock/">clock</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/utility/">utility</a>). </p> <p>After writing a few alarms using <code>winsound.Beep</code>, desire to expand into other sound possibilities led to the writing of this program using <code>winsound.PlaySound</code>. The sounds are stored in a custom format (some experimentation in archiving files). This is committed for archival to be run under Python 2.5 or later versions.</p> Rookie's Backup Program (Python) 2012-07-08T00:52:05-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578199-rookies-backup-program/ <p style="color: grey"> Python recipe 578199 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/copy/">copy</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/utility/">utility</a>). </p> <p>A while back when still fairly new to Python, this simple program was developed to back directories of information. In reality, it is just a simple (and poorly written) file copier that could be greatly improved. This is committed for archival to be run under Python 2.5 or later versions.</p> Directory & File Counter (Python) 2012-07-07T22:07:51-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578197-directory-file-counter/ <p style="color: grey"> Python recipe 578197 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/utility/">utility</a>). </p> <p>This recipe manually counts the number of sub-directories and files can be found in a directory. It was an experimental program from long ago used to learn more about Python. This is committed for archival to be run under Python 2.5 or later versions.</p> Linux to Windows (Python) 2012-07-04T01:18:50-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578192-linux-to-windows/ <p style="color: grey"> Python recipe 578192 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/commandline/">commandline</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/utility/">utility</a>). </p> <p>When trying to work with Linux archive downloaded onto Windows, sometimes it is helpful to untar all found archives, give extension-less files the "txt" extension, and convert text files to Windows line endings (\r\n), and that is just what this program is designed to accomplish. This is committed for archival to be run under Python 2.5 or later versions.</p> Extract Multiple TAR Files & Directories (Python) 2012-07-04T00:57:37-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578191-extract-multiple-tar-files-directories/ <p style="color: grey"> Python recipe 578191 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/commandline/">commandline</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/tarfile/">tarfile</a>). </p> <p>Related to the popular <a href="http://code.activestate.com/recipes/442503/">recipe 442503</a>, this command-line program takes multiple TAR files or directories and can extract them in a batch operation. This is committed for archival to be run under Python 2.5 or later versions.</p> Pants (Python) 2012-07-03T05:31:24-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578188-pants/ <p style="color: grey"> Python recipe 578188 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/programs/">programs</a>, <a href="/recipes/tags/shell/">shell</a>). </p> <p>According to memory this is a port of a shell script called pants that allows one to "start," "stop," "restart," and find the "status" of one's pants (the program itself). I am not sure what the silliness is about but must have found the idea interesting to rewrite in Python. This is committed for archival to be run under Python 2.5 or later versions.</p> Calendar Maker (Python) 2012-07-03T05:23:57-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578187-calendar-maker/ <p style="color: grey"> Python recipe 578187 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/calendar/">calendar</a>, <a href="/recipes/tags/cgi/">cgi</a>, <a href="/recipes/tags/old/">old</a>). </p> <p>This is an old program experimenting with CGI techniques in Python using <code>CGIHTTPServer</code> and designed for creating calendars. This is committed for archival to be run under Python 2.5 or later versions.</p> CGI Image Viewer (Python) 2012-07-02T22:52:32-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578186-cgi-image-viewer/ <p style="color: grey"> Python recipe 578186 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/cgi/">cgi</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/old/">old</a>). </p> <p>If you have ever started a program and never finished it, then you may recognize the code below for what it is: an experiment begun but not completed, meant to allow viewing pictures on a server. It is included here as an exercise for the reader to complete and is committed for archival to be run under Python 2.5 or later versions.</p> Zcgi Test (Python) 2012-07-02T22:44:58-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578185-zcgi-test/ <p style="color: grey"> Python recipe 578185 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/cgi/">cgi</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/test/">test</a>). </p> <p>While trying to implement a bare-bones CGI module with little support for the then-new-to-me concept, the <code>Zcgi</code> module was written, and this experiment was designed to test what it could do. This is committed for archival to be run under Python 2.5 or later versions.</p> Page Counter (Python) 2012-07-02T22:41:43-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578184-page-counter/ <p style="color: grey"> Python recipe 578184 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/achive/">achive</a>, <a href="/recipes/tags/cgi/">cgi</a>, <a href="/recipes/tags/counter/">counter</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/page/">page</a>). </p> <p>This page counter was a CGI experiment in what it would take to implement such a simple concept. This is committed for archival to be run under Python 2.5 or later versions.</p> CGI Directory Contents (Python) 2012-07-02T22:38:31-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578183-cgi-directory-contents/ <p style="color: grey"> Python recipe 578183 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/cgi/">cgi</a>, <a href="/recipes/tags/directory/">directory</a>, <a href="/recipes/tags/old/">old</a>). </p> <p>CGI Directory Contents was a simple experiment meant to work similarly to the <code>os.listdir</code> function in Python. This is committed for archival to be run under Python 2.5 or later versions.</p> IP Address (Python) 2012-07-02T22:34:13-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578182-ip-address/ <p style="color: grey"> Python recipe 578182 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/cgi/">cgi</a>, <a href="/recipes/tags/ip/">ip</a>, <a href="/recipes/tags/old/">old</a>). </p> <p>The following was a CGI experiment for finding out the IP address of a connecting client. This is committed for archival to be run under Python 2.5 or later versions.</p> Python Viewer (Python) 2012-07-02T22:29:27-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578181-python-viewer/ <p style="color: grey"> Python recipe 578181 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/archive/">archive</a>, <a href="/recipes/tags/cgi/">cgi</a>, <a href="/recipes/tags/old/">old</a>, <a href="/recipes/tags/viewer/">viewer</a>). </p> <p>This was a CGI experiment from many years ago for viewing Python files on a server. This is committed for archival to be run under Python 2.5 or later versions.</p>