JavaScript Frame Buster

2009-06-09 18:19

There are a number of reasons you would want to prevent your page or site’s contents to be contained within a frame or iframe:

  • you might have problems with someone using your content on their site
  • security concerns
  • controlling your site’s functionality and/or presentation

This small bit of code somewhere within your HTML documents will detect whether or not it’s been loaded into a frame and, if so, will “bust” out of the frame by loading the page in the main window.

<script type="text/javascript">
//<![CDATA[
if (top != self) {
	top.location.href = self.location.href; 
} 
// ]]>
</script>

This is not a security panacea, and there are ways around it. But it is a quick and easy way of preventing a third party from doing something silly with your site.

---

NASA totally needs to hire me

2009-05-19 13:09

The Hubble telescope came up at work today, no doubt because it’s been in the news so much lately. I totally guessed (in an educated manner) how you’d go about pointing it at something, and I was right. Aiming and figuring out what direction to point is done by holding a reference to relatively fixed (read: extremely distant) astronomical objects, rotational stability is provided through the combined use of gyroscopes & wheels (& software). Yay, Team Me!

Self-satisfied? Yes. Impressed with my memory and understanding of physics? Absolutely. Important to anyone else? Not so much.

---

Google throws its weight around, only more so, with Chrome

2009-01-21 08:58
Google Chrome
Google Chrome

Well, I guess I’m excited. Google has inserted itself into the browser wars with Chrome. They’re making some huge claims (from a nitpicky webnerd and JavaScript programming point of view), so if nothing else I’ll be interested in seeing how well they follow through. It’s eye-catching press release features: privacy privacy privacy, anti-hack/-phish(/-hish?) blacklist and “omnibox” features, multithreading, running different tabs in a sandbox, and hyper-fast JavaScript.

Download it (if you can – it was unavailable as of noon my time) here. Good luck downloading it behind a firewall.

Since it’s open source, will everyone benefit? Let us pray. Or Slashdot.

9/12/08 Update

still no love if you’re behind a firewall

Google persists in using their stupid distribution scheme for installing Chrome. People are still experiencing problems trying to install behind a firewall.

1/21/08 Update

love ensues

Some nice people at Googly finally decided to offer a standalone version. Bad news is it won’t update.

6/18/09 Update

they got it

Chrome is now a managed download, so everything works fine. Thanks, Google!

---

Figleaf is in the wild

2008-06-03 13:13
Figleaf thumbnail
Figleaf

I just finished up Figleaf: one way to go about placing an overlay on top of any Flash movies on a page. Check it out, and please tell me what you think about it. It’s well-done and works most of the time.

---

So I kinda like Twitter

2008-04-21 10:14
twitter bird logo/icon

As you can see, I’m not by any means a regular blogger. I just don’t have that much to say about [stuff] that I care to cast in digital stone. To both paraphrase and mangle Ralph Waldo Emerson, my opinions are like the cells of my body: constantly in a state of flux. And like my body, although there’s plenty going on inside, the outside appears (relatively) the same.

Wow, that sounds pretty pretentious.

Which is to say that I don’t want the me of today to be held to the utterances of the me of yesterday. If I wanted that, I’d write a book. Or rather, I’d publish the book I’ve written. Working title: “Huh?”

Digression over.

Twitter – although terminally cute & hip & decidedly web2.0-ey – is the perfect solution for people like me (and we are legion) who want to throw shout-outs to the masses, but can’t be bothered to sit down and think about how we want to say it.

Another thing I like about Twitter is it’s decidedly post-literate. That whole capitalization & punctuation thing is so 20th century, dude. Thankfully, I’ve witnessed no leetspeak to date.

Join the sweaty, texting masses. I ain’t no fanboy, but I like it. Next passing fancy: Sched.

Comment [2]
---

new domain, other changes a-comin'

2008-02-01 21:54
Fred G. Sanford, my idol

I finally retired my old domain, cmgarvin.com. Long may it live. The new one, obviously, is garvinggarvin.com.

Why, you ask?

