<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>PsyBlog</title>
			<link>http://www.psykel.com/blog/index.cfm</link>
			<description>psyBlog - random ramblings of a web developer</description>
			<language>en-us</language>
			<pubDate>Mon, 08 Jun 2026 21:35:36-0700</pubDate>
			<lastBuildDate>Tue, 07 Aug 2007 13:54:00-0700</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>erikv@psykel.com</managingEditor>
			<webMaster>erikv@psykel.com</webMaster>
			
			
			
			
			
			<item>
				<title>Chrome CSS Drop Down Menu Offsets with Centered Pages</title>
				<link>http://www.psykel.com/blog/index.cfm/2007/8/7/Chrome-CSS-Drop-Down-Menu-Offsets-with-Centered-Pages</link>
				<description>
				
				I decided to try &lt;a href=&quot;http://www.dynamicdrive.com/&quot;&gt;Chrome CSS Menu&lt;/a&gt; on a project I&apos;m working on.  While I&apos;d love a pure CSS solution, I don&apos;t have time to roll my own, and everything I saw relies on fixed width parent elements.  The Chrome menu is very easy to drop into your existing CSS html.

The one problem I had was using this menu with a fixed-width, centered page.  For example, a 900 pixel wide page, centered:

&lt;code&gt;
&lt;style&gt;
div#ie_fix {
        text-align:center;
        }
 
div#container {
	margin: 0 auto 0 auto;
	text-align: left;
	width:900px;
	position:relative;
	}
&lt;/style&gt;

&lt;div id=&quot;ie_fix&quot;&gt;
&lt;div id=&quot;container&quot;&gt;
***MAIN PAGE GOES HERE***
&lt;/div&gt;
&lt;/div&gt;
&lt;/code&gt;

I really needed that &lt;em&gt;container&lt;/em&gt; div to be positioned relative, and that was making the drop down menu offsets off by whatever the left page margin happened to be.

My solution was to change (hack) the chrome.js file to stop spidering up the parent elements when it hit that &lt;em&gt;container&lt;/em&gt; div.

Make this:
&lt;code&gt;
while (parentEl!=null)
&lt;/code&gt;

Into this:
&lt;code&gt;
while (parentEl!=null &amp;&amp; parentEl.id!=&apos;container&apos;)
&lt;/code&gt;
				
				</description>
						
				
				<category>web</category>				
				
				<pubDate>Tue, 07 Aug 2007 13:54:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2007/8/7/Chrome-CSS-Drop-Down-Menu-Offsets-with-Centered-Pages</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>fckeditor and AJAX</title>
				<link>http://www.psykel.com/blog/index.cfm/2007/8/2/fckeditor-and-AJAX</link>
				<description>
				
				fckeditor is cool, and so is AJAX.  I&apos;ve never used them together until today, and it&apos;s quite simple.  

One gotcha that was killing me - if/when you use Javascript to send the contents of the fckeditor window, keep these few things in mind (for use with ColdFusion, BTW):

&lt;ul&gt;
&lt;li&gt;Assuming you have a submit button that sends the contents to a JS function, use this to grab that content:
&lt;code&gt;
FCKeditorAPI.GetInstance(&apos;myInstance&apos;).GetXHTML());
&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;And if/when you send your data from JS to CF, be sure to use the javascript &lt;i&gt;encode&lt;/i&gt; function:
&lt;code&gt;
var foo = encode(FCKeditorAPI.GetInstance(&apos;myInstance&apos;).GetXHTML()));
&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;And if/when you use CF to work with that data, decode it with &lt;i&gt;urldecode&lt;/i&gt;:
&lt;code&gt;
&lt;cfset fixedContent = urldecode(incomingData)&gt;
&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
				
				</description>
						
				
				<category>web</category>				
				
				<pubDate>Thu, 02 Aug 2007 00:22:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2007/8/2/fckeditor-and-AJAX</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Nested CASE in SQL</title>
				<link>http://www.psykel.com/blog/index.cfm/2007/7/11/Nested-CASE-in-SQL</link>
				<description>
				
				There&apos;s nothing especially difficult about nesting CASE statements in SQL, but I guess it could be confusing sometimes.

Here&apos;s an example:

&lt;code&gt;
case [group]
	when &apos;C&apos; then
		case control
			when 1 then 
					case phase
						when 1 then &apos;Initial Diary&apos;
						when 2 then &apos;8 week pause&apos;
						when 3 then &apos;Ending Diary&apos;
						else &apos;unknown&apos;
					end
			else
					case phase
						when 1 then &apos;Initial Diary&apos;
						when 2 then &apos;Learing Modules&apos;
						when 3 then &apos;Ending Diary&apos;
						else &apos;unknown&apos;
					end
		end
	when &apos;P&apos; then &apos;Parent Modules&apos;
