Prototype vs OOP

Wikipedia tells me many things. Most importantly at the moment, it tells me how to move my fresh new conceptual understanding of object oriented programming over to Javascript, which is not Technically object oriented, by prototype based.

Yep, the same prototype I discovered and mentioned earlier.

Are you following along children? This rabbit hole keeps going deeper...


This article is an excellent stepping stone for understanding prototyping in javascript. Excellent even for those with shaky knowledge of OOP.

Sarah Takes the Plunge into OOP. Finally.

Hello non existent blog readers.

*thanking Firefox for spell checking so I don't always spell existent wrong*

This is it. It's time to face the facts. I don't really know anything about Object Oriented Programming - beyond the abstract concepts. And I must. So here goes.

I'm going to be working on it from a PHP angle, as that's the OO language I'm the most comfortable with. I'm going to be starting from here:

Updates to follow of course. Wish me luck.

CallFunction() ... What are you?

Continuing working through SWFUpload code, I've come across

returnString = movieElement.CallFunction('' + __flash__argumentsToXML(argumentArray, 0) + '');

Now, I think I get the gist of what is happening here - CallFunction is an Active-X method which seems to take an XML style argument in order to call a function in the Actionscript code. However, googling around I seem to be completely unable to find an API or any definition of this method. Can anyone help me out with this?

Flash Satay - Flash stuff I should Have Known

Another learning step in my dissection of swfUpload - Flash Satay. A lovely way to include flash in your (x)html while still using standards based code. An interesting read even if you don't plan on implementing it (which we probably won't be. Because we are all non-standardsy. Shh.)

Javascript IS object oriented...sorta.

Helps if you understand object oriented programming - of course, this article is so straightforward it can almost help you understand it!

The extremely long url says it all.

Terms: Static Members

Static Members are used with object oriented programming. A static member is a variable shared between all instances of an object. For example, if you had an object myObject with the static member objectCount, then myObject.objectCount++ would increase this value by 1 across all instances of myObject.

As javascript is not a typical object oriented language, the way object are created is slightly different. It seems typically they are assigned to a function - ie:

myObject = function(){ createObject(); }

and then

myObject.objectCount = 0;

Yes. This does mean you are assigning values to functions. I know! I'm still trying to wrap my head around it as well. I'm not even sure I'm using the right terminology to define this. So HA!

Let's just worry about understanding the definition of static member for now, shall we?

Tems: Prototype

Hello again children. Today we are going to learn about a nifty little property in Javascript - PROTOTYPE.

First off, have you ever worked with objects in Javascript? Tell me about it in the comments if you have. There is some debate over whether Javascript is truly an object oriented programming language or not (see here: to learn why we tend to underestimate this language.) Either way, the prototype property is meant for working with javascript objects. Since I don't really know much about Object Oriented programming myself (which I plan to soon change!), I can't honestly give you a full run down on what it means/does. I'm just going to tell you the gist and give you the link so you can read for yourself.

Basically the idea is by using someObject.prototype.someMethodOrValue = something, you are in fact assigning that method or value to all instances of this object.

I have a hunch that this little feature may be at the heart of what makes JS object oriented. But I think I'll have to get back to you on that once I actually KNOW something about it. In the meantime, read about it for yourself.

Ta ta for now!

Why you should be wary of 3rd party plugins...

Sarah Learns a New Term - Namespaces

Working on implementing SWFUpload or a similar type uploader. On reading the documentation, I see:

The main features that SWFUpload provides are:

  • The ability to select multiple files in the file browser dialog.
  • AJAX-style uploading without a page refresh.
  • Upload progress events.
  • Namespaced classes compatible with other JavaScript libraries (i.e., jQuery, Prototype, etc.).
  • Flash 9 and Flash 10 support. (Flash 8 support dropped in version 2.2.0)
This brought me back to the days of my childhood, when, reading a book, I would keep a dictionary beside me and look up unfamiliar words. (Yes I was a big nerd from the moment I was born I guess.) So I decided to look up exactly what a Namespace is and share it with my nonexistent blog readers.

Think about this: You are writing the next big Facebook - your php code is getting to around 10,000 lines, and you are using multiple third party plugins. Suddenly you come across a predicament - that nifty third party User Widget has conflicting class names with that other nifty third party thing-a-majig. Namespacing avoids this by allowing you to 'classify' your code (how punny). Assigning a namespace to a php file (you can even assign more than one per file) ensures that the widget USER class does not get overwritten by the thing-a-majig USER class.