Several reasons, none of them particularly good. First and foremost, I go by “Garvin”. Oh, I have other nicknames, but that’s the one I actually pay attention to.

Most importantly, though, is that Garvin G. Garvin is sort of an alias. I’m also thinking of having my name legally changed to it. I like the ring of it, especially the vestigial middle initial. It’s all Fred G. “for Georgeous” Sanford.

Oh, but that’s not all

Along with the domain name, I grow weary of the look of this site. I’m glad I made the switch to Textpattern, but having done so just made me rather loath the way this thing looks. It’s not bad, just kind of dated & out of it. And this must not be.

So I’ll give you peeks and updates as I mosey along in my new design. It’ll probably be a few months in coming, as I’m in no particular rush. Time will tell.

---

Textpattern + some plugins = broken feed

2007-12-13 11:18
broken feed

I’ve read quite a bit about Textpattern’s annoying habit of creating RSS/Atom feeds that browsers download instead of display, because I’m relatively new to Textpattern and was experiencing the same problem. It turns out that the problem is in the plugins, kids. I’m sure a lot of you already figured this out, but knowledge unshared is only useful to one person. So I shall share my (mercifully brief) RSS odyssey.

broken how?

First off, I think I should define the problem before I explain my solution.

The feeds that are generated by Textpattern “out of the box” are of the MIME types “application/atom+xml” and “application/rss+xml” (depending). These feeds work fine and dandy right after you’ve successfully installed Textpattern. Take a closer look at the source of one of these feeds. The very first line should look something like:

<?xml version="1.0" encoding="utf-8"?>


Note that the “<” in “<?xml” should be the first character in the file.

Now take a broken feed – one which you’re prompted to download instead of your browser displaying it (as is normally & should be the case, barring plugins, XML handling app’s, etc). Since I’ve already primed you on what to look for, you’ll notice that there is a space just before the XML declaration.

blame yourself

As I said, I’m new to txp. So naturally my first thought was that one of the custom plugins I’d written for my site was the culprit. At the time I had them in a ‘plugins’ directory, so I simply removed them, then removed all mention of my custom tags from all pages and forms. ‘Went to my feed: same thing. Stupid space.

blame the Maker(s)

So being the PHP dork that I am, I decided that the problem must be in the Textpattern code itself. My reasoning was thus: I haven’t done anything truly earthshattering with my Textpattern install, and there was hardly anything worth finding in the Textpattern forum, to say nothing of their FAQ. There are two unhelpful FAQ entries related to feeds, but they weren’t very helpful and were written in a decidedly angry/defensive tone (and have perhaps unintentional factual errors):

I’ve tweaked quite a few open source projects over the years, so I dug through an entire trace of what goes into the serving of an RSS or Atom feed in Textpattern. What a magical odyssey that was. But to no avail: there was nothing I could find that would directly and obviously cause that damnable space. Does PHP’s eval function have a tendency to insert spaces? Not if the code being eval’d doesn’t, as far as I know.

blame others

So if Textpattern wasn’t to blame (at least not directly), and I wasn’t to blame, chances were that one of those dang plugins was doing it. And it was, though for the life of me I don’t know why. It happened to be the cbs_article_index that i had in my plugin cache directory in this case, but as it seems so many people have had an issue with Textpattern’s default feeds, I seriously doubt it’s just this plugin that’s the problem.

When in doubt, hack.

But this is where open source kicks gluteous. Good ol’ Noam Samuel has published a handy, dandy Textpattern feed hack. It’s specifically for RSS. Does anyone know if will work for the Atom feed, too? I sure don’t.

conclusions

After some tinkering, I finally found the problem. The issue has to do with plugins in your plugin cache folder (commonly, textpattern/plugins).

For whatever reason, a space after the “?>” (end of PHP) ending or after any newline (\n) after the “?>” is resulting in a space being inserted before the intended first character of Textpattern output. So: the solution is to make absotively, posolutely sure that there is nothing after the plugin’s “?>” ending.

It seems that there’s a need for some clarification by Textpattern regarding best practices with plugins.