end as phaseText
&lt;/code&gt;
				
				</description>
						
				
				<category>Database</category>				
				
				<pubDate>Wed, 11 Jul 2007 12:17:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2007/7/11/Nested-CASE-in-SQL</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Editing single files with cfEclipse</title>
				<link>http://www.psykel.com/blog/index.cfm/2007/6/20/Editing-single-files-with-cfEclipse</link>
				<description>
				
				One thing that kind of bugged me with Eclipse is that I thought I could only edit code contained in a project.

What if you want to edit some standalone file somewhere?  I thought I was out of luck.  Then I stumbled upon the File Explorer tab (window -&gt; show view -&gt; file explorer view).

You can navigate to any file and edit it, without that file being included in an Eclipse project.  

It&apos;s probably common knowledge, but I didn&apos;t know...
				
				</description>
						
				
				<category>web</category>				
				
				<pubDate>Wed, 20 Jun 2007 08:16:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2007/6/20/Editing-single-files-with-cfEclipse</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>SQL Server triggers not firing with replication</title>
				<link>http://www.psykel.com/blog/index.cfm/2007/6/11/SQL-Server-triggers-not-firing-with-replication</link>
				<description>
				
				Ran into a problem today.  Two SQL DBs, using transactional replication.  I had some triggers created on the subscriber end that worked off insert, delete, and update operations.  

The triggers worked great when inserting/updating/deleting data locally on the subscriber DB.  But when a table was modified via replication, no triggers fired.

I thought replication just treated updates as a series of deletes and inserts, but the delete and insert triggers weren&apos;t firing, either.

If you&apos;re having a similar problem, first make sure your triggers don&apos;t have a &quot;not for replication&quot; setting.  Sadly, mine don&apos;t.  That&apos;s sad because a solution took a very long time to find.

The solution was a rather cryptic setting that tells replication to send updates *as* updates, rather than a delete/insert. 

&lt;code&gt;
DBCC TRACEON (8207, -1)
&lt;/code&gt;

Read about the details and caveats &lt;a href=&quot;http://support.microsoft.com/kb/302341/en-us&quot;&gt;here&lt;/a&gt;.   I don&apos;t think this is the best solution, but nothing seemed to work, and nobody seems to know why this would occur.
				
				</description>
						
				
				<category>Database</category>				
				
				<pubDate>Mon, 11 Jun 2007 22:29:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2007/6/11/SQL-Server-triggers-not-firing-with-replication</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Apache Monitor on Vista</title>
				<link>http://www.psykel.com/blog/index.cfm/2007/5/23/Apache-Monitor-on-Vista</link>
				<description>
				
				This should be my last Apache/Vista x64 post.

From what I&apos;ve seen, Apache Monitor won&apos;t run correctly out of the box.  You&apos;ll get some lame error code like &quot;the program completed successfully&quot; or something like that.

What you need to do is go to your start menu, right click on the Apache Monitor, and select Properties.  Go to the compatibility tab, and choose the windows XP compatibility mode.  That should do it.
				
				</description>
						
				
				<category>Server</category>				
				
				<pubDate>Wed, 23 May 2007 08:46:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2007/5/23/Apache-Monitor-on-Vista</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Coldfusion / Apache 2.2 on Vista x64</title>
				<link>http://www.psykel.com/blog/index.cfm/2007/5/22/Apache-22-on-Vista-x64</link>
				<description>
				
				More headaches from installing Apache 2.2 on Vista x64 today.  

The Apache connector is bad.  First, see Adobe&apos;s fairly pathetic technote &lt;a href=&quot;http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=8001e97&quot;&gt;here&lt;/a&gt;.

Install the new wsconfig.jar as they describe.  If the remainder of the technote works for you, I hate you.  If not, I&apos;ll save you a few hours of swearing.

Go to your cfusionmx7\runtime\lib folder and copy the .bat file that&apos;s attached to this message (download link below).  Of course, you will have to update your paths such that they&apos;re correct (you can do that in notepad).

You can also enter commands directly in the command prompt if you are looking for extra stress today.

When all&apos;s said and done, apache should hopefully restart and serve up .CFM files correctly.
				
				</description>
						
				
				<category>Server</category>				
				
				<pubDate>Tue, 22 May 2007 12:49:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2007/5/22/Apache-22-on-Vista-x64</guid>
				
				<enclosure url="http://www.psykel.com/blog/enclosures/fix.zip" length="336" type="application/zip"/>
				
			</item>
			
		 	
			
			
			<item>
				<title>Installing Apache 2.2 on Vista</title>
				<link>http://www.psykel.com/blog/index.cfm/2007/5/22/Installing-Apache-22-on-Vista</link>
				<description>
				
				I ran into a couple problems today installing Apache HTTP Server v2.2 on Vista x64.  Here&apos;s the problems, and the workarounds:

