Madrid
A few weeks ago, I went to Madrid. It was very nice! On the first day, I walked around and explored. The next day, I took a tour and went to a big park. I saw lots of big cones filled with meat (like in the picture). I would’ve gotten a Real Madrid shirt, but nobody could tell what team it was, because the shirt only said Fly Emirates. The next day, I went to the palace and took the plane back home.
JSON and Ajax
Today’s post is on JSON and Ajax. Ajax stands for Asychronous Javascript and XML. It is used for fetching data from a server. When a webpage makes a request to a server, the server responds with some HTML and maybe some Javascript. An Ajax request takes additional information for the server, but not a new webpage. A website that uses jQuery but not Ajax may take longer to load. If a button is on website that uses Ajax, then when that button is clicked, it will fetch additional information. Some code that uses Ajax might look like this:$.ajax(“additional information”,function(){*all of the callbacks, such as success,failure,complete,etc.*}); JSON stands for JavaScript Object Notation. An Ajax request in JSON may look like this: {body:”Text”}. Next post is on Node.js.
The Every Tube Station Song
The Every Tube Station Song is a song to help you memorize all 270 Tube Stations on the London Underground (excluding the DLR and Overground stations).
The lyrics are this:
EVERY TUBE STATION
by Jay Foreman and Jon Gracey (it took us AGES!)
(spoken)
Hornchuch, Ickenham, Hainult, Cockfosters, Ravenscourt Park, Bromley-By-Bow
Morden, Monument, Mornington Crescent, Paddington, Plaistow, Pimlico.
Dagenham Heathway, Elephant & Castle, Richmond, Sloane Square, Becontree,
Brixton, Barbican, Chorleywood, Amersham, Eastcote, Alperton, East Finchley.
Kenton, Kennington, Fairlop, Farringdon, Mile End, Barons Court, Maida Vale,
Barking, Barkingside, Debden, Hammersmith, Vauxhall, Wembley Park, Tottenham Hale.
Northwood, Oakwood, Wood Green, Woodford, Colliers Wood and then Croxley,
Charing CROSS, King’s Cross St. Pancras, Brent Cross, Hatton Cross, Osterley.
Balham, Borough, Chesham, Hampstead, Loughton, Leyton, Leytonstone,
Stanmore, Snaresbrook, Greenford, Northolt, Northfields, Southfields, Marylebone.
Kingsbury, Queensbury, Queensway, Queen’s Park, Park Royal, Royal Oak, Burnt Oak then,
Aldgate, Southgate, Highgate, Moorgate, Notting Hill Gate, St. Paul’s, Neasden.
Oxford Circus, Piccadilly Circus, Lambeth North and Northwick Park,
Upton Park and Westbourne Park and Wimbledon Park and Stonebridge Park,
Warwick Avenue, Waterloo, Watford, Walthamstow Central with Wanstead,
Hounslow West and Hounslow East and East Ham, West Ham, West Hampstead.
Putney Bridge, Knightsbridge, Redbridge, London Bridge, Uxbridge, Perivale, Leicester Square,
Goodge Street, Baker Street, Bond Street, Warren Street, Old Street, Liverpool Street, Edgware.
(up a key)
West Acton, West Harrow, West Finchley, Kew Gardens and Lancaster Gate and Gunnersbury,
Westminster, Upminster, Russell Square, Euston Square, Totteridge & Whetstone, East Putney.
Ealing Broadway, Fulham Broadway, Tooting Broadway, Arsenal,
Stockwell, Chigwell, Seven Sisters, Blackhorse Road, Blackfriars, Temple,
East Acton, Oval, Bow Road, Colindale, Archway, Angel, Upminster Bridge,
Clapham Common, Clapham North and Clapham South and Swiss Cottage.
Acton Town and Camden Town and Chalk Farm and West Kensington,
Canning Town and Kentish Town and Sudbury Town and West Brompton.
Theydon Bois and Tooting Bec and Stamford Brook, South Kensington,
Rickmansworth and Mansion House and Marble Arch, South Wimbledon.
Dollis Hill, Gants Hill, Grange Hill, Sudbury Hill, Tower Hill, Hillingdon, Aldgate East,
Southwark, High Barnet, Earls Court, Bayswater, Pinner, Victoria, Mill Hill East.
High Street Kensington, Kensington Olympia, Ealing Common, Bermondsey,
Heathrow Terminals 4 and 5 and Heathrow Terminals 1, 2, 3.
Epping, Euston, Kilburn, Kilburn Park, Chalfont & Latimer,
Cannon Street and Canons Park, Embankment, Canada Water.
South Ealing, South Harrow, South Kenton, South Woodford, Canary Wharf, Harrow and Wealdstone,
North Acton, North Ealing, North Greenwich, North Harrow, North Wembley and Highbury & Islington.
Caledonian Road and Edgware Road and Finchley Road and Gloucester Road,
and Goldhawk Road and Holloway Road and Latimer Road and Preston Road.
Elm Park, Regent’s Park, Green Park, Holland Park, Hyde Park Corner, and Upney,
Moor Park, Tufnell Park, Chiswick Park, Newbury Park, Finsbury Park, Roding Valley.
Hendon Central, Hounslow Central, Wembley Central, Belsize Park,
Finchley Central, Covent Garden, Tottenham Court Road, Woodside Park.
Wood Lane, Hanger Lane, Chancery Lane, Rayners Lane, Turnpike Lane, Turnham Green, Buckhurst Hill,
Golders Green, Kensal Green, Parsons Green, Stepney Green, Willesden Green, Bethnal Green, Harrow-On-The-Hill
Arnos Grove, Ladbroke Grove, Boston Manor, Manor House, St. James’s Park and St. John’s Wood,
Shepherd’s Bush Market, Shepherd’s Bush, Harlesden, Holborn, Northwood Hills, Stratford.
Ruislip, Ruislip Gardens, South RuiSLIP, West Ruislip, Ruislip MAnor, Great Portland Street, Dagenham East, Bounds Green…
Bank.
(All credit to Jay Foreman for the song lyrics)
I memorized the whole thing and can play it on the piano!
Angular.js
Angular.js is a Javascript library that connects HTML and JavaScript, like jQuery. Angular has these neat things called expressions. Let’s say this was my JavaScript: var test = “test”; To print that out on the page, you use an expression in your index.html that looks like this: {{test}} When your page loads, it would display the contents of the test variable. There is something called two-way data binding. When a variable inside an expression changes, so doeswhat the expression prints to the screen. Angular is a very nice library. Next post in Code Week is Twitter Bootstrap.
jQuery
jQuery is a JavaScript library that allows interaction with the HTML and CSS. Every good site uses jQuery, espcially ones that use buttons and animation. Let’s say when you click this , some content would slide out. The jQuery code would look like this:$(document).ready(function(){
$('button').on('click',function(){
$(this).append('Some Text');
});
});
What happens is this: When the HTML code is ready, watch for the event of clicking the button. When that event happens, add some text. It is a lot quicker than using Angular or something else.