<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Code snippets for </title>
    <link>http://www.uwec.edu/code/</link>
    <pubDate>Wed, 31 Oct 2007 14:48:28 GMT</pubDate>
    <description>UW-Eau Claire Web Development code snippets</description>
    <item>
      <title>Connect to MS Access using ASP</title>
      <link>http://www.uwec.edu/code/code_snippets/show/3</link>
      <description> 	This is a very fast way to connect to a Microsoft Access database. This code provides much more secure access and is the recommended way to make your connection.</description>
      <pubDate>Wed, 31 Oct 2007 14:48:28 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/3</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title> 	Add or Update Record using ADO</title>
      <link>http://www.uwec.edu/code/code_snippets/show/4</link>
      <description> 	Use ADO to add or update records instead of SQL statements. Easy to implement and debug.</description>
      <pubDate>Mon, 19 Jun 2006 19:38:23 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/4</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Show all server variables</title>
      <link>http://www.uwec.edu/code/code_snippets/show/5</link>
      <description> 	Shows all current server variables and their values. Great for debugging your application.</description>
      <pubDate>Wed, 25 Jan 2006 19:07:19 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/5</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Simple site search</title>
      <link>http://www.uwec.edu/code/code_snippets/show/7</link>
      <description>You can search through HTML, ASP, and text documents to match a search string. Can be called from another page.</description>
      <pubDate>Wed, 25 Jan 2006 19:09:01 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/7</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>File System Object - Write</title>
      <link>http://www.uwec.edu/code/code_snippets/show/8</link>
      <description> 	Use the File System Object to write to a text file on your server. This version allows you to append data to the file and will create the file if it does not exist</description>
      <pubDate>Wed, 25 Jan 2006 19:10:11 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/8</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>File System Object - Read File</title>
      <link>http://www.uwec.edu/code/code_snippets/show/9</link>
      <description> 	Use the File System Object to read data in from a file. Will loop through the contents of the file one line at a time</description>
      <pubDate>Wed, 25 Jan 2006 19:10:51 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/9</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Send Mail using JMail</title>
      <link>http://www.uwec.edu/code/code_snippets/show/10</link>
      <description>Example showing how to send mail using our servers and W3 JMail</description>
      <pubDate>Wed, 25 Jan 2006 19:13:22 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/10</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Authenticate Against Active Directory</title>
      <link>http://www.uwec.edu/code/code_snippets/show/11</link>
      <description> 	Uses the custom DEVLIB object to authenticate a username and password combination against Active Directory. This code will work only on UWEC servers.</description>
      <pubDate>Mon, 19 Jun 2006 19:36:35 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/11</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>TrimStart</title>
      <link>http://www.uwec.edu/code/code_snippets/show/12</link>
      <description> 	Trim the specified number of characters from the start of a string.</description>
      <pubDate>Mon, 19 Jun 2006 19:39:27 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/12</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title> 	Retrieve Username and Password from Basic Auth</title>
      <link>http://www.uwec.edu/code/code_snippets/show/13</link>
      <description> 	Use this code to retrieve the currently logged-in username and password when you use Basic Authentication</description>
      <pubDate>Mon, 19 Jun 2006 19:37:35 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/13</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Write and Read Cookies</title>
      <link>http://www.uwec.edu/code/code_snippets/show/14</link>
      <description>Access Cookies via ASP</description>
      <pubDate>Wed, 25 Jan 2006 20:01:22 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/14</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Handle "File In Use" with Access</title>
      <link>http://www.uwec.edu/code/code_snippets/show/15</link>
      <description>Simple code that can be used to handle exceptions when the database is locked by another user.</description>
      <pubDate>Wed, 25 Jan 2006 20:01:59 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/15</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Generate dropdown from database table</title>
      <link>http://www.uwec.edu/code/code_snippets/show/16</link>
      <description> 	A function that will create a dropdown list box from a set of data you specify
