nextwebgen.com

The Next Generation Web Now

How Hard is AJAX Coding? The "Oh My God" Moment - SYS-CON Media

Filed under: Web 2.0 News — Ajax - Google News at 6:49 am on Friday, November 30, 2007
How Hard is AJAX Coding? The "Oh My God" Moment
SYS-CON Media, NJ - 1 hour ago
I spent some time playing with Bob Buffone's newest work on Ajax over the last few days. Bob built an xmodify processor that runs on either jquery,

Brendan Eich: JavaScript 2 evolution and the myth busting Tracing JIT

Filed under: Web 2.0 News — Dion Almaer at 6:48 am on Friday, November 30, 2007

I love watching Brendan Eich speak. You know that before long you will be deep into a topic, and if you slip up for a minute you will be hopelessly behind. You have to listen closely. Even if you do, you will probably think that you missed a lot of it.

Brendan has posted his slides on JavaScript 2 and the Open Web as a narrative.

The presentation starts off having a bit of fun with the characters behind the JavaScript 2 debate such as Douglas Crockford (Yoda above). You can argue about the politics of ES4 but the piece I found most interesting was Brendan taking code that is written in current JavaScript, and evolving it via iterations. In fact, I would love to have seen that as the bulk of the talk as it really shows you what JS2 is all about.

Here is the sample webmail code in JS1:

JAVASCRIPT:

  1.  
  2. function send(msg) {
  3.   validateMessage(msg);
  4.   msg.id = sendToServer(JSON.encode(msg));
  5.   database[msg.id] = msg;
  6. }
  7.  
  8. function fetch() {
  9.   handleMessage(-1);                  // -1 means "get new mail"
  10. }
  11.  
  12. function get(n) {
  13.   if (uint(n) !== n)                  // JS1: n>>>0 === n
  14.       throw new TypeError;
  15.   if (n in database)
  16.       return database[n];
  17.   return handleMessage(n);
  18. }
  19.  
  20. var database = [];
  21.  
  22. function handleMessage(n) {
  23.   let msg = JSON.decode(fetchFromServer(n));
  24.   if (typeof msg != “object”)
  25.       throw new TypeError;
  26.   if (msg.result == “no data”)
  27.       return null;
  28.   validateMessage(msg);
  29.   return database[msg.id] = msg;
  30. }
  31.  
  32. function validateMessage(msg) {
  33.   function isAddress(a)
  34.       typeof a == “object” && a != null &&
  35.       typeof a.at == “object” && msg != null &&
  36.       typeof a.at[0] == “string” && typeof a.at[1] == “string” &&
  37.       typeof a.name == “string”;
  38.   if (!(typeof msg == “object” && msg != null &&
  39.       typeof msg.id == “number” && uint(msg.id) === msg.id &&
  40.       typeof msg.to == “object” && msg != null &&
  41.       msg.to instanceof Array && msg.to.every(isAddress) &&
  42.       isAddress(msg.from) && typeof msg.subject == “string” &&
  43.       typeof msg.body == “string”))
  44.       throw new TypeError;
  45. }
  46.  

And here it is after a set of evolutionary steps. You will see that this looks like a very different beast. Before you eek, we have to realize that most of the code that will be written won’t be cleaned up like this, but rather hacky JS like we have now.

JAVASCRIPT:

  1.  
  2. type MsgNoId = {
  3.   to: [Addr], from: Addr, subject: string, body: string
  4. };
  5.  
  6. function send(msg: like MsgNoId) {
  7.   msg.id = sendToServer(JSON.encode(msg));
  8.   database[msg.id] = copyMessage(msg);
  9. }
  10.  
  11. function handleMessage(n) {
  12.   let msg = JSON.decode(fetchFromServer(n));
  13.   if (msg is like { result: string } && msg.result == “no data”)
  14.       return null;
  15.   if (msg is like Msg)
  16.       return database[id] = copyMessage(msg);
  17.   throw new TypeError;
  18. }
  19.  
  20. function copyMessage(msg) {
  21.   function newAddr({ at: [user, host], name })
  22.       new Addr([user, host]: [string, string], name);
  23.  
  24.   let { to, from, subject, body, id } = msg;
  25.   return new Msg(to.map(newAddr), newAddr(from), subject, body, id);
  26. }
  27.  

Another interesting myth that Brendan busted is the notion that:

Optional typing is required to make your applications perform

Tracing JIT

HeatColor - Firing up elements based on values

Filed under: Web 2.0 News — Rey Bango at 5:45 am on Friday, November 30, 2007

Using color has been a tried and true method of representing importance or value in a UI. Whether it’s negative balance or indicating a successful process, color helps to convey your message much more effectively then plain old text.

