The 'future of the web' a grand vision that is being considered and debated at this week's FOWA. You could be forgiven for assuming the 'future of the web' is both white and male – the demography of Internet engineers/web developers/IT professionals remains resilient to change. Wider, unchallenged social gender biases were especially prominent in Osama Bedler's (PayPal) presentation. While Bedler's talk on embracing change and moving forward with positivity into a cashless future was well delivered, inspired and fun, the promotional clip from PayPal depicted an intransigent world where women retained greatest responsibility for getting the shopping in and 'mom still made all the meals'. Yeah, way to challenge 'the now' and envision a liberated future. Yet, the conference has included some exciting technology announcements in a convivial atmosphere in West London.
Day 1 included some fantastic talks. Highlights for me? I took a lot from Mike McDermot's (FreshBooks) perspective on priority marketing systems required for even the most scope-trimmed start-ups; this is not my area of expertise and conferences, especially Think Visibility, have been a great source of Internet-focused marketing information. Bruce Lawson's (Opera) discussion and demonstration of HTML5 was thrilling and has me itching to implement new rules in my app's mark-up. Chris Thorpe's (The Guardian) talk on how The Guardian is seeking to adapt to a changing world through 'mutualisation' included a lot of lessons for industries/organisations clinging to outmoded business models and pointed to the prudence of embracing change and innovation in telecommunications. Aza Raskin (Mozilla) finished the evening with pizazz, with a thrilling discussion and demonstration of the future of browsers as Mozilla understands. Mozilla, again, is pushing a sound agenda of personal ownership and individual liberty by innovating a 'you-centric' browser. Inspiring, cogent stuff; not to mention the semi-gratuitous bondage pic included in the presentation appealed to my sense of fun.
With highlights come lowlights. FOWA has many corporate sponsers – a pro and a con – and the panel talk on experiments with building in ASP dot net MVC left me cold; while the tech sounded decent, though the panel's developer (Matt Lee, Redgate) noted it represented more of a 'catching up', it all seemed a bit staged and infomercial. Similarly, the breathless, chirpy presentation for Facebook (Cat Lee) regarding FB Connect was not up to par. The rep delivered what seemed in many ways to be a 'canned talk'; the announcement of a Connect API was exciting and the tech looks interesting, but the delivery did not seem at all appropriate to the audience. While I absolutely agree with Addison Berry's (Lullabot) message that employers benefit from facilitating passion through transparent communication, I was a bit disappointed by her talk which vaguely alluded to all the 'cool shit' and 'crazy shit' she was able to do working in Open Source. What is this 'amazing shit' – no idea – specific anecdotes/examples would have left me with less of an impression that she was 'talkin' shit'.
Day 2 is off with a bang! Britt Selvitelle (Twitter) threw out two points of note: 1) an upcoming release of Twitter Labs (currently in development); 2) the notion of whacking in an API with start-up alpha releases (we're on the same page, dude!). Simon Wardley's talk on cloud computing was hilarious - yes, really - informative, radicalised and astute. Following Wardley's discussion of uBuntu's drive for standardisation in provision of clouds (to drive innovation and retain Internet freedoms, versus constraint through lack of interoperability or a vendor's ownership of a reference model), Joel Moss (Codaset) and Sanj Matharu (Vodafone) demonstrated the ease of mobile widget (mobile apps to you and me) creation using Vodafone's API; these babies are made in HTML, CSS and JavaScript. There's a one million Euro prize fund for great apps, so get on it.
My morning break is coming to a close. All I can say is am looking forward to Vaynerchuck this evening – fuck yeah!
Friday, 2 October 2009
Wednesday, 17 June 2009
Pretty URLs: Routes in Google App Engine
Pretty URLs are an essential element of web applications. Pretty URLs are helpful to users, influential for SEO and implementations may enhance the beauty (and so the extensibility and maintainability) of a code base. This is superbly achieved in Google App Engine using Rodrigo Moraes' App Engine recipe for URL mapping using Routes.
I discussed in a previous post how I used a basic implementation of GAE's WSGIApplication for Pretty URL mapping. While this approach served my initial needs, it required a lot of extra logic to read params from incoming URLs and did not elegantly handle URLs invoked in an AJAX call (i.e. logic was need in the handler to interpret the URL and delegate to the appropriate action). My goal was to implement a Pretty URL mapping scheme that allowed me to:
-configure URL mappings in one place only
-gracefully pass params on URLs
-invoke actions contained in my handlers
Happily, I stumbled upon Moraes' recipe; it was a snap to follow the very clear directions to import Routes and override the WSGIApplication. Further support from the Routes documentation allowed me to quickly and easily meet all my Pretty URL goals.
All URL mappings are configured in routing.py. Params passed on URLs are discretely mapped and retrieved. For instance this mapping accepts a param named 'id' and hits a handler in views.py called 'MyHandler':
In views.py, 'id' is picked up as an argument of the get() method:
How cool is that?! Crisp and clean and no caffeine. It gets better.
I can also map to a handler and an action. This is particularly handy for my api.py, which accepts AJAX requests. With this mapping the correct handler's action is invoked without any messy delegation at the top of my api.py:
How great is this? Pretty URLs and cleaner code. Yes, I've added the Routes resources and Moraes' overridden WSGIApplication, but the separation of mapping logic from other aspects of the application pleases me and I believe makes for a more robust code base. Not to mention, I learned a new thing! Thanks Mr Moraes, my URLs got pulchriTUDE!
I discussed in a previous post how I used a basic implementation of GAE's WSGIApplication for Pretty URL mapping. While this approach served my initial needs, it required a lot of extra logic to read params from incoming URLs and did not elegantly handle URLs invoked in an AJAX call (i.e. logic was need in the handler to interpret the URL and delegate to the appropriate action). My goal was to implement a Pretty URL mapping scheme that allowed me to:
-configure URL mappings in one place only
-gracefully pass params on URLs
-invoke actions contained in my handlers
Happily, I stumbled upon Moraes' recipe; it was a snap to follow the very clear directions to import Routes and override the WSGIApplication. Further support from the Routes documentation allowed me to quickly and easily meet all my Pretty URL goals.
All URL mappings are configured in routing.py. Params passed on URLs are discretely mapped and retrieved. For instance this mapping accepts a param named 'id' and hits a handler in views.py called 'MyHandler':
map.connect('handler/:id', controller = 'views:MyHandler')In views.py, 'id' is picked up as an argument of the get() method:
class MyHandler(ParentHandler):
def get(self, id): ...
How cool is that?! Crisp and clean and no caffeine. It gets better.
I can also map to a handler and an action. This is particularly handy for my api.py, which accepts AJAX requests. With this mapping the correct handler's action is invoked without any messy delegation at the top of my api.py:
map.connect('api/handler/action', controller = 'api:MyHandler', action = 'action')How great is this? Pretty URLs and cleaner code. Yes, I've added the Routes resources and Moraes' overridden WSGIApplication, but the separation of mapping logic from other aspects of the application pleases me and I believe makes for a more robust code base. Not to mention, I learned a new thing! Thanks Mr Moraes, my URLs got pulchriTUDE!
Tuesday, 24 March 2009
Ada Lovelace Day: my tech heroines
My own career in technology has been inspired by several women in technology and engineering; my tech heroines include my mother, Linda Ziegler, my mother-in-law, Julia Russell, and two former work colleagues, the designer Kat Neville and the Java developer Magz McCarthy.
In some key ways, my own career path reflects my mother's. Linda started her undergraduate degree with the aim of becoming an historian, but as the limited opportunities in this area became more apparent to her, she determined to train as a chemist and worked as a manufacturing chemist in the plating industry. Similarly, I attained a PhD in British History and Economic and Social History and pursued an academic career for some years; at the end of my ESRC Post-Doctoral Fellowship, at which stage I hadn't successfully interviewed for one of the three positions in the nation in my field, I determined that I had to make a change and decided to do a 'conversion course', or a one year Masters in Information Technology. My mother's personal history of moving between a humanities and science discipline has always been part of my understanding of her, and was an important part of my inspiration to 'do what I had to do' in terms of getting the sort of training that would give me access to decent labour opportunities. I should, however, note here that my partner's example - he has a Bachelors in English Language Linguistics and a Masters in Cognitive Science and learned Java 'on the job' during the turn of the century Dot Com Boom - as well as his practical assistance as tutor was further integral to my attaining my MSc in IT with Distinction from Queen Mary, University of London.
Upon completing my MSc, I worked firstly as a Research Assistant in the Computer Science Department of Queen Mary and then as a Java web application developer at Xbridge/Simply Business and then its child company, BView, but it is only over the last year, working for myself building my own application that I've started to feel confident and passionate about working in Internet tech. It had been a difficult transition from a career path I had invested in so heavily and had been deeply passionate for to one I'd entered out of pragmatism.
My flourishing passion and joy for my work has been encouraged in no small way by Julia, Kat and Magz. Jules has a great love of gadgetry and Internet technology and stands out as a 'woman of a certain age' with such an appetite and ability to learn to use the latest tools and gizmos. She's been building web sites since the early days of the web and has recently been recognised as setting a gold standard of best practice for school websites (she works part time at her local primary school). Jules used Google Sites to create a user-friendly and professional site to communicate the school's happenings to the community. Indeed, Jules represents a quirky blend of 'good life hippy' and technologist and her home, nestled in the Scottish Highlands, is aptly called 'the electronic cottage'; much of her work is home-based and includes web administration for an international development organisation and desk top publishing for local authors. Her willingness to investigate new technologies and to understand and advocate the appropriate uses of different Internet medium such as the different uses of blogs versus forums for the benefit of less informed colleagues, is impressive and unique even without considering her demographic. The tenacity and fearlessness with which Julia approaches technology is entirely admirable and never ceases to amaze (and sometimes to shame) me.
At a different end of the women in IT spectrum are Kat and Magz, both of whom are in their twenties and so are my 'juniors'. Working with Kat and Magz helped to push me out of my 'funk'. I'd been indulging, without being fully aware of it, in a rather self-pitying attitude towards working as a technologist after splitting from my first love, history. These two women were full of fire, creativity, enthusiasm and tremendous smarts and helped me wake up to the fact that I was working in an exciting field, full of imaginative, clever and fun people. Kat's amazing adaptability - she was hired as a pure designer but has since developed an impressive set of UI coding skillz to complement her artistry - inspired and impressed the whole development team and taught me to enjoy the challenges of problem-solving, rather than getting so easily down and frustrated. My first memory of Magz was a story of a previous job where she'd worked some impressive Tomcat-clustering magic. I was immensely impressed by this tale and by the confidence, competency and intensity with which she approached every day programming problems. These two women were my first female-developer role models; while I was notoriously 'the first female developer' hired at Xbridge (this is how the CEO once introduced me to a potential hire, much to my horror) and though I worked with an absolutely fantastic group of guys, I was a bit alone in the wilderness until Kat and Magz arrived; they taught me to revel in my work and that, actually, Internet tech is a pretty kick ass place to be!
In some key ways, my own career path reflects my mother's. Linda started her undergraduate degree with the aim of becoming an historian, but as the limited opportunities in this area became more apparent to her, she determined to train as a chemist and worked as a manufacturing chemist in the plating industry. Similarly, I attained a PhD in British History and Economic and Social History and pursued an academic career for some years; at the end of my ESRC Post-Doctoral Fellowship, at which stage I hadn't successfully interviewed for one of the three positions in the nation in my field, I determined that I had to make a change and decided to do a 'conversion course', or a one year Masters in Information Technology. My mother's personal history of moving between a humanities and science discipline has always been part of my understanding of her, and was an important part of my inspiration to 'do what I had to do' in terms of getting the sort of training that would give me access to decent labour opportunities. I should, however, note here that my partner's example - he has a Bachelors in English Language Linguistics and a Masters in Cognitive Science and learned Java 'on the job' during the turn of the century Dot Com Boom - as well as his practical assistance as tutor was further integral to my attaining my MSc in IT with Distinction from Queen Mary, University of London.
Upon completing my MSc, I worked firstly as a Research Assistant in the Computer Science Department of Queen Mary and then as a Java web application developer at Xbridge/Simply Business and then its child company, BView, but it is only over the last year, working for myself building my own application that I've started to feel confident and passionate about working in Internet tech. It had been a difficult transition from a career path I had invested in so heavily and had been deeply passionate for to one I'd entered out of pragmatism.
My flourishing passion and joy for my work has been encouraged in no small way by Julia, Kat and Magz. Jules has a great love of gadgetry and Internet technology and stands out as a 'woman of a certain age' with such an appetite and ability to learn to use the latest tools and gizmos. She's been building web sites since the early days of the web and has recently been recognised as setting a gold standard of best practice for school websites (she works part time at her local primary school). Jules used Google Sites to create a user-friendly and professional site to communicate the school's happenings to the community. Indeed, Jules represents a quirky blend of 'good life hippy' and technologist and her home, nestled in the Scottish Highlands, is aptly called 'the electronic cottage'; much of her work is home-based and includes web administration for an international development organisation and desk top publishing for local authors. Her willingness to investigate new technologies and to understand and advocate the appropriate uses of different Internet medium such as the different uses of blogs versus forums for the benefit of less informed colleagues, is impressive and unique even without considering her demographic. The tenacity and fearlessness with which Julia approaches technology is entirely admirable and never ceases to amaze (and sometimes to shame) me.
At a different end of the women in IT spectrum are Kat and Magz, both of whom are in their twenties and so are my 'juniors'. Working with Kat and Magz helped to push me out of my 'funk'. I'd been indulging, without being fully aware of it, in a rather self-pitying attitude towards working as a technologist after splitting from my first love, history. These two women were full of fire, creativity, enthusiasm and tremendous smarts and helped me wake up to the fact that I was working in an exciting field, full of imaginative, clever and fun people. Kat's amazing adaptability - she was hired as a pure designer but has since developed an impressive set of UI coding skillz to complement her artistry - inspired and impressed the whole development team and taught me to enjoy the challenges of problem-solving, rather than getting so easily down and frustrated. My first memory of Magz was a story of a previous job where she'd worked some impressive Tomcat-clustering magic. I was immensely impressed by this tale and by the confidence, competency and intensity with which she approached every day programming problems. These two women were my first female-developer role models; while I was notoriously 'the first female developer' hired at Xbridge (this is how the CEO once introduced me to a potential hire, much to my horror) and though I worked with an absolutely fantastic group of guys, I was a bit alone in the wilderness until Kat and Magz arrived; they taught me to revel in my work and that, actually, Internet tech is a pretty kick ass place to be!
Monday, 23 March 2009
Pretty URLs in Google App Engine
Today I implemented so-called 'pretty urls' for my Google App Engine application. While my URL structure was reasonably clean before this work, I was inspired to make improvements after attending ThinkVisibility and particularly after talks by Rob Lee and Tom Smith. While it wasn't too painful to track down information on how I might achieve Pretty URLs in GAE, it did take a little trial and error to get running, so I thought it worth a post. Indeed, if readers have suggestions for a more elegant solution, I welcome comments.
What is a Pretty URL? A Pretty URL is a URL designed to be 'hackable', or human-readable. Ideally, users should be able to intuit a Pretty URL address, and likewise a Pretty URL might serve as a 'bread crumb' or 'sign post' indicating to the user where s/he is in the application. Compare, for example, a less than fetching URL (a) with a more pleasing example (b):
a) mysite.com/mycategory?myparam=an_entity_id
b) mysite.com/mycategory/an_entity_id
Example 'b' is just the sort of URL I desired; purdy, ain't she?
I chose to use my WSGIApplication's constructor to point Pretty URLs at appropriate Handlers:
The 'category' is associated with a particular Handler, while the '.*' regex matches the UID of the entity to be retrieved, which is passed on the URL. In the Handler's get function I retrieve the path instance variable include on the Request object, which returns a substring of the URL between the host name and query parameters. I then substring the path string in order to retrieve the key of the entity requested by the user:
This appears to be working well and as expected; I'm certainly blushing every time I lay eyes on one of my app's sweet little URLs.
(Readers may wish to view Google's doc on URL config; note if you try copying and pasting the syntax in their example you'll get exceptions, hence the trial and error aspect of my implementation.)
What is a Pretty URL? A Pretty URL is a URL designed to be 'hackable', or human-readable. Ideally, users should be able to intuit a Pretty URL address, and likewise a Pretty URL might serve as a 'bread crumb' or 'sign post' indicating to the user where s/he is in the application. Compare, for example, a less than fetching URL (a) with a more pleasing example (b):
a) mysite.com/mycategory?myparam=an_entity_id
b) mysite.com/mycategory/an_entity_id
Example 'b' is just the sort of URL I desired; purdy, ain't she?
I chose to use my WSGIApplication's constructor to point Pretty URLs at appropriate Handlers:
application = webapp.WSGIApplication([('/category/.*', CategoryHandler)], debug=True)The 'category' is associated with a particular Handler, while the '.*' regex matches the UID of the entity to be retrieved, which is passed on the URL. In the Handler's get function I retrieve the path instance variable include on the Request object, which returns a substring of the URL between the host name and query parameters. I then substring the path string in order to retrieve the key of the entity requested by the user:
path = str(self.request.path)
key = path[6:len(path)]
if key:
#Retrieve the entity and shoot back a responseThis appears to be working well and as expected; I'm certainly blushing every time I lay eyes on one of my app's sweet little URLs.
(Readers may wish to view Google's doc on URL config; note if you try copying and pasting the syntax in their example you'll get exceptions, hence the trial and error aspect of my implementation.)
Friday, 20 March 2009
Dynamically load YUI dependencies
I've been using YUI Grids and LayoutManager for the backbone of my app's interface since the end of last year. It's been a steep learning curve and I still consider myself very much novice and, indeed, only noticed this week the 'dynamic loading' tab on the YUI Configurator. Rather than statically including the required YUI CSS and JavaScript resources, it is possible to use YUILoader to dynamically import them on load. While I appreciate that YUI-experts will not be impressed by my YUILoader-epiphany, this approach has helped me to slim down my app's JS files while decreasing maintenance concerns and so I feel is worth mentioning for the benefit of other noobs.
As described on the Configurator page, it is possible to define the required resources in YUILoader's constructor and to tweak YUILoader's behaviour to suit your application. I found two constructor arguments particularly useful, 'base' and 'onSuccess':
YUILoader API documentation claims that the String value of base is the directory used by YUILoader when loading dependencies. However, I have noticed that no matter what directory location I pass as base, YUILoader fetches resources using the directory used to import YUILoader. That is, if I've imported src="http://yui.yahooapis.com/2.7.0/build/yuiloader/yuiloader-min.js" and set base to "http://yui.yahooapis.com/2.6.0/build/", YUILoader sucks down 2.7.0 versions of my required resources, whereas if I change the directory of the YUILoader import to 2.6.0 I get resources corresponding to this version. Perhaps I am missing something in how this all works, but I would expect to be able to override the YUILoader's build version by passing a value to base. On the upside, it is possible to control the resources gathered by YUILoader so, once you've gone to production, your app doesn't spontaneously upgrade with potentially dire consequences.
In contrast, I've found the onSuccess argument reliable for running the JavaScript used to render my app's display, i.e. to instantiate and run a LayoutManager. Previously I had included a script on every page to run LayoutManager, and have now been able to reduce the page-weight of my app by one file (before I've even started really polishing my frontend optimisation).
Finally, I've used YUILoader's insert() function to demand that only the JS, and not the CSS, dependencies are fetched:
I've overridden some of YUI's skin-sam CSS in my own CSS file which is imported after my third party resources. However, because the YUILoader inserts dependencies at the end of the page, my customisation of YUI's CSS was negated by a second and freshly imported batch of CSS dependencies. So, I've told YUILoader to just bring me the JS and I'll have to update the CSS version manually (unless of course some wise reader can suggest a more optimal solution).
Happy ui-coding.
As described on the Configurator page, it is possible to define the required resources in YUILoader's constructor and to tweak YUILoader's behaviour to suit your application. I found two constructor arguments particularly useful, 'base' and 'onSuccess':
var loader = new YAHOO.util.YUILoader({
base: "//YUI build dir",
require: ["dom","element","event","fonts","grids","layout","reset","selector"],
loadOptional: false,
combine: true,
filter: "MIN",
allowRollup: true,
onSuccess: function() {
//Stuff that needs doing on load, e.g. running LayoutManager
}
});
YUILoader API documentation claims that the String value of base is the directory used by YUILoader when loading dependencies. However, I have noticed that no matter what directory location I pass as base, YUILoader fetches resources using the directory used to import YUILoader. That is, if I've imported src="http://yui.yahooapis.com/2.7.0/build/yuiloader/yuiloader-min.js" and set base to "http://yui.yahooapis.com/2.6.0/build/", YUILoader sucks down 2.7.0 versions of my required resources, whereas if I change the directory of the YUILoader import to 2.6.0 I get resources corresponding to this version. Perhaps I am missing something in how this all works, but I would expect to be able to override the YUILoader's build version by passing a value to base. On the upside, it is possible to control the resources gathered by YUILoader so, once you've gone to production, your app doesn't spontaneously upgrade with potentially dire consequences.
In contrast, I've found the onSuccess argument reliable for running the JavaScript used to render my app's display, i.e. to instantiate and run a LayoutManager. Previously I had included a script on every page to run LayoutManager, and have now been able to reduce the page-weight of my app by one file (before I've even started really polishing my frontend optimisation).
Finally, I've used YUILoader's insert() function to demand that only the JS, and not the CSS, dependencies are fetched:
var options = [];
loader.insert(options, "js");I've overridden some of YUI's skin-sam CSS in my own CSS file which is imported after my third party resources. However, because the YUILoader inserts dependencies at the end of the page, my customisation of YUI's CSS was negated by a second and freshly imported batch of CSS dependencies. So, I've told YUILoader to just bring me the JS and I'll have to update the CSS version manually (unless of course some wise reader can suggest a more optimal solution).
Happy ui-coding.
Thursday, 12 February 2009
Dav Glass to the rescue or the curious case of the hidden border-right
The YUI Grids and LayoutManager issue described in a previous post has been fully resolved with the kind assistance of Dav Glass, LayoutManager developer and Twitter buddy. Thanks brother!
As suspected, the issue was rooted in my noob-i-licious implementation rather than in the YUI tools themselves. Early-stage work-arounds came back to haunt me, and Dav kindly made the necessary adjustments to my code. There were two main flaws with my implementation: 1) manually added wrapper divs and classes (these are applied automagically onload); 2) missing override to YUI class. So, the mark-up ends up as:
How tidy, clean and sexy is that?! Marvellous. Now, just to add a bit of CSS to customise the YUI resources to my app's look and feel:
Score! Is great to get the code tighter and, of course, behaving as expected. Feeling evermore pumped for London Twestival this evening, as once again, in spite of what the nay-sayers and sceptics may say about social networking on the inter-web, the gloriousness of the enlightened telecomms age we live in has saved my proverbial bacon.
As suspected, the issue was rooted in my noob-i-licious implementation rather than in the YUI tools themselves. Early-stage work-arounds came back to haunt me, and Dav kindly made the necessary adjustments to my code. There were two main flaws with my implementation: 1) manually added wrapper divs and classes (these are applied automagically onload); 2) missing override to YUI class. So, the mark-up ends up as:
div id="custom-doc" class="yui-layout"
div id="hd" class="myHd"
div id="bd"
div id="yui-main"
div class="yui-b"
div class="yui-gc"
div class="yui-u first"Lorem ipsum dolor lacus feugiat.
div class="yui-u"Lorem ipsum dolor sit amet, acus feugiat.
div id="ft"How tidy, clean and sexy is that?! Marvellous. Now, just to add a bit of CSS to customise the YUI resources to my app's look and feel:
.yui-layout-unit-center .yui-layout-wrap {background-color: #ffffff; border: 3px solid yellow;}Score! Is great to get the code tighter and, of course, behaving as expected. Feeling evermore pumped for London Twestival this evening, as once again, in spite of what the nay-sayers and sceptics may say about social networking on the inter-web, the gloriousness of the enlightened telecomms age we live in has saved my proverbial bacon.
Wednesday, 11 February 2009
YUI Grids and LayoutManager: border-right of .yui-layout-unit-center doesn't render
In the process of developing my app I realised that my layout needed a slight overhaul. My goal is to increase the width of my main content area and to dispense with the right-hand nav bar in favour of tabs above the main content area (to be implemented using jQuery UI). I've created a template UI using YUI Grids with LayoutManager and I'd like to define a custom width for my content pane and give the main content area a white background and yellow border. I believe that I've faithfully followed the directions given with the YUI Grids + LayoutManager example, but I am unable to get the border-right to render in either FF3 or IE7. I've stripped the page right back to first principles, hoping to resolve the error with a simplified page, but have only succeeded in reproducing the error. Here she is:
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"
html
head
title YUI Base Page /title
link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.6.0/build/reset-fonts-grids/reset-fonts-grids.css
&2.6.0/build/layout/assets/skins/sam/layout.css"
style type="text/css"
body {margin: 0; padding: 0; font-family: Arial, sans-serif; font-size: small; color: #33333; background-color: #6699cc;}
#custom-doc {margin: auto; text-align: left; width: 88.46em;}
#hd, .yui-layout-unit-top {background-color: #6699cc;}
.myHd {background-color: #6699cc; margin-left: 1.92em;}
#bd, .yui-layout-unit-center {background-color: #ffffff;}
.yui-layout-unit-center {border: 3px solid yellow;}
/style
/head
body
div id="custom-doc" class="yui-layout"
div class="yui-layout-doc"
div class="yui-layout-unit yui-layout-unit-top yui-layout-noscroll"
div class="yui-layout-wrap"
div class="yui-layout-bd yui-layout-bd-nohd yui-layout-bd-noft"
div id="hd" class="myHd" /div
/div
/div
/div
//This the main content area
div class="yui-layout-unit yui-layout-unit-center"
div class="yui-layout-wrap"
div class="yui-layout-bd yui-layout-bd-nohd yui-layout-bd-noft"
div id="bd"
div id="yui-main"
div class="yui-b"
div class="yui-gc"
div class="yui-u first" Lorem ipsum dolor lacus feugiat./div
div class="yui-u" Lorem ipsum dolor sit amet, acus feugiat./div
/div
/div
/div
/div
/div
/div
/div
div class="yui-layout-unit yui-layout-unit-bottom yui-layout-noscroll"
div class="yui-layout-wrap"
div class="yui-layout-bd yui-layout-bd-nohd yui-layout-bd-noft"
div id="ft" /div
/div
/div
/div
/div
/div
type="text/javascript" src="http://yui.yahooapis.com/combo?2.6.0/build/yahoo-dom-event/yahoo-dom-event.js
&2.6.0/build/element/element-beta-min.js
&2.6.0/build/selector/selector-beta-min.js
&2.6.0/build/layout/layout-min.js"
(function(){
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event;
Event.onDOMReady(function() {
var layout = new YAHOO.widget.Layout('custom-doc', {
height: Dom.getClientHeight(), //Height of the viewport
width: Dom.get('custom-doc').offsetWidth, //Width of the outer element
minHeight: 150, //So it doesn't get too small
units: [
{ position: 'top', height: 70, body: 'hd' },
{ position: 'bottom', height: 25, body: 'ft' },
{ position: 'center', body: 'bd', grids: true }
]
});
layout.on('beforeResize', function() {
Dom.setStyle('custom-doc', 'height', Dom.getClientHeight() + 'px');
});
layout.render();
//Handle the resizing of the window
Event.on(window, 'resize', layout.resize, layout, true);
});
})();
/body
/html
I suppose I am missing some very fundamental point, but I've nearly exhausted the tricks up my sleeve to get this baby rendering as I'd expect and would be grateful for any insight from more expert UI developers. If and when, dear reader, I crack this nut I'll be sure to post my solution.
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"
html
head
title YUI Base Page /title
link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.6.0/build/reset-fonts-grids/reset-fonts-grids.css
&2.6.0/build/layout/assets/skins/sam/layout.css"
style type="text/css"
body {margin: 0; padding: 0; font-family: Arial, sans-serif; font-size: small; color: #33333; background-color: #6699cc;}
#custom-doc {margin: auto; text-align: left; width: 88.46em;}
#hd, .yui-layout-unit-top {background-color: #6699cc;}
.myHd {background-color: #6699cc; margin-left: 1.92em;}
#bd, .yui-layout-unit-center {background-color: #ffffff;}
.yui-layout-unit-center {border: 3px solid yellow;}
/style
/head
body
div id="custom-doc" class="yui-layout"
div class="yui-layout-doc"
div class="yui-layout-unit yui-layout-unit-top yui-layout-noscroll"
div class="yui-layout-wrap"
div class="yui-layout-bd yui-layout-bd-nohd yui-layout-bd-noft"
div id="hd" class="myHd" /div
/div
/div
/div
//This the main content area
div class="yui-layout-unit yui-layout-unit-center"
div class="yui-layout-wrap"
div class="yui-layout-bd yui-layout-bd-nohd yui-layout-bd-noft"
div id="bd"
div id="yui-main"
div class="yui-b"
div class="yui-gc"
div class="yui-u first" Lorem ipsum dolor lacus feugiat./div
div class="yui-u" Lorem ipsum dolor sit amet, acus feugiat./div
/div
/div
/div
/div
/div
/div
/div
div class="yui-layout-unit yui-layout-unit-bottom yui-layout-noscroll"
div class="yui-layout-wrap"
div class="yui-layout-bd yui-layout-bd-nohd yui-layout-bd-noft"
div id="ft" /div
/div
/div
/div
/div
/div
type="text/javascript" src="http://yui.yahooapis.com/combo?2.6.0/build/yahoo-dom-event/yahoo-dom-event.js
&2.6.0/build/element/element-beta-min.js
&2.6.0/build/selector/selector-beta-min.js
&2.6.0/build/layout/layout-min.js"
(function(){
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event;
Event.onDOMReady(function() {
var layout = new YAHOO.widget.Layout('custom-doc', {
height: Dom.getClientHeight(), //Height of the viewport
width: Dom.get('custom-doc').offsetWidth, //Width of the outer element
minHeight: 150, //So it doesn't get too small
units: [
{ position: 'top', height: 70, body: 'hd' },
{ position: 'bottom', height: 25, body: 'ft' },
{ position: 'center', body: 'bd', grids: true }
]
});
layout.on('beforeResize', function() {
Dom.setStyle('custom-doc', 'height', Dom.getClientHeight() + 'px');
});
layout.render();
//Handle the resizing of the window
Event.on(window, 'resize', layout.resize, layout, true);
});
})();
/body
/html
I suppose I am missing some very fundamental point, but I've nearly exhausted the tricks up my sleeve to get this baby rendering as I'd expect and would be grateful for any insight from more expert UI developers. If and when, dear reader, I crack this nut I'll be sure to post my solution.
Subscribe to:
Posts (Atom)