ISP Issues

Well, I can’t get onto my less-than-one-month-old ADSL connection, since Veridas, the upstream ISP for Opti has apparently gone belly-up. The bad thing about this is that it also affects some files I was hosting there (and, worse, the files Jaq had set up for her web site). I can’t even set up a replacement web site, as the files are only on my home computer, and I have no access from home. Not even dialup.

Getting Child Categories

I’ve been racking my brain thinking about how to get child categories of a specific category. And I think I’ve just figured it out. Examine all of the other categories in a complete list, and grab all of them that have the current page’s URL at the start. The next word will be the sub-category . Of course, knowing how to split stuff in Smarty is a bit difficult. I was thinking in JavaScript…

It Don’t HurtSheryl CrowThe Globe Sessions ★★½

Talk Like a Pirate Day.

My pirate name is:

Calico James Flint

Often indecisive, you can’t even choose a favorite color. You’re apt to follow wherever the wind blows you, just like Calico Jack Rackham, your namesake. Like the rock flint, you’re hard and sharp. But, also like flint, you’re easily chipped, and sparky. Arr!

Get your own pirate name from piratequiz.com.
part of the fidius.org network

Cross-browser AJAX

I need a simple wrapper for a Mozilla/Safari and IE compatible XMLHttpRequest(). Perhaps something like (courtesy of Apple):

 1     function loadXMLDoc(url,method,readyFunc) {
 2         req = false;
 3         if (method) method = "GET";
 4         // branch for native XMLHttpRequest object
 5         if(window.XMLHttpRequest) {
 6             try {
 7                 req = new XMLHttpRequest();
 8             } catch(e) {
 9                 req = false;
10             }
11         // branch for IE/Windows ActiveX version
12         } else if(window.ActiveXObject) {
13             try {
14                 req = new ActiveXObject("Msxml2.XMLHTTP");
15             } catch(e) {
16                 try {
17                     req = new ActiveXObject("Microsoft.XMLHTTP");
18                 } catch(e) {
19                     req = false;
20                 }
21             }
22         }
23         if(req) {
24             req.onreadystatechange = readyFunc;
25             req.open(method, url, true);
26             req.send("");
27         }
28         return req;
29     }

document.documentURI vs. location

Apparently, document.documentURI and document.location are not identical. Basically, document.location is not a string, so to treat it like one, you need to do: (document.location+"").split("/") Instead of: document.documentURI.split("/") Stupid IE.

Inline Search

I’ve implemented a new feature on my blog, which I think is pretty cool. Over the the right is a new box labelled: Beta: Inline Search. Try typing something into it, and pressing return, or clicking the button. Wait a few seconds (depending on connection speed) and search results for this blog should appear underneath. It’s still fairly rudimentary – I plan to make a “working” indicator, plus the ability to search for more results. But I guess you want to see the code…

 1     function SearchBlog(){
 2         window.searchreq = new XMLHttpRequest();
 3         var s=document.getElementById("s").value.replace(/ /g,"+");
 4         searchreq.open("POST","/category/&s="+s);
 5         searchreq.onload = UpdateSearchResults
 6         searchreq.send("")
 7     }
 8     
 9     function UpdateSearchResults(){
10         if (searchreq){
11             if (searchreq.status==200) {
12                 data = searchreq.responseText.split("<body>")[1].split("</body>")[0];
13                 temp = document.createElement("div");
14                 temp.innerHTML = data;
15                 if (temp.getByClass) {
16                     results = temp.getByClass("post-title");
17                 }
18                 var resList = "Results:<ul>";
19                 for (var i=0;i < results.length; i++){
20                     resList = resList + "<li>"+results[i].innerHTML+"</li>";
21                 }
22                 resList = resList + "</ul>";
23                 document.getElementById("searchresults").innerHTML = resList;
24                 data = "";
25                 temp = "";
26                 resList = "";
27             }
28         }
29     }

You will need to have a getByClass() function installed – if you don’t, it’s:

 1     /* 
 2         Thanks to Dustin Diaz for this one:
 3         http://www.dustindiaz.com/getelementsbyclass/
 4         */
 5     document.getByClass = function(searchClass,tag){
 6             var classElements = new Array();
 7             if (tag==undefined){tag="*";}
 8             var els = this.getElementsByTagName(tag); // use "*" for all elements
 9             var elsLen = els.length;
10             var pattern = new RegExp("(^|\s)"+searchClass+"(\s|$)");
11             for (i = 0,j = 0; i < elsLen; i++) {
12                 if ( pattern.test(els[i].className) ) {
13                     classElements[j] = els[i];
14                     j++;
15                 }
16             }
17             return classElements;
18         }

BarbarellaFerrante & TeicherUltra-Lounge, Vol. 16: Mondo Hollywood ★½

Ajax Search

This is very cool. Better than Live Search. I might be able to implement this, and even include the abililty to get multiple pages worth of results. And, it should be possible to do it so the search results appear in the sidebar, too. I’ll definitely look into this one. (Thanks Kreaper!)

Album Artist, or not?

I’m not sure whether I’m going to use Album Artist across my iTunes Library, or not. I’ve already used it in a couple of places, where I have several albums of the same title, such as Greatest Hits, or Behind The Sun. But the other place I may wish to use it is where on an artist’s album there are co-artists for some tracks. The one that springs to mind is Paul Mac, 3000 Feet High. For most of these tracks, Paul Mac credits the singer – generally it was Abby Dobson, Peta Morris, or someone else. The point is, until the advent of Album Artist as a tag, to keep the album together I had Paul Mac as the designated Artist. Then, in the case of a “featuring” credit, which there is on each track in this case except the last two, I put (feat. Additional Artist) into the song Name. Now, I am in a bit of a pickle. I can instead make the Album Artist Paul Mac, and in the Artist field, put Paul Mac featuring Additional Artist. This is all well and good, and the files are stored in the Paul Mac directory, but then I have more artists listed in the Artist browser. Luckily, because I’m somewhat anal with my tagging of tracks, all of my featuring credits are stored as indicated in the song title, so it was easy to create a script that parses the track name, and grabs out the additional artist(s). It is also possible to not add in the Album Artist tag on tracks that are compilations. However, because of the issue indicated above, I haven’t run that script on all of the tracks in my library yet. I’m really not sure which path to take.

TimeSandi ThomSmile…It Confuses People ★★

PostSecret, Beard Edition

I just don’t shave because it means I can sleep in for an extra 7 minutes.

JavaScript Submit Once

This is a cool idea – disable the Submit button via JavaScript when it’s pressed, so poeple can’t resubmit a comment multiple times. Not that it’s happened to me, but I like it anyway. Shamelessly stolen from Submit only once! Note to self: Implement this, or something like it.