</description>
      <pubDate>Wed, 25 Jan 2006 20:03:24 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/16</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Microsoft SOAP Client example</title>
      <link>http://www.uwec.edu/code/code_snippets/show/17</link>
      <description> 	Use SOAP to connect to a WSDL (web service) that will return the current temperature for your zip code</description>
      <pubDate>Wed, 25 Jan 2006 20:04:43 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/17</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Zebra-Striped tables</title>
      <link>http://www.uwec.edu/code/code_snippets/show/18</link>
      <description>Alternate row colors for tables by simply adding this script to your HTML file..  This will be applied to all tables with the class &amp;quot;datatable&amp;quot; and any id</description>
      <pubDate>Tue, 20 Jun 2006 12:44:28 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/18</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Sortable tables</title>
      <link>http://www.uwec.edu/code/code_snippets/show/19</link>
      <description>Apply sortable table columns with only Javascript to any HTML table with the class &amp;quot;datatable&amp;quot; and any ID</description>
      <pubDate>Mon, 19 Jun 2006 19:37:07 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/19</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Paginate an existing resultset</title>
      <link>http://www.uwec.edu/code/code_snippets/show/20</link>
      <description>Sometimes you have a resultset that you can&amp;rsquo;t use with the built-in Rails pagination tool. This code below will fix the issue for you.</description>
      <pubDate>Mon, 19 Jun 2006 19:39:56 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/20</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Drop all user objects in your schema</title>
      <link>http://www.uwec.edu/code/code_snippets/show/21</link>
      <description>&lt;p&gt;Use this script to generate the drop statements for everything in your schema. You can then run these statements.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;This query is non-destructive, though it creates destructive results. &lt;br /&gt;&lt;/p&gt;</description>
      <pubDate>Mon, 19 Jun 2006 19:41:28 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/21</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Rails aliasing of database column names</title>
      <link>http://www.uwec.edu/code/code_snippets/show/22</link>
      <description>Use this code to create alias accessor methods for legacy models.  This allows you to use  *first_name*  instead of something like *employee_f_name_25_char&amp;quot;. </description>
      <pubDate>Mon, 19 Jun 2006 19:36:19 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/22</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Canned Validation</title>
      <link>http://www.uwec.edu/code/code_snippets/show/23</link>
      <description>These functions can be put in any page you call or include.  All you have to do is send it the post form a submited page.  The function will pull out the values and check them for errors and missing data.  All fields with bad data or missing data are put in the session under values witht the input name as the key.    In order to use this function properly the following naming convention MUST BE USED!  Text fields: txt Date fields: dt Year fields: yr Number fields: in Currency fields: am Email fields: em  Feel free to add data types!</description>
      <pubDate>Mon, 19 Jun 2006 19:42:17 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/23</guid>
      <author>ludwigaw)</author>
    </item>
    <item>
      <title>CAS authentication</title>
      <link>http://www.uwec.edu/code/code_snippets/show/24</link>
      <description>Include this file at the top of every page that you want to have CAS authentication on.  Note that this only authenticates that the person signing is is a UWEC user, but doesn&amp;#39;t take into account the role of the user.  Currently the username is stored into Session[uwecNetworkID], but can be changed for each application.  It also checks to see if the user has already been authenticated.</description>
      <pubDate>Mon, 19 Jun 2006 19:35:23 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/24</guid>
      <author>webermp)</author>
    </item>
    <item>
      <title>Auto Download</title>
      <link>http://www.uwec.edu/code/code_snippets/show/25</link>
      <description>Call this function, and the server will send the user a request to begin downloading a file instead of sending it through the browser (e.g. if you called the function on a PHP file, the server would allow the user to download the source code of that file instead of serving it)  Of course, that&amp;#39;s why this code contains exceptions that don&amp;#39;t allow you to download certain files to prevent that type of thing from happening.    To use, simply call the function dl_file(filename) with the filename.</description>
      <pubDate>Mon, 19 Jun 2006 19:42:02 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/25</guid>
      <author>webermp)</author>
    </item>
    <item>
      <title>Generate table DDL for Oracle schema</title>
      <link>http://www.uwec.edu/code/code_snippets/show/26</link>
      <description>This code can be used to generate the table DDL statements for all of the tables in a schema in Oracle.  It will save the DDL to a test file.