At any rate, I hope that this helps someone out there, and that some bright spark can figure out exactly what and where this is breaking. Happy blogging.

12/14/07 Update

fixed!

That was fast. I put it on the Textpattern Forum (log in/register first to be able to see it) once I’d gotten it all figured out, and wet kindly fixed it within… minutes, seemingly. Squeaky wheel gets greased I guess.

Comment [1]
---

I'm all Textpattern now

2007-11-15 22:22

As I’d mentioned earlier, I was pretty fed up with my crappy little homegrown CMS-wannabe. I’m not even making it accessible any more. The commenting frameworked I’d rigged attracted link spam like gnats to a sweaty face, and frankly I was too disheartened to prevent them. (‘Still getting “hits” to those nonexistent comment pages, actually.)

So I made the switch to Textpattern. Why, you ask? Well to be frank, WordPress and the more-web2.0-than-thou fan-stink just seems elitist, and it’s really more than I’d ever want for a dorky little site like this. Ditto Drupal (which in my opinion is just aching to be WordPress) – although their documentation and support equals or exceeds WordPress. Again: it seems to have more than I’d ever want, but isn’t flexible (and simple) enough for me to just poke around and try things. XOOPS was right out, as the learning curve and planning-overhead involved isn’t a great fit for someone as busy as yours truly. I have a life, and while I don’t mind learning new things, I want to get paid if I’m going the kind of time and attention that these systems involved. I just want a blog that I can tack stuff onto.

Which brings me to Textpattern (known henceforth as Txp for the sake of my carpals). One thing that Txp had going for it over most of the others was that setup was nearly instantaneous and – barring user silliness – foolproof. I literally had it running within a minute of downloading it. The results speak for themselves, I think. I’m very happy with their selection of features and the support of the Textpattern community. Sure it has its problems, but they’re interesting problems, at least. And if I really get a wild hair about any of them, I can just write a plugin.

---

Columbia, MO makes the headlines

2007-10-07 01:06

For those of you not from around here, Columbia, MO has a serious monkey problem. In fact, our monkey is so vicious it made the Report. Check it out.

"Monkey on the Lam" movie on Steven Colbert

(JavaScript & Flash player required to view.)

I love this story for so many reasons, but mostly because a friend of mine had seen said monkey crawl over the top of the car in front of him while he was sitting in traffic. We, of course, told him he was full of it and questioned his sobriety at the time. His vindication & others' pain is now public domain amusement.

Oh yes: my daughter is now officially freaking out now that this monkey will somehow get into the house and bite her in her sleep. I wish it would (get in the house): we've got three cats and a high-strung dog. That'd be the last b&e that simian would ever pull.

Filthy little creature.

---

I'm a sucky blogger, it's true

2007-09-09 00:28

I know, I know: this “blog” sucks! You’re looking at it, you know. I really am going to do better, I swear on a stack of of bibles. Yea verily, I will not take this guy’s wonderful advice in vain. But I have to tell you honestly that it’s not going to get much better with the hashed-together backend I constructed for this site. As I mentioned earlier, it’s time to grow up and use the mature junk. Right now I’m thinking about Textpattern and WordPress. I’m leaning heavily towards Textpattern for its ease of setup and maintenance, and its bare-bones simplicity out of the box. Me like simple. Then again, WordPress has got so many toys out there, it’s also hard to resist. Time will tell, dear reader(s). Time will tell.

It’s not so much that I refuse to write blogs as that I have not really codified it as part of my routine. I hereby proclaim that I will do so… soon. I’ll even track that baby & let you check me on it. I will not break the chain.

I really don’t know if it’s going to be a how-to or a hey-look-at-this or an I’m the expert type of deal, but I do know one thing: I will probably not take any smarmy advice and proclamations from the ‘pros’. I mean, I want to be blocked in China as much as the next guy, but at the end of the day it’s just not that important to me. If I get kudos, money, fame: hey, great. If not, at least I’ll have an online diary that my friends and enemies can keep track of me with.

---

Valid XHTML 1.1 Valid CSS
             © 2008, garvin