Posts

Showing posts from 2007

Adobe MAX 2007 conference: visitor notes

I have to admit that these four thousand people at the conference in majority were very enthusiastic, showed a lot of interest and eager to learn and to be at the top of the technological edge. Adobe gathered a lot of companies and individuals who combined various production line ideas and tricks in attempt to create something new. And many of them succeed. No doubt there was what to see and what to do. My prime interest was Flex and ActionScript 3.0. Accordingly I attended sessions related to these technologies. Here at glance some thoughts and ideas which caught my attention during sessions: In Customizing the Flex Framework session: Skinning, effects, data descriptors, collections, validators, formatters can be extended to implement our own components. Speaker pointed the use of tag which adds a new scope of content, and if we want to access outer scope from our component, we use 'outerDocument'. In case of bug in Flex framework impossible to find a workaround for we can &

Mainstream is Flex 2. Today.

Ok. It's been a while I have not posted here. The main reason is I am not THAT interested in DHTML these days since I joined Packeteer . I immediately started to learn and develop on Adobe Flex 2 and Apollo (which is called AIR now). For the last three months I've learned many tricks how to make actual application work, how to build web site on it, and make it dynamic. Just want let you know I am here, not actually looking for another job, and probably will start postings about Flex, because it is really COOL. Cheers.

Add zero-width spaces every 10 characters

For dynamic pages sometimes you can't say in advance what exact content will be, and therefor you have no control of actual content, for example words can be very long, and not wrappable by browser. For this purposes I use special zero-width space (x200B) which exists in HTML specs. I wrote a function which you call on strings whenever you need it: yourStr.HTMLwrap() Here it is: /** Add zero-width spaces every 10 characters */ String.prototype.HTMLwrap = function() { var i = 0; var a = ''; var len = this.length; while(len > i*10+10) { a += this.substr(i*10, 10) + '\u200B' i++; } return a + (i>0?this.substring(i*10, this.length):this); }

How to test javascript performance time

First, create area where results will be output. You can adjust any style property to fit your needs. Minimum what you need to change is "parentNodeId": // Test env function testEnv() {  var parentNode = document.getElementById("parentNodeId");  if (parentNode) {   var testNode = document.createElement("div");   testNode.id = "testEnv";   testNode.style.height = "7em";   testNode.style.backgroundColor = "white";   testNode.style.overflow = "auto";   testNode.style.border = "1px solid #778899";   testNode.style.textAlign = "left";   testNode.style.overflowX = "hidden";   testNode.style.whiteSpace = "nowrap";   parentNode.appendChild(testNode);  } } Then, in the function or any piece of the code you are testing, write: in the beginning: var beginTime = new Date().valueOf(); and finally, at the end: if (document.getElementById("testEnv"))   document.getElementById("

"The webpage you are viewing is trying to close this window"

In Internet Explorer 6 there is the way to close window by javascript without warning: "The webpage you are viewing is trying to close this window": window.opener = top; window.close(); But not in IE 7 unless window was opened by your javascript from other window.

Adding event listener on the page

Suppose you have an input field and you need FilerTag function be performed each time user types a character. Below are two approaches for this. Native browser approach: if (a.addEventListener) {a.addEventListener("keyup", FilterTags, false)} // firefox else if (a.attachEvent) {a.attachEvent("onpropertychange", FilterTags)} // ie YUI approach: YAHOO.util.Event.addListener(a, "keyup", FilterTags);