Before running this code make sure to change the file path to one that makes sense and replace SCHEMA_NAME with your actual schema name.</description>
      <pubDate>Thu, 02 Mar 2006 16:11:50 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/26</guid>
      <author>swanjr)</author>
    </item>
    <item>
      <title>CAS authentication for PHP</title>
      <link>http://www.uwec.edu/code/code_snippets/show/27</link>
      <description>Include this file at the top of every page that you want to have CAS authentication on. Note that this only authenticates that the person signing is is a UWEC user, but doesn&amp;rsquo;t take into account the role of the user. Currently the username is stored into $_Session[&amp;#39;uwecNetworkID&amp;#39;], but can be changed for each application. It also checks to see if the user has already been authenticated so it knows to not challenge the user again.  Note that the code requires &amp;#39;Request.php&amp;#39;, a file found from PHP Pear (http://pear.php.net/package/HTTP_Request).</description>
      <pubDate>Wed, 12 Jul 2006 17:49:52 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/27</guid>
      <author>webermp)</author>
    </item>
    <item>
      <title>min-height and expanding</title>
      <link>http://www.uwec.edu/code/code_snippets/show/28</link>
      <description>This code will allow min-height to work how you would expect it to in the major web-browsers.  IE6, Mozilla/Firefox/Gecko, Opera 7.x+, Safari1.2  credit:http://www.dustindiaz.com/min-height-fast-hack/</description>
      <pubDate>Mon, 19 Jun 2006 19:35:50 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/28</guid>
      <author>webermp)</author>
    </item>
    <item>
      <title>Global Class</title>
      <link>http://www.uwec.edu/code/code_snippets/show/29</link>
      <description>This class should be implemented on every PHP application.  It has been standardized and includes the major functions that are needed by every PHP application developed by webdev.  Simply include this at the top of every file in your app.

Note that any functions that return or require private variables are within the class (things like creating a connection), while functions that are essentially shortcuts for good coding practices are included at the end of the file outside for the GlobalClass object (like properlly terminating a session before calling a redirect).