For an explanation that actually makes sense, see here:

Walking the plank, er, DOM

A very handy reference for DOM objects and methods:

Learning Ajax, Json, with php and database manipulation.

I've been struggling today and last week to find some good tutorials or a well recommended book for getting the ball rolling in my quest to learn Ajax. I figure I might as well try to start off working with Json instead of wasting time with parsing string data. So far here are the links I've found useful:

Quick run down on JSON:
Understanding JSON: the 3 minute lesson
JSON on Wikipedia

Excellent Starter tutorial using Ajax (and ASP, but can be easily modified to a php date() function)
W3schools Ajax Example

More Advanced and In Depth Series on Ajax covering numerous topics, which I breezed through the first 3. A much longer read, but contains some really useful details:
Mastering Ajax: 11 Part Series from IBM developerWorks

After you do the W3 Schools Tutorial, I suggest moving on to this one, which uses Ajax, Json, Php, and Database manipulation. Heads up - I had to remove the $$link variable variables from the database functions in order for it to work.
Json Ajax Webchat Tutorial

Good luck, and if you know of some additional resources I would appreciate the links.

Double top-padding in IE7

Ran into a situation today where top-padding was being doubled in IE7. After banging my head on the desk a few times trying to fix it, I turned to google and found this little trick:

Basically you add display: inline-block; to the element. Worked like a charm!

Complex backgrounds with 100% width and Absolute Positioning

Lately one of our designers has been sending down a lot of psd layouts with complicated background elements, involving the need to tile-x a repeating background, but still have a "static" type background at least 1500px wide, without creating horizontal scroll bars for smaller viewports.

After doing some digging around, the best way I've come up with for dealing with this particular issue is to set the x-repeated background as the body background, then absolutely position a layer behind the rest of the page, set to width: 100% and background: no-repeat.

Annoying? Yes.

Do you know the TFoot tag, the tfoot tag, the tfoot tag...

Interestingly enough, I actually learned something about HTML today. Yep, good ole HTML, just when I think I know you, you go and throw me a curveball. Well okay, perhaps it's not quite so dramatic, but it's an interesting little tidbit of information none the less.

Basically, we all know tables have rows and cells, which appear as:


However, did you know that there are some other mysterious table tags, thead/th, tfoot, and tbody? Perhaps you've seen tbody floating around here and there, probably even th/thead. However, the part that I actually find interesting is the tfoot tag. In your HTML structure it would be laid out like this:


Now here's where the interesting part comes in - the tfoot section is actually rendered BEFORE the tbody section, but below it in the page. This is possibly an interesting reference to the early days of the web when text actually took time to load over our 14.4 k modems, and table based layout was the norm. Who knows... (certainly not me).

Of course the real lesson to be learned here is that we should all love CSS, because tables are CRAZY.

Background Image Not Showing Up in IE

Just wanted to share a little IE/CSS particularity that has caught me a few times now in regards to background styling. It seems if you don't leave a space after the url brackets, ie:

background: url( top;

it can not parse the style. I suppose this is pretty straightforward and any reasonably intelligent person could recognize this glitch, but it's caught me at least twice now, so I thought I'd throw it out there on the web.

If I was really motivated I would go look up the CSS Specifications for this and see if this is IE's mess up or everyone elses, but hey, I'm just not.

PHP in JS?

Seems some clever people are porting php functions into a javascript library. At the very least the md5 function should come in handy. Not sure what the security implications of that are however. Check it out for yourself:

Google Apps Email Pop Issues

I have a client account set up which will not connect to the incoming gmail server. I have tried deleting the account and setting it up again, as well as changing the password.

It basically keeps asking for the password over and over again when Testing the Account settings/checking mail, as if the password were incorrect, despite accepting that password just fine for outgoing/smtp as well as for the webmail interface.

I saw a post about resetting CAPTCHA here: and tried that as well, which also did not solve the problem.

Currently looking for the answer still - in the meantime I ended up creating a new mail account, forwarding the mail through Gmail's webmail interface, and simply receiving the email from this new account.

There once was a girl...

Well, I set this blog up to test some settings for a client. And then I though, what the hell, I'm learning things every day at work, and I know how frustrating it can be sometimes trying to find answers on the internet. So why not share those answers with the world? And so I will.

Right now I am testing what happens when you edit a post in Blogger. We are trying to decide what to do in our own CMS blog in regards to post ordering.