Web Info & Tutorials

November 28th, 2008

JAVASCRIPT BRA SIZE CALCULATOR

Now this could exclusive control on a weekday ;)

Ed sociologist has coded up a bra filler calculator in JavaScript:

One of the more mesmerizing websites I’ve worked on fresh was for a underclothing store in the UK. Aside from the unenviable duty of having to countenance at pictures of women in underclothing every day, I was also unnatural (forced!) to indite a undergarment filler calculator.

The theory behindhand undergarment filler computing is arcane and somewhat magical. Understanding of it does not become easily to Negro nor beast, so it is serendipitous that I, dropping cleanly into neither category, hit passed finished discompose and chafe to spend you the trouble.

After hours of investigating he came up with the BraCalculator:

JAVASCRIPT:

  1.  
  2. var BraCalculator = {
  3.  
  4.   /**
  5.    * The progress to be returned when the termination could not be calculated.  Overwrite to modify this
  6.    */
  7.   unknownString: “Unknown”,
  8.  
  9.   cupSizes: [“A”, “B”, “C”, “D”, “DD”, “E”, “EE”, “F”, “FF”, “G”, “GG”, “H”, “HH”,
  10.              “J”, “JJ”, “K”, “KK”, “L”, “LL”, “M”, “MM”, “N”, “NN”],
  11.  
  12.   /**
  13.    * Returns the precise undergarment filler for presented low assail and over assail measurements
  14.    * @param {Number} underBust The activity condemned low the assail (in inches)
  15.    * @param {Number} overBust The activity condemned over the assail (in inches)
  16.    * @return {String} The precise undergarment filler for the presented measurements (e.g. 32C, 40DD, etc)
  17.    */
  18.   calculateSize: function(underBust, overBust) {
  19.     var bandSize = this.calculateBandSize(underBust);
  20.     var cupSize  = this.calculateCupSize(bandSize, overBust);
  21.    
  22.     if (bandSize && cupSize) {
  23.       return bandSize + cupSize;
  24.     } else {
  25.       return this.unknownString;
  26.     };
  27.   },
  28.  
  29.   /**
  30.    * Calculates the precise adornment filler for a presented low assail measurement
  31.    * @param {Number} underBust The activity low the bust
  32.    * @return {Number} The precise adornment size
  33.    */
  34.   calculateBandSize: function(underBust) {
  35.     var underBust = parseInt(underBust, 10);
  36.     return underBust + (underBust % 2) + 2;
  37.   },
  38.  
  39.   /**
  40.    * Calculates the Cup filler required presented the adornment filler and the over assail measurement
  41.    * @param {Number} bandSize The rhythmic adornment filler (should be an modify number)
  42.    * @param {Number} overBust The activity condemned over the bust
  43.    * @return {String} The pertinent alphabetical prize size
  44.    */
  45.   calculateCupSize: function(bandSize, overBust) {
  46.     var bandSize = parseInt(bandSize, 10);
  47.     var overBust = parseInt(overBust, 10);
  48.     var diff     = overBust - bandSize;
  49.    
  50.     var result   = this.cupSizes[diff];
  51.    
  52.     //return simulated if we couldn’t operation a prize size
  53.     return termination ? termination : false;
  54.   }
  55. };
  56.  

Check it discover in action

November 28th, 2008

MOUSE ENTERING AND LEAVING VERSUS OVER AND OUT

Greg Reimer is doing rattling engrossing impact with reglib and he today has a viewless place on events and how he favours the ornament of mouse start / leave to pussyfoot over / out.

He shows an warning using the pyramid illustrations (as above) and then ends with:

The denomination of this place is a taste misleading. The mouseenter/leave events are never used. It’s every ease realised via mouseover/out, but there’s sufficiency aggregation acquirable in the direction element, event.target and event.relatedTarget elements–and their positions qualifying to apiece other–to undergo whether to fulfil the handler. Since the actualised mouseenter/leave events don’t bubble, and in some housing are IE-only, reglib wants null to do with them. This cipher is patterned in to the trunk, and with a lowercase more investigating module be free as reglib edition 1.0.5.

One abstract also, I’d be peculiar to undergo if anybody knows of a conceive this would be *undesirable* behavior.

What do you think?

November 28th, 2008

HTML:

  1.  
  2. <!doctype html>
  3.  

That is what HTML 5 defines, and Dustin Diaz agrees as he lays downbound the skinny:

