JavaScript Snippet: Get Trackback URL

Here’s a nice little bit of JavaScript that grabs the Trackback URI of the current post. I’m not quite sure how to use it yet. It would be nice to be able to automatically add this to the BlogThis link, but there’s no way to do so, since cross-site scripting is disabled.

1
    document.body.innerHTML.split("trackback:ping=\"")[1].split("\"")[0];

The other thing that might be cool is to copy this to the clipboard, but I’m a bit loath to do things like that which are “invisible” to a user.

Turning off Google Ads

Michael, over at Binary Bonsai, has written about how he turns off Google Ads (or any other type of text) for readers who have commented. No Ads for Regulars at Binary Bonsai Here’s how to do the same thing at Blogsome, using Smarty Tags. Just before your Ad Block: {if $comment_author == ""} And then after, use: {/if} Then, readers who have commented on your blog won’t see your Advertisement(s). This only seems to work on a Post page. For some reason the cookie isn’t checked on other pages. I’m still looking into this.

PNG file sizes

I didn’t realise that PNG file sizes could vary so much. I was taking a screenshot using Windows, and initially, saving it in Paint, and then using Microsoft Office Image Manager to convert it to a PNG. Then I discovered the machine I was on had Fireworks, so I pasted directly into that, and saved as a PNG. The Fireworks PNG was around 3-5 times as large as the other one. I would have pegged it as being the other way around. I actually came across a program I had downloaded the other day that is a one-trick pony - it compresses PNG images. This made a similar difference in sizes.

Changing Interests

It’s amazing how much and how quickly one can change their attitude towards things. Take the following comment (by me), posted on the Blogsome Forums on Sun Aug 07, 2005 10:28 am.

I try and avoid JavaScript where possible , and cannot tell you if that is valid code or not. What I would suggest is that that code does not belong in the StyleSheet - put it in the Main page template, and see how that goes.

I have become a full convert to the greatness that is JavaScript. Since that point in time I’ve developed quite a library of functions that control various features on this blog, from disallowing Spam comments, to making checkboxes appear as lovely images instead of the ugly normal checkbox. Perhaps my favourite component is my floating window. I’ve mentioned it briefly, but it basically allows for <div> tags to float over the top of other items on the page. They can also remain fixed while the page scrolls, yet be moved to another position, and stay on that point, relative to the window. (This is broken under IE, and others that do not support position="fixed"). I think the irony is that I was very opposed to JavaScript, but had to use it as there was no other way to really control stuff under Blogsome. But, as chance would have it, I discovered just how powerful a language it really is, and now most of my coding is done in JavaScript, with the remainer being PHP Smarty Tags. I can’t remember the last time I wrote a python script. In all honesty, I’d love to be able to supplant all of my JavaScript with python, but I don’t think that will happen. Browsers will always support JavaScript, and XMLHttpRequest() really is pretty cool, but I don’t think they’ll start inlcuding python any time soon.

Scholaris FrameworkID Error

When I try to Assess student work using Scholaris, I come across the following error:

Class: Assessment Function: GetAssessmentVerbages(ByVal FrameworkID As String, ByVal SchoolID As String) As DataTable

* * *

Current function cannot be executed due to the following reason: *FrameworkID is empty Please take a screen shot of this error message and send it to support@solutionsit.com.au

* * *

It then doesn’t display the student work that was submitted, and I can’t mark it, or return it to the student. I get several other functions giving the same error, two on the way in, and three on the way out. Very annoying, as it means I can’t complete the full cycle of assessment using this tool, which means I’ve hit the limits of it’s usefulness for now.

Changing a Feed Location