&lt;ol&gt;
&lt;li&gt;&lt;b&gt;Install&lt;/b&gt;&lt;br&gt;
You can&apos;t simply click on the Apache install msi and have everything work as it should.  You&apos;ll get permission errors like &lt;i&gt;service not installed&lt;/i&gt; or &lt;i&gt;service not found&lt;/i&gt;.  

The solution that I found (via google) is to right click on &lt;i&gt;command prompt&lt;/i&gt; in the start menu and select &lt;i&gt;Run as administrator&lt;/i&gt;.  Once there, navigate to the folder holding your Apache install msi and run it manually.  Ish.  I&apos;m sure there&apos;s a better way, but I wasn&apos;t patient enough to find it.
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Editing &lt;i&gt;httpd.conf&lt;/i&gt;&lt;/b&gt;&lt;br&gt;
This was frustrating.  I edited the http.conf file, and when I went to save it, I got an error message saying the file could not be created or something like that.  

The solution is to either modify the security properties of http.conf (giving your user &lt;i&gt;modify&lt;/i&gt; access), or run notepad as the administrator (as we did above for command prompt).  I&apos;d modify the security settings if I were you.
&lt;/li&gt;
&lt;/ol&gt;
				
				</description>
						
				
				<category>Server</category>				
				
				<pubDate>Tue, 22 May 2007 00:04:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2007/5/22/Installing-Apache-22-on-Vista</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Removing trailing zeros from decimal numbers in SQL</title>
				<link>http://www.psykel.com/blog/index.cfm/2007/5/10/Removing-trailing-zeros-from-decimal-numbers-in-SQL</link>
				<description>
				
				Say you&apos;ve got a numeric field (SQL Server DB) which returns numbers to three decimal places, e.g. 1.000, 2.125, 3.250, etc.

How do you return those numbers minus the trailing zeros?  I can&apos;t believe this is so difficult.  Surely there&apos;s an easy way to do it.  Here&apos;s the hack I used:

&lt;code&gt;
SELECT replace(rtrim(replace(replace(rtrim(replace(myCol,&apos;0&apos;,&apos; &apos;)),&apos; &apos;,&apos;0&apos;),&apos;.&apos;,&apos; &apos;)),&apos; &apos;,&apos;.&apos;) as myColDisplay
FROM   myTable
&lt;/code&gt;

Ick.
				
				</description>
						
				
				<category>Database</category>				
				
				<pubDate>Thu, 10 May 2007 15:33:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2007/5/10/Removing-trailing-zeros-from-decimal-numbers-in-SQL</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Quickly Shrink a SQL Server Transaction log</title>
				<link>http://www.psykel.com/blog/index.cfm/2007/5/9/Quickly-Shrink-a-SQL-Server-Transaction-log</link>
				<description>
				
				Okay, say you encounter a SQL Server Database that&apos;s got a HUGE transaction log, and you need to shrink it quickly.  MS has several KB articles such as &lt;a href=&quot;http://support.microsoft.com/kb/256650/EN-US/&quot;&gt;this one&lt;/a&gt;.

But if you really want to shrink the log file fast, and you don&apos;t need to keep the transaction log, here&apos;s a short cut:

Obviously, you&apos;ll need to stop using the database for a few minutes.  All SQL processes that access the Database need to be closed.

The first step is to detach the Database.  Do not skip this step; it&apos;s rather important for the health of your DB:
&lt;code&gt;
--detach the database:
EXEC sp_detach_db dbName
&lt;/code&gt;

The next step is to delete the transaction log file (the .ldf file, NOT the .mdf).  Note you are DELETING the transaction log.  Obviously, it will no longer be available.

Finally, reattach the Database:
&lt;code&gt;
--attach the database:
EXEC sp_attach_single_file_db dbName, &apos;c\mssql\data\dbName.mdf&apos;
&lt;/code&gt;
				
				</description>
						
				
				<category>Database</category>				
				
				<pubDate>Wed, 09 May 2007 13:23:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2007/5/9/Quickly-Shrink-a-SQL-Server-Transaction-log</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>appending an ntext field</title>
				<link>http://www.psykel.com/blog/index.cfm/2006/7/13/appending-an-ntext-field</link>
				<description>
				
				Say you want to do something like this:

update table set ntextThing = ntextThing + &apos;!&apos; where id = 1

That&apos;s not going to work.  This does, though:

&lt;code&gt;
DECLARE @ptrval binary(16)
SELECT @ptrval = TEXTPTR(ntextThing) 
FROM item 
WHERE id =1
UPDATETEXT table.ntextthing @ptrval NULL 0 &apos;!&apos;
GO 
&lt;/code&gt;
				
				</description>
						
				
				<category>Database</category>				
				
				<pubDate>Thu, 13 Jul 2006 14:50:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2006/7/13/appending-an-ntext-field</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Nested Query Loops - Worst code ever</title>
				<link>http://www.psykel.com/blog/index.cfm/2006/5/25/Nested-Query-Loops--Worst-code-ever</link>
				<description>
				
				I had no idea how bad nested query loops are.  But oh man, they are BAD.  