A section is even included for you to add your functions that are specific to your own project.  </description>
      <pubDate>Thu, 02 Mar 2006 22:10:34 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/29</guid>
      <author>webermp)</author>
    </item>
    <item>
      <title>ASP-based file explorer</title>
      <link>http://www.uwec.edu/code/code_snippets/show/30</link>
      <description>Traverse files and folders on your server.</description>
      <pubDate>Thu, 20 Apr 2006 12:22:57 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/30</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Send data from child to parent window</title>
      <link>http://www.uwec.edu/code/code_snippets/show/31</link>
      <description>Use a child popup window to fill in fields on your parent window with this simple code example.  This code has not been validated and should be used only as a reference. </description>
      <pubDate>Tue, 20 Jun 2006 18:49:54 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/31</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>XHTML Transitional template</title>
      <link>http://www.uwec.edu/code/code_snippets/show/32</link>
      <description>Basic XHTML 1.0 Transitional template.</description>
      <pubDate>Mon, 19 Jun 2006 19:33:30 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/32</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Allow addition in Hashes</title>
      <link>http://www.uwec.edu/code/code_snippets/show/33</link>
      <description>Allows you to do   x = { :a =&amp;gt; 1 } y = { :b =&amp;gt; 2 }  # x + y =&amp;gt; { :a =&amp;gt; 1, :b =&amp;gt; 2 }, but x and y are untouched # x + { :c =&amp;gt; 3 } =&amp;gt; { :a =&amp;gt; 1, :c =&amp;gt; 3 }</description>
      <pubDate>Mon, 19 Jun 2006 19:33:59 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/33</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Comma-format numbers</title>
      <link>http://www.uwec.edu/code/code_snippets/show/34</link>
      <description>Ruby implementation of the well-known comma regular expression.  format_with_commas 1222343561234 would return &amp;quot;1,222,343,561,234&amp;quot;</description>
      <pubDate>Mon, 19 Jun 2006 19:33:46 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/34</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>States options array</title>
      <link>http://www.uwec.edu/code/code_snippets/show/35</link>
      <description>Array of states that can be used with the select helper.</description>
      <pubDate>Mon, 19 Jun 2006 19:33:15 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/35</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>URL Encoding</title>
      <link>http://www.uwec.edu/code/code_snippets/show/36</link>
      <description>Quickly encode URLs in Ruby.</description>
      <pubDate>Mon, 19 Jun 2006 19:33:02 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/36</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Use one action for get and post</title>
      <link>http://www.uwec.edu/code/code_snippets/show/37</link>
      <description>Simple example that shows how to use a single controller action to handle both get and post requests.  This really comes in handy for those situations where you need to handle multiple objects.</description>
      <pubDate>Mon, 19 Jun 2006 19:32:48 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/37</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Add a random method to the Array class</title>
      <link>http://www.uwec.edu/code/code_snippets/show/38</link>
      <description>Adds a handy function that lets you randomly pick n elements from an array.</description>
      <pubDate>Mon, 19 Jun 2006 19:32:28 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/38</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Numbers to ordinals</title>
      <link>http://www.uwec.edu/code/code_snippets/show/39</link>
      <description>number_to_ordinal(12) =&amp;gt; &amp;quot;12th&amp;quot; number_to_ordinal(7) =&amp;gt; &amp;quot;7th&amp;quot;  Note that floats will be converted to ints (without rounding) before processing.</description>
      <pubDate>Mon, 19 Jun 2006 19:32:17 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/39</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>MS SQL Stored Procedure from ASP</title>
      <link>http://www.uwec.edu/code/code_snippets/show/40</link>
      <description>This is the preferred way to call a stored procedure from ASP.  The number one reason to use this method is that it is nearly self-documenting. Without looking at the SQL Stored Procedure, the developer can tell what parameters are being sent, their data types, and their sizes.  Also, this method can validate the data types before they go to the SQL Server. For example, if you passed a string into a parameter requiring an adInteger data type using this method, the ASP would fail before the command was executed, saving valuable resources.   This method is also required if the stored procedure returns output parameters.  </description>
      <pubDate>Mon, 19 Jun 2006 19:31:56 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/40</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Check all / Uncheck All</title>
      <link>http://www.uwec.edu/code/code_snippets/show/41</link>
      <description>Simple check all / uncheck all. This code snippet requires the Prototype library.</description>
      <pubDate>Fri, 30 Jun 2006 14:18:09 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/41</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Simple Excel export</title>
      <link>http://www.uwec.edu/code/code_snippets/show/42</link>
      <description>This is a really simple technique we&amp;#39;ve used to export data from a web-based system to an Excel spreadsheet. Since Excel documents are XML-based, simply creating a valid structured HTML page and serving it with the correct MIME header causes Excel to handle the document.  </description>
      <pubDate>Tue, 14 Nov 2006 16:42:29 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/42</guid>
      <author>hoganbp)</author>
    </item>
    <item>
      <title>Query data in chunks with ActiveRecord</title>
      <link>http://www.uwec.edu/code/code_snippets/show/43</link>
      <description>If you have to iterate over massive data sets, you don&amp;#39;t want to have to use the standard #find method, as it will be extremely memory intensive. Instead, you should work on data in chunks. This code uses limit and offset to chunk up your data. You can then work on the pieces within the block. </description>
      <pubDate>Tue, 12 Feb 2008 06:56:07 GMT</pubDate>
      <guid>http://www.uwec.edu/code/code_snippets/show/43</guid>
      <author>ludwigaw)</author>
    </item>
  </channel>
</rss>
