Craig Thrall

Previous | Page 8 of 13 | Next

mod_authnz_ldap and Active Directory

Aug. 4, 2008, 9:45 p.m.

So, if you are running Apache 2.2 and you want to authenticate against Active Directory, turns out you have choices. You can use mod_auth_sspi if your server is a member of the domain you want to authenticate against for that shiny seamless "look ma, no credential popup!" kinda feeling (be forewarned that I couldn't find <b>any</b> documentation for mod_auth_sspi, even with a thorough Googling). But if your server isn't on the domain, but maybe in a grimy corner of the customer's network, you can use mod_authnz_ldap. Rock on. Luckily, I stumbled across <a href="http://www.jejik.com/articles/2007/06/apache_and_subversion_authentication_with_microsoft_active_directory/">this article by Sander Marechal</a> with some awesome instructions on how to configure Apache 2.2. Thank you, Sander, thank you.

SSL on Apache 2.2 with Windows

July 14, 2008, 8:13 a.m.

I'm collecting information on generating a SSL cert using an internal CA cert using OpenSSL with Apache 2.2 on Windows. I found most of the OpenSSL info <a href="http://www.tc.umn.edu/~brams006/selfsign.html">on this page</a>. This will be work in progress until I am done. You'll need: <ul> <li>Apache 2.2 install with OpenSSL. I used the Windows installer, which includes the openssl binary. It looks like installing the Cygwin OpenSSL package will also install this binary, but I don't know if it is compatible with the version of OpenSSL that ships with Apache.</li> <li>CA cert for your organization (.cer).</li> <li>Private key file for CA cert (.key).</li> </ul> <ol> <li>Open a command prompt and set the OPENSSL_CONF variable to point to the local Apache OpenSSL config file: <code>set OPENSSL_CONF=c:\Program Files\Apache Software Foundation\Apache 2.2\conf\openssl.cnf</code>. Note: do NOT use double quotes.</li> <li>Generate the private key for your server: <code>openssl genrsa -des3 -out server.key 4096</code></li> <li>Create and sign certificate request: <code>openssl req -new -key server.key -out server.csr</code></li> </ol>

SQL Server: Compound update/select

July 3, 2008, 10:02 p.m.

I am learning SQL. Slowly. I mean, beyond <a href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete">CRUD</a>dy stuff to <a href="http://philip.greenspun.com/sql">more advanced queries</a>. I wanted to reserve the first unused element in an object pool that I'm storing in SQL Server. Turns out you can do that in one compound query: <code> update poolTable set consumerId='someid' where poolObjectId=(select top 1 poolObjectId from poolTable where poolObjectId is null); </code> Training wheels? Still on. But learning.

Handling Drop Down Events in a YUI DataTable

July 2, 2008, 8:48 p.m.

Ok, I am blatantly copy/pasting stuff from the manual now, but again I like how little work I have to do to handle events from the data table: <pre> myTable.subscribe("dropdownChangeEvent", function(oArgs) { var elDropdown = oArgs.target; var oRecord = userTable.getRecord(elDropdown); doSomething(oRecord.getData("fieldname"), elDropdown.selectedIndex); }); </pre> And since doSomething just reuses my function to send an AJAX request, everything gets updated for me. Now, one question I have is since I'm using a somewhat hacky method of using Prototype to send requests, would it be cleaner to use YUI? Am I missing some caching that could be happening?

YUI DataTable Static Cell Content

July 2, 2008, 1:04 p.m.

So, I want to have a "Delete" link for each row. This is where the DataTable cell formatters come in handy. Write a formatter that will call a JavaScript function. You have access to all your data for that row, so it is easy to pass that data along. <code> var deleteFormatter = function(elCell, oRecord, oColumn, sData) { elCell.innerHTML = "<a href='#' onclick=delete('" + oRecord.getData("fieldname") + "')>Delete</a>"; } </code> Then, in your column definition for the data table, just use that formatter. <code> {key:"del", formatter:deleteFormatter, label:"Delete"} </code> I am using a weird mix of YUI and Prototype, as I haven't invested the time in figuring out YUI's request model yet. But what I realized is I can reuse my response handler that I wrote for adding data to update the table after deleting rows as well. Sweet.

Refresh a YUI DataTable

July 2, 2008, 12:59 p.m.

How to get my DataTable to refresh? <code> userTable.getDataSource().sendRequest( '', { success: userTable.onDataReturnInitializeTable, scope: userTable });</code> This will tell the data source to send a request to the remote server, then redraw the table. I got it off the internets at <a href="http://www.satyam.com.ar/yui/">this site</a>. Looks like there is more good stuff there for us YUI n00bs.

Yahoo! UI DataTable and DataSource Errors

July 1, 2008, 9:46 a.m.

A couple notes as I learn how to use this framework (note that I am using 2.5.1, the latest version is 2.5.2 so I need to upgrade today): <ul> <li>If you see "Data Error." in your table, make sure you have included all the necessary dependencies.</li> <li>If you see "Loading Data..." and you get a JavaScript error along the lines of "oRequest is null or not an object," make sure the URL you constructed your DataSource with contains a "?", even if it's unnecessary and is the last character in the URL.</li> </ul>

Apache 1.3 to 2.2 With PHP 5

June 29, 2008, 9:14 p.m.

We are upgrading Apache to 2.2. We have been using 1.3 because our vendor doesn't support 2.2 yet, but it no longer made sense to stay with 1.3 when we didn't need to for some applications. And the Windows authentication support has been more or less abandoned for 1.3. Note that if you do need to stay with 1.3 for some reason and you are running mod_ntlm, you really need to look at installing <a href="http://www.jamiekerwick.co.uk/?page_id=5">this patch</a>. A former co-worker made the original changes, which include AD support and fixing a couple issues that result in the username/password dialog popping up multiple times. Anyway, I installed 2.2 on my dev server. I had to make a couple minor changes to get PHP working: <ul> <li>I am using mod_alias to create an alias that points at a directory in Subversion. I had to explicitly add a new Directory element for that Subversion directory, along with "Allow from all" to be able to use my alias.</li> <li>Changed my LoadModule from php5apache.dll to php5apache2_2.dll in httpd.conf.</li> <li>Added "AddType application/x-httpd-php .php" in httpd.conf.</li> </ul>

Tomcat Logging

May 8, 2008, 5:17 p.m.

I wrote <a href="http://www.mobilitytech.com/wiki/TomcatLogging">this page about Tomcat logging</a> three years ago. I have no idea if it's still relevant, because I haven't been doing anything in that world for a little while, but it might help you.

PHP 5.2.5 and php.ini on Windows

April 25, 2008, 8:38 a.m.

I installed PHP 5.2.5 using the MSI installer, installed Smarty and changed my PHP config file (php.ini) to add Smarty to the path. But according to phpinfo(), my php.ini path was C:\Windows and the loaded config file was "(None)". I looked at another previous install. You have to create a system environment variable named PHPRC that points to the location of your php.ini file (usually C:\Program Files\PHP), then reboot.