27 February 2008

Several Quick ExtJS Tips

Just some stuff I've come across:

1) When creating multiple GridPanels in one page, don't try and be cheap and use the same SelectionModel for multiple grids. Create a new one each time, or you'll get errors. [Source]

I encountered this problem when creating multiple grids and using a common config object that had been pre-rendered to save time. It'll look like it's working at first, but then JavaScript errors will start popping up as you click on rows, or cells, or whatever the particular SelectionModel you've chosen is supposed to select.

2) Tired of constantly having to create individual stylesheet entries everytime you want to use the "iconCls" parameter when configuring ToolBar buttons or menus? Well, make you up a quick little function like the following:


var makeIconCls = function (className, url, id) {
Ext.util.CSS.createStyleSheet(
'.' + className + '{background-image: url(' + url + ') !important;'
+ 'background-repeat: none;}'
, id
);
return className;
}


... and just put "makeIconCls('[class-name]', '[url.to.image]', '[reference-id]') instead of just a string variable whenever using the "iconCls" parameter.

3) Well, this isn't really a ExtJS tip, just a JavaScript tip in general -- ever wondered why you sometimes create a function with
function [function name]([params])

and other times you use
var [function name] = function([params])

?
Well, if you find out, tell me. :P Seriously, all I've discovered is that you can somewhat "defer" the defining of a function by using the "var [function name]" method, while if you use the command "function" directly, the function can be defined long before any lines of code above it are even processed. Make sense? I'm sure there's some good reason for this... right?

21 February 2008

DOT DOT DOT. (ellipsis)

...

Just today, just five bloody minutes ago, I learned that the DOMINO server can output JSON.

How? How do you do this wonderous thing which by all accounts should require mountains of code?

...

Just append "outputFormat=JSON" to the end of your "ReadViewEntries" URL.

I don't know if this is a relatively new addition to the server or not, but I've never been more excited/pissed-off in a long time. Had I know about this a long time ago...

Bah, now that I think about it -- big deal. This could make things easier, but the server-side stuff (and subsequently, translating server-side code into client-side objects) has never really been too difficult.

But still. Bye bye, XML -- it's been nice, but seriously. Enough with the 90's.

05 February 2008

Curta Mechanical Calculator - System Curt Herzstark

Curta Mechanical Calculator - System Curt Herzstark

You know the antique Curta "wind-up" calculator that they're talking about in William Gibson's book Pattern Recognition? Well, the damn thing actually exists, of course:



There's even an absolutely amazing working simulator [via Flash] found here: http://www.vcalc.net/curta_simulator_en.htm

04 February 2008

JavaScript Profiling with Firebug + Firefox

I'm sure you're already using Firefox and Firebug to debug and help code your JavaScript. (If not, seriously, why? Get it here and here, you silly person, you.)

Want to see something that will blow just blow your mind and that I, a Firebug user for more than a year, just figured out today?

Put "console.profile()" at the start of a block of your code and "console.profileEnd()" at the end of it.

Then load the page in Firefox (with Firebug, of course).

Yeah... neat ain't it. It's a complete listing of every single JavaScript call that was done between the two little bits of code that you added.

I just fucking found out about this.

Thin is in: Ars Technica reviews the MacBook Air

Thin is in: Ars Technica reviews the MacBook Air

Read the whole thing, if you can (I did) -- it's a pretty good review. Talks about the good points (incredibly light weight, wonderful keyboard, beautiful screen) and the bad points (abysmal battery life, extremely slow disk, soldered-in RAM).

01 February 2008

Microsoft bids $44.6 billion for Yahoo

Microsoft bids $44.6 billion for Yahoo | CNET News.com

Seeing as how Yahoo hasn't been doing wonderfully lately, I wouldn't doubt that this deal would go through. It's sad, too -- I had thought that there had been a lot of interoperability going on between Yahoo and Google these days. I had seen plenty of communication between the various programming teams on each side. But, oh well.

However -- I guess it's seriously time to stop using Del.icio.us and Flickr now, unfortunately. Microsoft already has enough information they own about me -- I'm not going to start giving them even more.