I came across this &quot;technique&quot; this week when a very busy site started resonding extremely slowly - like 30 seconds per request, sometimes more.  I didn&apos;t write the code, but I &quot;got&quot; to fix it.

Check this out, if you have a strong stomach:
				 [More]
				</description>
						
				
				<category>web</category>				
				
				<pubDate>Thu, 25 May 2006 22:44:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2006/5/25/Nested-Query-Loops--Worst-code-ever</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>Keep it scalable, kids</title>
				<link>http://www.psykel.com/blog/index.cfm/2006/5/22/Keep-it-scalable-kids</link>
				<description>
				
				We had a lot of trouble today with some really bad code that looked to be written about 10 years ago.

It was simply horrible.  Nested loops, tons of CFIFs, you name it.  Opening and editing this one CF file felt kinda like fixing a leaky pipe in my crawlspace.  Dusty air, spiders all over the place, dark, no room to move...yuck.

Anyway this one page suddenly became very popular, and was definately NOT scalable.  I rewrote it so the server would stop crashing (!) and it is now seriously about 100 times faster than before.

If, by chance, you are a person looking for web development services, be sure to get someone who knows what they&apos;re doing.  

If, by chance, you are a developer, make your code scalable.  Most of you know this, but I&apos;ll say it anyway -- Just because your code runs well on your dev box, it doesn&apos;t mean it will perform the same way when it&apos;s hit by 50 concurrent users.  And if you have to write nasty slow code, at least cache it.

Thanks, I&apos;m going to bed now.
				
				</description>
						
				
				<category>web</category>				
				
				<pubDate>Mon, 22 May 2006 23:55:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2006/5/22/Keep-it-scalable-kids</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>International Characters in DB from CF 4.5</title>
				<link>http://www.psykel.com/blog/index.cfm/2006/3/21/International-Characters-db-cf4</link>
				<description>
				
				Every now and then you get a little job that seems simple and straight forward, but is anything but.  I just encountered one of those.

I recently inherited an old CF application, written in CF 4.5 or 5.0.

The cfml templates have Japanese characters simply pasted in the file, with a meta tag in the HEAD section of the HTML that sets the character set to x-sjis (shift japanese).
				 [More]
				</description>
						
				
				<category>web</category>				
				
				<category>Database</category>				
				
				<pubDate>Tue, 21 Mar 2006 15:07:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2006/3/21/International-Characters-db-cf4</guid>
				
			</item>
			
		 	
			
			
			<item>
				<title>SES can cause trouble if you&apos;re not careful</title>
				<link>http://www.psykel.com/blog/index.cfm/2006/3/17/SES-can-cause-trouble-if-youre-not-careful</link>
				<description>
				
				So I recently deployed some SES URL code to a big site we did.  One thing I forgot to do was adjust a layout file that is used by sort of sister site - same content, different layouts.

Anyway, I did not add the BASE HREF tag to this layout file.  The layout file uses about 50 images or so, all called via a virtual directory.  

&lt;div class=&quot;code&quot;&gt;&lt;FONT COLOR=NAVY&gt;&lt;FONT COLOR=PURPLE&gt;&amp;lt;img src=&lt;FONT COLOR=BLUE&gt;&quot;myDir/whatever.gif&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/div&gt;

Since I forgot to add a BASE HREF, each image call was preceded with the entire SES url:

&lt;div class=&quot;code&quot;&gt;&lt;FONT COLOR=NAVY&gt;&lt;FONT COLOR=PURPLE&gt;&amp;lt;img src=&lt;FONT COLOR=BLUE&gt;&quot;&lt;A TARGET=&quot;_blank&quot; HREF=&quot;http://www.example.com/one/two/three/myDir/whatever.gif&quot;&gt;http://www.example.com/one/two/three/myDir/whatever.gif&lt;/A&gt;&quot;&lt;/FONT&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/div&gt;

So each image request actually called a page of the site!  Worse yet, the code took MYDIR as a url parameter, which caused the code to throw an error (an unexpected value).

So each page request was throwing about 50 or so errors, each of which resulted in a robust error report sent to my inbox.  I&apos;m still getting email messages 30 minutes later.  Ugh.
				
				</description>
						
				
				<category>web</category>				
				
				<pubDate>Fri, 17 Mar 2006 11:36:00-0700</pubDate>
				<guid>http://www.psykel.com/blog/index.cfm/2006/3/17/SES-can-cause-trouble-if-youre-not-careful</guid>
				
			</item>
			
		 	
			</channel></rss>