Josh Nathanson came up with an interesting jQuery plugin called HeatColor which assigns colors to elements based on a range of values:

HeatColor is a plugin that allows you to assign colors to elements, based on a value derived from that element. The derived value is compared to a range of values, either determined automatically or passed in, and the element is assigned a “heat” color based on its derived value’s position within the range.

You bind a collection of elements such as table rows, divs or list members to heatcolor and let it do the work.

It can find the min and max values of the desired elements, or you can pass them in manually.

The plugin is very easy to use providing for a callback method to return the value to base the color on as well as several config options that can determine the color scheme, order of colors, and min/max for the range of values. The following snippet of code generated some cool results:

$(\"#ex1\").tablesorter();

function sortwithcolor( column ) {
	$(\"#ex1 > tbody > tr\").heatcolor(
		function() { return $(\"td:nth-child(\" + column + \")\", this).text(); }
	);
};

$(\"th\").click(function() {
	$(this).siblings().css(\"background-color\",\"#cccccc\").end().css(\"background-color\",\"#dd0000\");
	sortwithcolor( $(this).parent().children().index( this ) + 1 );
});

sortwithcolor(8);
	

Josh created some other cool demos that are really worth checking out so be sure to hit up his plugin’s page for more details.

Former Floriana Ajax defender Dalli dies - Times of Malta

Filed under: Web 2.0 News — Ajax - Google News at 5:32 am on Friday, November 30, 2007
Former Floriana Ajax defender Dalli dies
Times of Malta, Malta - 27 minutes ago
Dalli started kicking a ball with the popular Floriana Ajax juniors of the World War Two era. He was tall and robust. Initially, he was deployed as

Bug: Object Killing in IE7

Filed under: Web 2.0 News — Dion Almaer at 1:16 am on Friday, November 30, 2007

Jon Sykes thinks he has found a bizarre bug in IE7. Since Microsoft has 34 QA people per developer, surely not! ;)

He told us:

There is a bug in IE7 where by a line of code inside a conditional statement that NEVER runs, can cause an object that is set with a fairly standard object declaration to be whipped. Even weirder is that it will have whipped the code even if you put a debug alert of the object before the code that does the whipping. Confused? I know I am.

Thankfully it does look fairly simple to work _around_ and avoid. But it’s probably a debug nightmare, and it’s a bug I couldn’t find referenced anywhere, so I figured it was worth sharing.

A simple test case is:

HTML:

  1.  
  2. <script type=“text/javascript”>
  3.         this[‘test’] = {};
  4.         alert(this[‘test’]);
  5.         // will spit out [Object object]
  6. </script>
  7. <script type=“text/javascript”>
  8.          alert(this[‘test’]);
  9.          // will spit out Undefined in IE7
  10.  
  11.          // this next chunk of code should never run.
  12.          if (true == false){
  13.            alert("This never fires");
  14.            // THIS SHOULD NOT IMPACT ON ANYTHING !!!!
  15.            var test; // take this line out and it works fine
  16.            alert("This never fires");
  17.          }
  18. </script>
  19.  

Leadership 2.0 – lessons from Web 2.0 companies - CEO Forum Group

Filed under: Web 2.0 News — web 2.0 - Google News at 12:08 am on Friday, November 30, 2007
Leadership 2.0 – lessons from Web 2.0 companies
CEO Forum Group, Australia - 4 hours ago
Web 2.0” is a term used to refer to second-generation web-based services. These sites include social-networking sites (Facebook and myspace),
Companies Still Battling Internet Procrastination IDM.net.au
surveywatch: Internet time-wasting report wastes employee's time SearchCIO ANZ
all 3 news articles

Leadership 2.0 – lessons from Web 2.0 companies - CEO Forum Group

Filed under: Web 2.0 News — web 2.0 - Google News at 12:08 am on Friday, November 30, 2007
Leadership 2.0 – lessons from Web 2.0 companies
CEO Forum Group, Australia - Nov 29, 2007
Web 2.0” is a term used to refer to second-generation web-based services. These sites include social-networking sites (Facebook and MySpace),

Zumobi Talks Widgets And Mobile 2.0 - InformationWeek

Filed under: Web 2.0 News — web 2.0 - Google News at 10:40 pm on Thursday, November 29, 2007
Zumobi Talks Widgets And Mobile 2.0
InformationWeek, NY - 2 hours ago
Guess what, widgets are key to bringing Web 2.0 to the third screen. Over The Air (OTA): Hello Beth, welcome to Take 5 on Over The Air. Let's dig in.
« Previous PageNext Page »