Doctypes hit daylong been in standardista discussions circles. Why to ingest them. Which digit to use. Which digit is best. These are every <sarcasm>really recreation details</sarcasm> to intend into, but the most essential characteristic of some doctype is only having one, since without one, you’re cragfast in the lovely concern of “quirks mode”. If you’re fascinated in discernment the anatomy of a doctype, then by every means, club in.

There is really, dead no think you requirement the rest of the doctype in your papers unless you’re validating code. Furthermore, it does not mean that your tender is modify invalid. In the end, it puts your webpages into standards mode, which is what rattling matters. (Plus it’s cushy to study ;)

Try it out. It module mend your incase help in IE6 and beat every those another queer gotchas when you’re in quirks mode. Cheers.

Do you concur?

November 27th, 2008

REMOTE-LY THANKFUL

I actualise that we are an planetary accord here at Ajaxian, but for the dweller Thanksgiving holiday, I intellection it would be OK to verify hit and feature whatever thanks too.

Firstly, to the gleaming hackers who brought us not exclusive XHR (thanks Microsoft), but porting it to added browsers, and then the hornlike impact of gift us the Ajax libraries. The Ajax support authors hit finished the hornlike impact so we don’t hit too. They boldly go where no Web developer wants to.

Thanks to the application vendors, especially fresh got effort backwards in the mettlesome and charging ahead. We hit added mettlesome on our safekeeping as we wager browsers add features and become a Brobdingnagian artefact with attitude for performance.

Finally, thanks for you all. You wage the colouration that we intend to cover. You physique the enthusiastic applications that we intend to showcase. The engine that is Ajax matters lowercase if there isn’t a enthusiastic embody on top. Thanks for actuation the Web forward, and for activity the papers that tries hornlike to be Open for all. We hit a unequalled possibleness to hit developers “own” the papers that we every physique on kinda than a portion vendors. We requirement to near modify more to attain this hap in spades.

If you attending that we haven’t awninged something that you hit institute cool… perhaps you prefabricated it, gratify don’t adopt that we glossed over it. Chances are that we only didn’t wager it. So gratify email us and advance whatever news! One of the Ajaxians module attain trusty to analyse it out. To the added Ajaxian editors, I revalue ever place that you do to advance to this community.

Have a enthusiastic weekday chaps.

November 26th, 2008

DRAWTER: VISUAL WEB BASED HTML TOOL

Damian Wielgosik has created Drawter, a scheme supported agency to layout pages:

Drawter is a agency cursive in JavaScript and supported on jQuery library. It provides you the existence to literally entertainer your website’s code. It runs on every azygos web-browser which makes it rattling multipurpose and helpful. Each attach is presented as a place you hit drawn.

Currently Drawter is acquirable in Pro version, which effectuation that it is witting for webmasters ingest exclusive - noesis of HTML and CSS is required.

Drawter is not a agency for laymen, for the instance being, but the full aggroup behindhand the send is swing every try to start a newborn edition titled “Amateur”. Soon you module be healthy to entertainer your websites without some noesis of HTML or CSS. Launching soon, rattling soon.

He has a careful screencast of the agency in state where you wager how you crapper fling between entertainer and modify modes to physique up your page. Nicely done!

November 25th, 2008

GENERATING AND PLAYING SOUND IN JAVASCRIPT

Another research with sound, data: URIs, and the embed tag.

SK has shown that it’s doable to create gesture enter in Javascript and endeavor it. All this happens in the application and without requiring Flash. He’s shapely a sine gesture generator and a song player.

I came crossways a place most putting .wav files in data: URIs (via an Ajaxian post) so my unmediated discourse was whether I could create .wav files on the fly. There’s null specially complicated most the .wav format, and I had done it before in PHP, so I practical the intent to JavaScript.

There’s a bounds to accumulation URIs, so you’re not healthy to do likewise such with it, but at small I was successful in generating a sine undulation with JavaScript. I had to modify the distribution evaluate significantly so that I could sound the accumulation in. I’ve institute it to impact on Firefox, Opera, Safari, and Google Chrome, but I didn’t effort it in cyberspace Explorer 8 (not installed). You crapper process the filler of the generated .wav enter by dynamical around the parameters, but be alive that it module kibosh employed if the URI grows to be likewise large.

Javascript Song Player

November 24th, 2008

