tag:blogger.com,1999:blog-50334139414662509192024-03-13T16:38:01.118-04:00Oh! For the love of god! Get the Jaws of Life!Welcome to my technical fixes blog. This is yet another blog with fixes to computer errors that caused me to tear my hair out. Seriously, there's not much left.Dave Komitohttp://www.blogger.com/profile/04483809881335208637noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-5033413941466250919.post-30288945953176810272009-12-29T16:27:00.001-05:002010-01-19T11:49:45.760-05:00.htaccess ErrorDocument does not Catch 404 Error from a Non-Browser Call to the Site.I came across this problem recently when trying to click on hyperlinks in a WORD document. The link used the following code in a .htaccess file.<br /><br /><blockquote class="postCode2">ErrorDocument 404 /error_file.php</blockquote><br /><br />It worked when accessing the link through a browser, but WORD makes a call to the site first to determine if the page exists. For some reason, the file would not redirect, and WORD would say that it could not access the site. The same thing would happen when trying to access the page via PHP cURL or a W3C validator.<br /><br />Thanks to the following page, I indirectly got the solution.<br /><a href="http://www.litespeedtech.com/support/forum/archive/index.php/t-1051.html">http://www.litespeedtech.com/support/forum/archive/index.php/t-1051.html</a><br />The page is actually discussing .htaccess files nested in subfolders, but the following code, which is mentioned in the posts, works better for redirecting from WORD.<br /><br /><blockquote class="postCode2"><IfModule mod_rewrite.c><br />RewriteEngine On<br />RewriteBase /<br />RewriteCond %{REQUEST_FILENAME} !-f<br />RewriteCond %{REQUEST_FILENAME} !-d<br />RewriteRule . /error_file.php [L]<br /></ifModule></blockquote>Dave Komitohttp://www.blogger.com/profile/04483809881335208637noreply@blogger.comtag:blogger.com,1999:blog-5033413941466250919.post-67601256776881751712009-11-11T10:51:00.005-05:002009-11-24T18:17:41.965-05:00How to have clickable links in Yahoo AnswersI came across this problem when first starting giving answering questions on Yahoo Answers. You'd paste a link into an answer and when you view the submited answer, the link is not active (not clickable). It's just part of the text of the answer.<br /><br />Well, after not getting many answers about from Yahoo <em style="TEXT-DECORATION: underline">Answers</em>, I stumbled on the solution myself after answering more. <br /><br /><span style="font-size:130%;"><strong>You have to get to Level 2 of Yahoo Answers in order for your links to be clickable.</strong></span>Dave Komitohttp://www.blogger.com/profile/04483809881335208637noreply@blogger.comtag:blogger.com,1999:blog-5033413941466250919.post-87565150170250223182009-11-08T04:00:00.000-05:002009-11-08T04:00:02.191-05:00Easy Object Call HTML DOM / JavaScriptHere's a handy little function that I use a lot. Instead of having to call document.getElementById('example_tag') which is long and half the time I mis-capitalize the "getElementById", this function saves time and errors with getEle('example_tag') The plus is that it also bypasses a potential error if the element is not there.<br /><blockquote>function getEle(str){<br /> if(document.getElementById(str)){<br /> return document.getElementById(str);<br /> }<br /> else{<br /> return false;<br /> }<br />}<br /></blockquote>Dave Komitohttp://www.blogger.com/profile/04483809881335208637noreply@blogger.comtag:blogger.com,1999:blog-5033413941466250919.post-30408481266618460782009-11-06T04:00:00.002-05:002009-11-13T15:28:48.473-05:00JavaScript HTML to XHTML Converter for Yahoo's YUI 2 Rich Text EditorThe other day after installing Yahoo's Rich Text Editor, I noticed that the output of the editor was badly formed HTML that wouldn't validate on my XHTML site. So, since I'm a bit anal, I wondered if there was a way to convert the output. After only finding a few convoluted and licenced solutions, I figured it wouldn't be too hard to do it myself. So here it is in JavaScript.<br /><br /><br /><blockquote class="postCode">function convertToXHTML(html){<br /><br />var raw1 = html.split("<"); var xhtml = ""; var tags = ""; //Make Tags Lower Case and make sure that the tags are properly closed for(var i in raw1){ if(raw1[i].indexOf(">") != -1){<br />var raw2 = raw1[i].split(">");<br />var tagName = (raw2[0].indexOf(" ") > -1) ? raw2[0].split(" ")[0] : raw2[0];<br />tagName = tagName.replace(/\//g, "");<br />var endSlash = (html.indexOf("/" + tagName) == -1 ) ? " /" : "";<br />raw2[1] = (raw2[1]) ? raw2[1] : "";<br /><br />if(raw2[0] != "" && raw2[0]){<br />var begin = "<" + raw2[0].replace(eval("/" + tagName + "/"), tagName.toLowerCase()); xhtml += begin + endSlash + ">" + raw2[1];<br />}<br />}<br />else{<br />xhtml += raw1[i];<br />}<br />}<br /><br />//Make sure that the attributes listed below use quotes<br />xhtml = xhtml.replace(/align=center/gi, 'align="center"');<br />xhtml = xhtml.replace(/align=left/gi, 'align="left"');<br />xhtml = xhtml.replace(/align=right/gi, 'align="right"');<br /><br />//Make sure the attributes are separated by a space<br />var arr = xhtml.match(/"[a-z]+="/gi);<br />for(var i in arr){<br />if(!isNaN(i)){<br />xhtml = xhtml.replace(eval("/" + arr[i] + "/gi"), '" ' + arr[i].slice(1));<br />}<br />}<br />return xhtml;<br /><br />}<br /></blockquote><br /><br /><br />Unfortunately, this isn't a 100% fix. The Yahoo Editor sometimes nests the tags in an invalid way, and I have yet to correct for that. I also haven't tested this too much yet; so, there could be quite a few other things that this isn't designed to fix.<br /><br />This is specifically to convert the output of Yahoo's text tool. This function fixes glitches that only this tool creates, and does not account for errors that you or another program might export.Dave Komitohttp://www.blogger.com/profile/04483809881335208637noreply@blogger.comtag:blogger.com,1999:blog-5033413941466250919.post-81146577168427284682009-11-04T04:00:00.001-05:002009-11-04T04:00:04.581-05:00Problem Pasting from Clipboard on BloggerThis has been bugging me since I started this blog. If you have Internet Explorer 8 and cannot copy and then paste text into your Blogger Post Textbox, just turn-on "Compatibility Mode".<br /><br /><br />Go to Tools / Compatibility Mode<br /><br /><br /><img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 353px; DISPLAY: block; HEIGHT: 400px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5399565855705075106" border="0" alt="" src="http://4.bp.blogspot.com/_hexA2ixieN8/Su8ciaKhDaI/AAAAAAAAABY/8bDZjg8toCU/s400/compatibility_mode.jpg" />While you're at it, you may as well set Blogger to be in compatibility mode into the future; so, got to Tools / Comaptibility Settings. This brings up a Menu Box. Enter "Blogger.com" into the text field at the top and click "Add" then click "Ok". This makes it so Blogger is in Compatibility Mode everytime you go here.<br /><br /><a href="http://4.bp.blogspot.com/_hexA2ixieN8/Su8gEfw9JjI/AAAAAAAAABw/g1UkCcgcJm8/s1600-h/compatibility_mode_set.jpg"><img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 399px; DISPLAY: block; HEIGHT: 400px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5399569739858912818" border="0" alt="" src="http://4.bp.blogspot.com/_hexA2ixieN8/Su8gEfw9JjI/AAAAAAAAABw/g1UkCcgcJm8/s400/compatibility_mode_set.jpg" /></a><br /><br /><a href="http://1.bp.blogspot.com/_hexA2ixieN8/Su8e-DOvsSI/AAAAAAAAABo/zrsiFs5uGH0/s1600-h/compatibility_mode_set.jpg"></a><br /><p>I haven't fully tested this to see if it makes anything else not work, but at least you can copy and paste. I found this here: <a href="http://www.google.com/support/forum/p/blogger/thread?tid=418da73cad5aa018&hl=en">http://www.google.com/support/forum/p/blogger/thread?tid=418da73cad5aa018&hl=en</a> (I copied and pasted this while in compatibility mode).</p>Dave Komitohttp://www.blogger.com/profile/04483809881335208637noreply@blogger.comtag:blogger.com,1999:blog-5033413941466250919.post-88940162336839631122009-11-02T12:30:00.005-05:002009-11-02T12:47:04.996-05:00URL Encode Calculation / Function for FileMaker Pro<span style="font-family:trebuchet ms;">This function is for when you send field data to a website with the "Open URL" Script Step, or if you're storing url encoded links. </span><br /><br /><span style="font-family:trebuchet ms;">Substitute (</span> <span style="font-family:trebuchet ms;"><br /><span style="FONT-STYLE: italic; FONT-WEIGHT: bold">INSERT FIELD NAME HERE</span><br /></span><span style="font-family:trebuchet ms;">; ["ΒΆ" ; "%0D"]</span><br /><span style="font-family:trebuchet ms;">; ["%" ; "%25"]</span><br /><span style="font-family:trebuchet ms;">;[ "#" ; "%23"]</span><br /><span style="font-family:trebuchet ms;">;[ "`" ; "%91"]</span><br /><span style="font-family:trebuchet ms;">;[ "~" ; "%7E"]</span><br /><span style="font-family:trebuchet ms;">;[ "!" ; "%21"]</span><br /><span style="font-family:trebuchet ms;">;[ "@" ; "%40"]</span><br /><span style="font-family:trebuchet ms;">;[ "$" ; "%24"]</span><br /><span style="font-family:trebuchet ms;">;[ "^" ; "%5E"]</span><br /><span style="font-family:trebuchet ms;">;[ "*" ; "%2A"]</span><br /><span style="font-family:trebuchet ms;">;[ "(" ; "%28"]</span><br /><span style="font-family:trebuchet ms;">;[ ")" ; "%29"]</span><br /><span style="font-family:trebuchet ms;">;[ "-" ; "%2D"]</span><br /><span style="font-family:trebuchet ms;">;[ "_" ; "%5F"]</span><br /><span style="font-family:trebuchet ms;">;[ "=" ; "%3D"]</span><br /><span style="font-family:trebuchet ms;">;[ "+" ; "%2B"]</span><br /><span style="font-family:trebuchet ms;">;[ "" ; "%3A"]</span><br /><span style="font-family:trebuchet ms;">;["\\" ; "%5C"]</span><br /><span style="font-family:trebuchet ms;">;[ "]" ; "%5D"]</span><br /><span style="font-family:trebuchet ms;">;[ "[" ; "%5B"]</span><br /><span style="font-family:trebuchet ms;">;["{" ; "%7B"]</span><br /><span style="font-family:trebuchet ms;">;[ "}" ; "%7D"]</span><br /><span style="font-family:trebuchet ms;">;[ ";" ; "%3B"]</span><br /><span style="font-family:trebuchet ms;">;[ ":" ; "%3A"]</span><br /><span style="font-family:trebuchet ms;">;[ "'" ; "%27"]</span><br /><span style="font-family:trebuchet ms;">;[ "\"" ; "%22"]</span><br /><span style="font-family:trebuchet ms;">;[ "<" ; "%3C"]</span><br /><span style="font-family:trebuchet ms;">;[ ">" ; "%3E"]</span><br /><span style="font-family:trebuchet ms;">;[ "," ; "%2C"]</span><br /><span style="font-family:trebuchet ms;">;[ "." ; "%2E"]</span><br /><span style="font-family:trebuchet ms;">;[ "/" ; "%2F"]</span><br /><span style="font-family:trebuchet ms;">;[ "?" ; "%3F"]</span><br /><span style="font-family:trebuchet ms;">;[ "&" ; "%26"])<br /><br />Now, I created this function about a year or two ago on my own, but out of curiosity, I just did a google search for "urlencode filemaker" and found an incredibly similar function on <a href="http://www.briandunning.com/cf/165">Brian Cummings FileMaker Pro Custom Functions</a> page. So, out of fairness, I'll give him credit for his or his team's work, </span><span style="font-family:trebuchet ms;">but I swear I couldn't find his page when I made the calculation. However, </span><span style="font-family:trebuchet ms;">my function does have a few more encoded characters.<br /><br />Anyway, hopefully this will help anyone else out there looking for such a function.<br /></span>Dave Komitohttp://www.blogger.com/profile/04483809881335208637noreply@blogger.comtag:blogger.com,1999:blog-5033413941466250919.post-88840055438272496592009-10-30T16:42:00.000-04:002009-10-30T16:53:44.648-04:00IIS 7 PHP FTP permissions error with ftp_nlist() and ftp_rawlist()How `bout this! Two posts on my first day on the blog.<br /><br />This one I encountered soon after finally getting my SSL up and running. In IIS 7, PHP my have some permission errors that will allow an FTP connection to go through, but as soon as you call ftp_nlist or ftp_rawlist, the script keeps running and causes a 500 Server Error.<br /><br />Well, the simple solution is to force passive mode. Call this after connecting to the FTP.<br /><br />ftp_pasv($conn_id, true);<br /><br /><br />Now, this might not be the best solution for you, especially if you're connecting to a typically stupid Windows Server 2008 that does not easily allow passive FTP, but it worked for me; so, if this doesn't work for you, just go punch the insensitive loudmouth sitting next to you .Dave Komitohttp://www.blogger.com/profile/04483809881335208637noreply@blogger.comtag:blogger.com,1999:blog-5033413941466250919.post-32287290541546406692009-10-30T03:00:00.001-04:002009-10-30T18:05:14.550-04:00IIS 7 Errors when Completing SSL Certificate Request (Windows Server 2008)<span style="font-family:trebuchet ms;">This one caused me to kick the stall door in the men's room repeatedly.</span><br /><span style="font-family:trebuchet ms;"></span><br /><span style="font-family:trebuchet ms;">IIS 7 has a bug that, when installing/completing SSL Certificates, causes this specific error:</span><br /><span style="font-family:trebuchet ms;"></span><br /><strong><span style="font-family:trebuchet ms;">CertEnroll:CX509Enrollment::p_InstallResponse: ASN1 bad tag value met 0x8009310b (ASN:267)</span></strong><br /><span style="font-family:trebuchet ms;"></span><br /><span style="font-family:trebuchet ms;"></span><br /><span style="font-family:trebuchet ms;">Now, to listen to all the help pages out there, they'd have you beleive that the certificate acutally installs despite the error, and all you have to do is refresh the certificate list under Computer Management, and this may be true; however, if you're like me, this repeatedly does not work, and you have to keep having the CA reissue the certificate, taking a day or so per reissue. In this case, try this out.</span><br /><span style="font-family:trebuchet ms;"></span><br /><span style="font-family:trebuchet ms;">I noticed that under MMC there is an enrollment folder that shows each request as a certificate, and after the error, the request disappears, and just keeps erroring; so, I figured the request still had to be in the system somewhere; so, I searched around and found this life and time-saving page hosted on random CA company's site:</span><br /><span style="font-family:trebuchet ms;"></span><br /><a href="http://www.entrust.net/knowledge-base/technote.cfm?tn=6926"><span style="font-family:trebuchet ms;">http://www.entrust.net/knowledge-base/technote.cfm?tn=6926</span></a><br /><span style="font-family:trebuchet ms;"></span><br /><span style="font-family:trebuchet ms;">It basically solves the whole problem. It not only finds the missing request, but installs the new certificate while your at it. Luckily, I didn't encounter the error it's talking about.</span><br /><span style="font-family:trebuchet ms;"></span><br /><span style="font-family:trebuchet ms;">The following is directly from Entrust</span><br /><span style="font-family:Trebuchet MS;"></span><br /><br /><strong><span style="font-family:times new roman;">Entrust Certificate Services Support Knowledge Base</span></strong> <p><span style="font-family:times new roman;"><strong>Audience:</strong> Administrator<br /><strong>Last Modified:</strong> 2006-10-18 13:46:14.0</span></p><p><strong><span style="font-family:times new roman;">TN 6926 - How do I restore a pending request in IIS 6.0 if it was removed?</span></strong></p><p><u><span style="font-family:times new roman;">Problem:</span></u></p><p><span style="font-family:times new roman;">The pending request in IIS 6.0 has been deleted. You cannot install your Entrust SSL certificate since the CSR generated by you which is signed by Entrust, mathematically matches the pending request. </span></p><p><span style="font-family:times new roman;">Microsoft Notes:</span></p><p><span style="font-family:times new roman;">IIS stores the private key for a certificate as the pending request. Deleting the pending request deletes the association of the private key with IIS, but the private key still exists in the certificate store. To install the certificate without having the pending request available, you can use version 5.2.3718.0 of the Certutil.exe command-line tool that is available through the Certificate Services MMC snap-in in Windows Server 2003. For more information about Certutil.exe, see </span><a href="http://go.microsoft.com/fwlink/?LinkId=37533"><span style="font-family:times new roman;">Certutil.exe</span></a></p><p><u><span style="font-family:times new roman;">The Certutil.exe Solution:</span></u></p><p><br /><span style="font-family:times new roman;">To install a Web server certificate that lacks a pending certificate request<br />1. Click Start, point to Run, type cmd, and then click OK.<br /><br />2. Navigate to the directory where Certutil.exe is stored; by default, this is %windir%\system32.<br /><br />3. Type the following command at the command prompt: certutil -addstore my certnew.cer where certnew.cer is the name of the certificate you received from the certification authority (CA). </span></p><p><span style="font-family:times new roman;">You should see the following message: CertUtil: -addstore command completed successfully.<br /><br />4. Navigate to the directory where you stored the certificate you received from the CA. Right-click the certificate and then point to Properties.<br /><br />5. Click the Details tab and select <all>in the Show drop-down list.<br /><br />6. In the Field list, select Thumbprint to display its value in the view pane.<br /><br />7. Select the Thumbprint value in the view pane and then click CTRL+C.<br /><br />8. Return to the command prompt window and type the following command: certutil -repairstore my "thumbprint"<br />where thumbprint is the value of the Thumbprint field. Be sure to type the double quotes as part of the command. If the command is successful, the following message is displayed: "Encryption test passed CertUtil: = repairstore command completed successfully." </span></p><p><span style="font-family:times new roman;">1. Install the server certificate on your Web server.<br /></span></p><p><span style="font-family:times new roman;">Important</span></p><p><span style="font-family:times new roman;">If the certutil command does not complete successfully, the following error message is displayed: "Certutil: -repairstore command FAILED: 0x80090011 (-2146893807) Certutil: Object was not found." This message indicates that the private key for the certificate does not exist in the certificate store. You cannot install the certificate you obtained from the CA. Instead, you must generate a new certificate request, obtain the new certificate, and install that new certificate on your Web server. Please contact Entrust for assistance.</span></p>Dave Komitohttp://www.blogger.com/profile/04483809881335208637noreply@blogger.com