18 December 2006

Jack Slocum's Blog - Creating a reusable Ajax driven dialog

Jack Slocum's Blog - Creating a reusable Ajax driven dialog

"Along with the official release of 0.33, on Thursday I posted a new Image Chooser example which can be found in the yui-ext Documentation Center. In this post we will go over the important parts of the code behind the chooser, and hopefully give you a better understanding of how you can combine different components to create a new component - one that is more suited for your application."

Seriously, someone needs to give this guy a freaking medal. He's one of the best javascript programmers I've ever seen.

That being said, I think I'm finally ready to start implementing this yahoo library stuff -- the only problem I had was trying to figure out what libraries needed to be included per page, but I think I've got it, now.

14 December 2006

WTF? with Select object assignment

Okay, what the hell.

Can you, or can you not, assign a value to a select object by using "[element].value = [value to assign]"? It apparently works in both IE and Firefox, but not all the time...

What I'm starting to see is that if you use a "lazy" select object -- for example:

<select>
<option>text #1</option>
<option>text #2</option>
</select>

-- you can assign a value using the above method (the select object UI will reflect the change by switching to that value), but if you use a "proper" select object -- for example:

<select>
<option value="value #1">text #1</option>
<option value="value #2">text #2</option>
</select>

-- the above assignment method will work in IE, but not in Firefox.

Once again, I wonder what the standard says?

12 December 2006

Another IE bug

Had a strange error this morning -- I was trying to clone some DOM objects, and my script kept failing in Firefox but working in IE...

Aye, it's usually not a good thing for that to happen -- it usually means that there's some bad error in your code, but, like always, IE is just ignorantly glossing it over and continuing with execution.

Guess what it was? A capitalization error on my part. Apparently, when you're referencing DOM objects in IE (at least when you're trying to clone them), IE doesn't even think about case-sensitivity. Great.

Oh, Internet Explorer, there's those VB-style coding techniques biting you in the ass again...

08 December 2006

Possible JavaScript Compressor

Take a look at this -- it's something I've been working on.

Get you an HTML document, make you two <textarea>'s with the ID's "dataArea" and "resultArea" and one <input> with the ID "ProcessBar", then make you a button with the following code in its onclick() handler:

var prOut = document.getElementById('ProcessBar');

var theText = document.getElementById('dataArea').value;

prOut.value = 'Removing C++ style comments...';
var theText = theText.replace(/(\/\/).*[\n]/g, '');

prOut.value = 'Removing C-style comments...';
var theText = theText.replace(/\/\*([^\/]|\n)+\*\//g, '');

prOut.value = 'Removing tabs...';
var theText = theText.replace(/\t/g, '');

prOut.value = 'Removing padded plus signs...';
var theText = theText.replace(/ \+ /g, '+');

prOut.value = 'Removing padded minus signs...';
var theText = theText.replace(/ - /g, '-');

prOut.value = 'Removing padded equal signs...';
var theText = theText.replace(/ = /g, '=');

prOut.value = 'Removing padded less than signs...';
var theText = theText.replace(/ < /g, '<');

prOut.value = 'Removing padded greater than signs...';
var theText = theText.replace(/ > /g, '>');

prOut.value = 'Removing padded semicolons...';
var theText = theText.replace(/; /g, ';');

prOut.value = 'Removing padded equality signs...';
var theText = theText.replace(/ == /g, '==');

prOut.value = 'Removing padded inequality signs...';
var theText = theText.replace(/ != /g, '!=');

prOut.value = 'Removing padded ternary question marks...';
var theText = theText.replace(/ \? /g, '?');

prOut.value = 'Removing padded ternary colons...';
var theText = theText.replace(/ : /g, ':');

prOut.value = 'Removing padded OR signs...';
var theText = theText.replace(/ \|\| /g, '||');

prOut.value = 'Removing padded AND signs...';
var theText = theText.replace(/ && /g, '&&');

prOut.value = 'Removing extra newlines...';
var theText = theText.replace(/\n{2,}/g, '\n');

document.getElementById('resultArea').value = theText;

Now, put some JavaScript in the "dataArea" and press your button. Get a load of that, eh?

It's not perfect, though -- it seems to get hung up on very big C-style comments, and it can't remove leading spaces at the beginning of lines (yet). Also, it doesn't make your code one big huge long single-lined string like some compressors may, because if you try that crap in the Domino Designer, you start getting errors because your line size is too long.

But, it seems promising! I compressed one of my big 35KB JavaScript libraries with this engine, loaded up the site that it was in, crossed my fingers, and it worked just fine!

05 December 2006

NEC’s 2.13-pound VersaPro Ultralite Type VC


It's cool...
TechEBlog : NEC’s 2.13-pound VersaPro Ultralite Type VC


I want I want I want I want Me Me Me Me My My My My Now. Now. Now...

Microsoft looking to run Windows on OLPC

Microsoft looking to run Windows on OLPC - vnunet.com

"Gates has publicly criticised the OLPC project, arguing that its small screen and lack of a hard disk make it underpowered."

...right before soiling himself and quickly changing his mind when he realized that people were actually going to start using the things.

Good luck trying to get Windows to run on them.

No, seriously -- the goal of this project is to bring third-world countries up to the same level as the rest of the world (as far as computer literacy goes). To be honest, the option (just the option, mind you) to use Windows is actually beneficial to the project, considering the closest competitor (Intel's $400 WinBox) is nearly four times as expensive as the OLPC model. Good luck trying to get third-world countries to buy that bloated piece of crap -- it's hard enough to get them to sign on to the OLPC project.

04 December 2006

Client/Web Newline Characters

Well, apparently when you add a newline character via JavaScript on the web and later open the document in notes (in a rich text field, of course), your newlines are stripped.

Oh, it'll look like they're there in the Client, but try to add any more via JavaScript, and you'll find that they're really not there! As soon as you do the standard old...

field.value += '\n' + text;

...you'll see what I'm talking about.

I had to scrap a really neat response note system because of this. :(

Boohoohoo, back to the drawing board.

01 December 2006

BBC NEWS - Virtual pals 'soar in importance'

BBC NEWS | Technology | Virtual pals 'soar in importance'

This is becoming more and more true everyday. (Just realize the fact that there's an actual person you're talking to on the other side of the internet, and it's easy.)