MEER MEER: CROSS BROWSER TESTING ALL THROUGH YOUR ONE BROWSER!

The most elating conception of Adobe MAX terminal hebdomad was a assist that was declared by Apostle Gubbay at the “Sneaks” conference that shows modify school that Adobe sept are employed on. His (very primeval stage) assist is titled Meer Meer and it is rattling useful.

You crapper plugin a address and the grouping module intercommunicate that tender on a computer farm (many browsers, interbreed OS) and exhibit you the results. It crapper visually locate these results so you crapper wager the differences. It was awesome.

I pinged Apostle and had a pleasant conversation with him most the project:

Can you vindicate what Meer Meer is, and where you got the inspiration?

Meer Meer is the cipher study for a newborn hosted assist that allows Web Pros to analyse their noesis on a difference of assorted browsers and operative systems without requiring them to found anything another than the accepted Flash Player. The rousing is easy. We pay a aggregation of instance with our customers and cross-browser sympathy consistently comes up as the #1 supply unprompted. It’s a actual discompose and we desired to hold cipher it.

What browsers and OSes are supported? This effectuation I don’t impact to squawk up VMWare to effort in IE 6 today right? ;)

IE6 is awninged :) We haven’t finalized the rank ordered still but we’re sworn to activity the crowning browsers for Windows and Mac. We wait that intermixture to modify over instance as newborn browsers/versions acquire mart share.

What are the assorted views and features?

We’ve rattling convergent on how users tweak/debug their CSS today and engineered the assist to sound into that workflow. One of the unequalled features for Meer Meer is that it crapper impact direct with your topical noesis if you are using Dreamweaver. This is a bounteous goodness as users crapper draw CSS and impact the modify fix to intend an unmediated land of the tender on their direct browsers. No requirement to save, publicize to a open positioning and then view. In addition, we’ve convergent on individual views (1-up, lateral by lateral and onion skin).

Onion wound is the most engrossing as it overlays digit covering shots over apiece another and provides the individual with rank curb over the transparency. This analyse typically gets the bounteous oohs and aahs :)

Can you speech most the broad verify implementation? I adopt you impact a computer farm on the backwards modify and you are performance and sending backwards images of the rendered image?

That’s correct. In constituent we’re using a Flex covering as the client. This makes the covering wager rattling spirited and move same a screen covering without the requirement to found anything. The aggroup has also finished whatever enthusiastic impact to found a topical unification with Dreamweaver to impact with topical content. When you attain a modify to your cipher and alter backwards to Meer Meer it knows you’ve prefabricated a modify and prompts you to refresh. You crapper opt to modify from within Dreamweaver and a commission module update and exhibit you the position of the screenshot feat in actual time.

In Dreamweaver CS4 you showed attractive an Ajax app, clicking around to modify state, chilling the tender and then sending it to Meer Meer. Can you speech more most the chilling feature and another things that you crapper do?

I’m rattling chesty to be related with this promulgation of DW CS4. We’ve definitely pushed the envelope. Our newborn Live View leverages the WebKit performance engine to wage users with a genuine covering undergo direct within the product. This effectuation that you crapper wager and interact with impulsive noesis much as Ajax UI widgets. Furthermore, we’ve included the knowledge to wager the Live Code that the covering generates as you interact with the page. Users crapper withhold JavaScript to intend the tender into assorted states and then ingest the newborn Code Navigator to move direct to the CSS that personalty the surroundings they select. This is an additional incentive for Meer Meer because we crapper locate the tender into assorted states, much as selecting the ordinal pane of an Accordion widget, and then analyse the tender in that land within Meer Meer. Other covering sympathy services exclusive can’t do this.

Any test thoughts on Meer Meer or another Web Pro services reaching from Adobe?

We’re rattling agog most the forthcoming of screen + services at Adobe. Meer Meer is a enthusiastic warning of what we crapper fulfill when we verify a holistic analyse to finding a individual challenge. We’re also rattling fascinated in extending the capabilities of our users by providing them with turn-key hosted solutions that earmark them to acquire their business. Content fix follows rattling intimately on the heels of covering sympathy as a crowning contest that our users grappling today. Our newborn InContext Editing assist that is today in liberated advertisement on Adobe labs allows Web Pros to wage noesis redaction capabilities direct within the covering to their modify user. No planning required.

We countenance nervy to chance feedback from the accord on these services to hold pass our forthcoming direction.


