Monday, September 16, 2013

Get a list of your functions in mysql

If you want a list of functions (as opposed to procedures) use this:

select * from information_schema.routines where routine_schema = 'your_schema_name' and routine_type != 'PROCEDURE'

Friday, August 9, 2013

Douglas Crockford Video 5 - 'The end of all things'

No let up in quality in this video. Here are my notes for the final video in the original series:

Cross site scripting (XSS) is a big problem. Huge privs accorded to a successful attacker.
Caja and adsafe - make js safer.

Don't confuse a variable and a value.

How does an object get a reference:
By Creation
By Construction
By Reference

David Parnas:

Lazy programmers guide

Keep performance delays below 100ms - provide some sort of immediate feedback.
Don’t fiddle with code. Measure first. Use PageSpeed

Arrays can be slow in older versions of ie. No hashmaps.
Don’t add unnecessary chrome. Takes time.

Don’t tune for quirks. Keep code clean and readable. Future versions of JS engines will be much faster. Your quirk optimisations may cause trouble.

Avoid global variables.

Avoid ++ - too easy to mess up
Use jslint

Wednesday, August 7, 2013

Douglas Crockford's JavaScript Video 4 - AJAX

These videos are remarkable in the packed world of IT training videos in that they are clear and enjoyable to watch. The fourth instalment is about Ajax, but goes into plenty of detail that I didn't know about where the DOM came from and some info about the famous browser wars. Here are my notes so that you can see what is in there before you invest 90 minutes.

Markup languages

GML - generalized markup language
HTML - simplified SGML

Angle brackets came from Scribe.


Does not fail on errors - allowed innovation. Otherwise the web would have frozen.
2 types of outlines - H1 - not nested and p type which are. Yuk.


Not modular - clashes can wreck your page.
difficult to manage selectors - classitis and iditis.
None of the browser vendors ever got it implemented!


Brendan Eich - Netscape

Browser workflow

url -> Fetch -> cache  -> Parse -> Tree ->  Flow -> display list ->  Paint -> pixels

Comments around script tags just protects users of ancient browsers from seeing the script. Don't bother with this.


Very bad. Don't do it.

For performance improvement of scripts

  • minify
  • gzip
  • Reduce number of script files (concat at deploy)
  • Use something like Chrome PageSpeed to test

Javascript uses camel case for style properties. CSS uses hyphens - incompatible with JS - in fact incompatible with most languages. Done on purpose. Source of annoying bugs.


Nice and fast, but dangerous. Developed by ms - all browsers support it.

Always err on the side of understanding and clean code over performance unless performance is a serious problem.


Bubble up through the DOM - use stopPropagation to deal with this.
Allows attaching of a single event handler to a container. The container then dispatches the event to the appropriate element. Faster to set up.

Use good speed testing tools - Chrome best.

Server vs browser

Neither side should dominate. A balance is the best. The server is not a filesystem and the browser is not a dope that just displays returned content.

Thursday, August 1, 2013

Douglas Crockford's JavaScript Videos from his time at Yahoo

He has now moved on to other things, but these videos are still around. They are like reading a novel - long form is still best. No sound bites here. Each video is over an hour long and there are 8 of them. I am only on the third at the moment, but am getting a huge amount out of them. If you are like most js developers and me you will be bludgeoning your way through whatever tasks you need to complete without knowing the details. JQuery et al insulate us from having to know this stuff right? Afraid not. There is no substitute for knowing the javascript in detail. These videos manage to do that.

Tuesday, July 30, 2013

Useful CSS Wisdom

I came across this in the most recent Web Design Weekly. I have called it wisdom as it is full of the type of advice that people only have the balls to give you when they really know what they are talking about. Why IDs in CSS should be avoided is detailed. A lot of people rant about this, but there is something about this document that got me sifting through my CSS to find all the # marks.
The document is short and I am going to look back at it a few times over the coming months to make sure I have squeezed the benefit out of it.

Monday, July 29, 2013

Web Design Weekly

Web Design Weekly is a great resource for front end developers and wannabes. Once you subscribe it arrives in your inbox once a week with a selection of articles, news, tools etc. that you can use in your work. It is just like subscribing to RSS but I find that getting news on a specific area like this once a week means that I set aside some time to at least browse it and find out what is interesting. The material is often of a high quality and where I don't manage to get stuff working it's probably down to me not persisting with it long enough.
If this is the type of work that you do I recommend signing up for this. The link is at the start of this post.

Friday, July 26, 2013

Mozilla Developer Network JavaScript Resources

When I am looking for anything to do with js, html or css on the web I tend to put the letters mdn into the search line along with whatever else I am looking for. This usually pushes me to the pages on the Mozilla Developer Network. They are consistently of high quality - unlike for example W3Schools and are clearly written by the type of people who possess the knowledge that I want.
Mostly it is just a dip in to find our a syntax here and there, but they do offer comprehensive book style start to finish information. The JavaScript Guide for example is here.
I have been programming in JavaScript for quite a while now, so I am not reading this line for line, but a scan through it is clearing up some long held confusions for me.
I reckon getting proper skills into your head and hands is a slow process and the way there is to persist and add new pieces every day. Going through the MDN docs is an example of this.