I’m pretty happy with the way I’m creating pseudo-Podcasts of ABC programs that are available in RealMedia only: I use a program called realdump, which calls mplayer, to dump the audio to a .WAV file, which I convert to AAC using faac. I then get the data from the web page, and create an entry in an XML file. This in itself isn’t that tricky, but the clever part, at least in theory, is that I chose the URL I think the ABC might use when they finally Podcast that programme, and have a hostname entry for www.abc.net.au, which I use when I’m not online. However, every program I have done this for has chosen a different URL than the one I chose. For instance, The Philosopher’s Zone has chosen: http://www.abc.net.au/rn/podcast/feeds/pze.xml instead of: http://www.abc.net.au/rn/podcast/feeds/pzone.xml which is closer to the RealMedia file names, or: http://www.abc.net.au/rn/podcast/feeds/philosopher.xml which more accurately reflects their URL naming scheme. Apparently it’s possible to redirect a feed, so that iTunes then looks in a new location, using something like 301 redirects. The problem is I can’t get apache to do this, for some reason. I’ve tried using .htaccess files, but they don’t seem to do anything. I think Apple should make it so that a permanent redirect can be placed in the XML file, and iTunes respects this for future checks.

Daylight Savings Wrong

My computer decided that Daylight Savings was supposed to end last night (or rather, this morning), when in actuality it doesn’t end until next Sunday morning. I’m not sure if this is because of the Commonwealth Games, or whether it was just programmed in wrong. Apparently this affects Windows, too.

PostSecret Archives

I’m feeling a bit venomous today, so my comments are somewhat nasty-ish. I’m an athiest, and I’m not afraid to say so. We are lucky you didn’t sign up. You probably couldn’t tell the difference between Iraq and Iran. Perhaps staying in school was a better move…or would have been if you’d paid attention.

Links in this Post

I blogged earlier about creating a sidebar entry with all of the links in the current post. The following code snippet will do this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
    function createPostLinksBox(){
        if (!getCurrentPost()) return "not a single post page";
        content = getByClass("post-content")[0];
        links = content.getElementsByTagName("A");
        if (!links.length) return "no links in post";
        var placeholder;
        if (!(placeholder=getPlaceholder("outlinks"))) return "no location for outlinks";
        var outlinks = document.createElement('h2');
        outlinks.innerHTML = "Links in this Post";
        var ul = document.createElement('ul');
        for (i=0;i<links.length;i++){
            li = document.createElement('li');
            li.appendChild(links[i].cloneNode(true));
            ul.appendChild(li);
        }
        replaceNode(outlinks,placeholder);    
        outlinks.parentNode.insertAfter(ul,outlinks);
    }

Note that this must be run after the DOM tree is finalised, and relies on a couple of other functions. I’ve put <span id="outlinks">``</span> into my template, so that this will appear wherever that is, if it’s a single post page with any links in it. It will make it into the next update of my script.

Homeopathy

We ordered a heap of environmentally friendly wood oil, to do the floor with when we finally get around to it, and it came with a Free Magazine! Unfortunately, it contains a whole lot of crap about various things that are total rubbish, not the least being homeopathy. I’m not even going to detail how much crap it is, but just point you instead towards: Homeopathy: The Ultimate Fake. I will put a couple of quotes from the articles about Homeopathy in there, however.

Homeopathic medicines are considered safe and free from serious adverse reactions since they are highly diluted.

So highly diluted, in fact, that to be sure to get even one molecule of the original chemical, you would need to take around 2 billions times the homeopathic medicine’s dose (at 30X).

The cost of consultations will depend on their duration, with inital consultations varying between $60 to $120.

For someone to give you a glass of water. Even if it is bottled water, it still ain’t worth that much. As Barrett mentions in the linked article, Homeopathy is indistinguishable in effects from a placebo, because that is exactly what it is. A very complicated, expensive placebo.

Most major health funds provide cover for homeopathic treatment.

No wonder health insurance is so fucking expensive. I hope my insurer doesn’t! I won’t be reading any other articles in Living Now. Straight to the recycling bin. Or maybe I’ll shred it so my local rubbish molester doesn’t get the wrong ideas about stuff.