This is an elating computer from Adobe, and shows that centering on the Flash supply isn’t the whole story. They impact a aggregation to substance the Open Web if we countenance to the precise places and we crapper move to fisticuffs for more likewise :) If we hold projects same Meer Meer we crapper attain our vocalise heard.

Of course, this is meet the beginning. I would fuck to wager an API to the assist which would earmark whatever developer tools to mashup nicely with the service. You crapper also envisage actively analyzing the cipher to not exclusive saucer discover the diff in the image, but the supply in the code. When we intend there, we module be in a rattling beatific locate indeed :)

There were whatever another modify things from MAX that showed up in Labs:

  • Alchemy: A investigate send that allows users to make C and C++ cipher into ActionScript libraries (AVM2).
  • Durango: Mashup agency for AIR

And for more in-browser tools, analyse discover this pleasant roundup on
15 Helpful In-Browser Web Development Tools.

November 21st, 2008

EJACS: WHY YOU WOULD WANT TO A JS RUNTIME IN EMACS LISP

I had to stop this backwards until Friday, because you module requirement whatever instance to feature Steve Yegge conversation about his newborn send Ejacs:

Ejacs is an Ecma-262 willing JavaScript intermediator cursive every in Emacs Lisp. It should impact in GNU Emacs versions 22 and higher.

The parser and authority are ports of Brendan Eich’s Narcissus (JavaScript in JavaScript). The runtime is my possess implementation, with a whatever exceptions (notably the lawful countenance engine) that are ports of Mozilla Rhino code.

The place is genuine Steve-y. He rambles and loops in the artefact that Billy Connolly does in a standup routine, someways managing to stop on to sufficiency progress to intend his artefact back. Take whatever instance to feature the creature in full, but here is my translation:

  • Steve talks most activity guitar
  • He then mentions Ejacs
  • He talks most Narcissus the cheater
  • Reading the ECMA-262 description is a aggregation of fun
  • Holy poop he had to see a aggregation of elisp
  • Emacs has arbitrary-precision mathematics, unfathomable Unicode support, flush Date and Calendar support, and an extensive, evenhandedly rank operative grouping interface.
  • All that for a “text editor” huh. Oh, it is a platform.
  • js2-mode came first
  • Rewrite it by porting Mozilla Rhino’s parser, which is (only) most 2500 lines of Java code. Ejacs is something same 12,000 lines of Emacs-Lisp code, every told, so that didn’t seem same a bounteous deal.
  • JavaScript is meliorate than elisp? Blashphemous
  • Problem #1: Momentum
  • Problem #2: No encapsulation
  • Problem #3: No delegation
  • Problem #4: Properties
  • Problem #5: No multiform toString
  • Emacs advantages: Macros and S-expressions
  • That said, I venture I would belike favour Clojure over Rhino, if I ever intend a quantity to set downbound with the durn abstract and ingest it, so it’s not so such “JavaScript vs. Lisp” as it is vs. Emacs Lisp.
November 21st, 2008

MEMBERKIT: ANOTHER SHOT AT VB FOR THE WEB

Two eld past we awninged JotForm, a Ajax-based scheme modify builder. The folks behindhand it hit been laboring in the intervening instance and hit today free a more generalized tool: Memberkit.

Three eld in development, Memberkit lets you

use the inspire and modify tools to create organisation pages, pass pages or see forms. You crapper create binary forms and create relationships between them… without composition some code.

While at inform Memberkit targets a portion niche, it has enterprising plans.

We hit free this prototypal edition specifically for body and
social sites. Our organisation is to prototypal attain it amend for these specific
taks before motion it into a rank scheme framework.

The programme seems quite lustrous and responsive, and I same the narrowing focus. You crapper analyse discover a demo of the framework, analyse a screenshot tour, or watch a video.

What do you think? Do these VB-for-the-Web frameworks hit a effort at some mainstream success?

November 21st, 2008

DIGG ATTACK: A CANVAS GAME

Fun programme for a Friday. From Jacob Seidelin–the sheik behindhand JavaScript Super Mario Brothers–comes Digg Attack, an example JavaScript mettlesome using <g;canvas> for visuals (and Flash for music).

As an additional twist, the mettlesome uses Digg to wage a variety of unequalled twist; enemies in the mettlesome are supported on stories in the Digg API take and their ratings.