My grandmother, Jeanie Crisp passed away at 7am on Wed, 15 July 2009 after 30 days in hospital. I miss her very much.
Her funeral service will be held on Monday (20 July) at the Macquarie Park Crematorium, Camellia Chapel at 2:30pm.
Soosun and I had a lovely week in New Zealand, and great weather. We visited the North Island, landing in Auckland. We drove straight to Rotorua, arriving in time for dinner. The next day, we visited White Island, the most volcanic area in the Southern Hemisphere. Pretty amazing, had to wear gas masks. Steam, acid, sulphur and bubbling pools everywhere!
Then on to the Tongariro Crossing, probably the best bushwalk I have ever done – 19kms of amazing scenery, steep climbs, volcanic craters, lakes and the “Mount Doom” volcano from the Lord of the Rings. Although it took all day, it was not a walk that ever left you bored – so much variety, ending finally with rainforest.
We went adventure caving in Waitomo (the Black Abyss), which started with tight abseil down a chimney, swimming and sloshing through wet caves in a wetsuit and floating on tires, some tight squeezes and we finally got back to the surface climbing up another chimney. Great fun!
More New Zealand photos here.
Step in and strike at the first sign of movement of your combatant. Do not wait for their strike. Do no over-extend your body. Especially if they are bigger than you, ensure you are close enough to be in your optimal range. Maintain structure. Strike and continue to control, keep them off balance and cramped as you follow up. Your attack is your best defense and gives you the advantage.
When rolling, imagine your arms are around a witches hat – wide bit at your body, small end is your hands. Imagine your arm and hands are drilling into your partner’s chest. Also, when you come down from bong sau to pierce, this should be going forwards too. It is a strike and your partner will need to be defending against it with the arm doing the fook sau.
The “party” counter arm grab using elbow over (left hand grabbed by right, or right hand grabbed by left) ends with drawing the opponent’s hand towards your body. Imagine bringing your elbow to your ribs (this avoids bending or leaving stance).
The “party” counter arm grab using wrist and fingers pointing down (left hand grabbed by left or right hand grabbed by right) starts by moving around the force the opponent is placing on you (circular move, often around and up) and ends pointing your wrist and fingers towards the ground (where you want your opponent to be forced to go).
So yes, everyone has heard that Mac OS X and TextMate is the epitome of Rails development, and that it is so awesome that it brings tears of joy to developers eyes, &c. However, for those of us who either don’t have a Mac, or get to work on client provided hardware (often running Windows), there are a few options available.
Developing on Windows XP, with InstantRails is workable. It is easy to get everything you need and have your apps up and running quickly. However, performance is, well, quite frankly, terrible for anything you do on the command line. Mainly, this bites when running tests, doing migrations, generating files etc. Performance running Mongrel is good enough for development.
What about Cygwin? Subjectively, I found it provided similar speed to Windows Ruby/Rails.
So this brings us to virtualisation. Recently, I’ve been testing out VirtualBox running Ubuntu on top of Windows XP. This has had surprisingly good results. On the same machine, the virtual Ubuntu running Rails tasks has about 4 times (!!!) faster performance, even though it has less memory and system resources!
Here are some stats to give you and idea of the advantage.
Machine is a 2.4ghz quad core, 4gig of memory running Windows XP. Using VirtualBox 2.1.4 for virtualized Ubuntu Intrepid 64 bit, with 1.5gig of memory allocated. Figures are in seconds and approximate (taken with a wrist watch).
| generate scaffold | db:migrate with no changes | run tests for medium sized rails app | |
|---|---|---|---|
| Windows XP & Instant Rails | 7 | 7 | 25 |
| VirtualBox Ubuntu on same Windows XP | 1.5 | 1.5 | 6 |
Some of these commands / tests rely on hitting a MySQL database. However, I’m interested in overall development speed for both platforms, not in Ruby speed in particular, so I think it is fair game to include these in the results.
So if you want to do Rails Dev on Windows, I highly recommend trying a virtual machine running Linux!
In a fit of TextMate jealousy, several months ago, I scoured the web for a way to get find-file functionality info my favourite Ruby/Rails editor, vim. I was very happy to find that Jamis Buck had developed an aweseome plugin do to this. It is a little fiddly to install, but worth the trouble. Here’s some simplified steps to get you going.
sudo gem install jamis-fuzzy_file_finder --source=http://gems.github.com
Then, if you want to have a similar sort of light-weight Rails ‘IDE’ I enjoy coding with, see my config files below:
.vimrc
source $VIMRUNTIME/vimrc_example.vim behave xterm set nu set tabstop=2 set shiftwidth=2 set softtabstop=2 set ai set expandtab set smarttab let g:rubycomplete_rails = 1 map f :FuzzyFinderTextMate<CR> map n :tabnew<CR> map c :tabclose<CR> map m :tabnext<CR> let g:fuzzy_ignore = "*.svn" let g:fuzzy_ignore = "*.swp" let g:fuzzy_ignore = "*.jpg" let g:fuzzy_ignore = "*.gif" let g:fuzzy_ignore = "*~" set nobackup
.gvimrc
source ~/.vimrc set selectmode=mouse set columns=100 set lines=50
In this set up, there are no chords etc. Instead, when not in edit mode, ‘n’ will open a new tab. ‘f’ will let you find a new file to open in the current tab. ‘c’ will close the current tab and ‘m’ will move between tabs. So in a normal workflow, you might decide to swap the file in the current tab for a new one (simply press ‘f’), or if you need another file open, hit ‘n’ for new tab, and then ‘f’ to load the relevant file. My text description doesn’t do it justice, but I find this works very well to get you to the file you want quickly, and let you have the files you’re interested in open all at the same time.
One last note, remember to start vim/gVim in the root of your rails directory.
Happy Vimming 🙂
UPDATE
These files are now available from my github dotfiles repository, including the gem inside of the vim/gems_required directory.
Thanks very much to Nigel for inviting me to present on REST at St George Bank in Kogarah, and to ThoughtWorks for the time in the middle of the day to give the talk. It was a fun session and the people attending asked quite a number of good questions. Here are the slides. Please note that they are about 10mb (thanks to all the images). There’s some extra information in the “Notes” pane as well.
While in the Cook Islands, we went to the National Museum and it was there that I first heard about Tom Neale and saw reference to him on a census of island populations from the 1950s (“Suvarov: population 1” with a footnote saying “Tom Neale”!). He was the only inhabitant of Suvarov, an atoll in the Cook Islands, having done what many people only dream of. He left civilisation and moved to a beautiful, deserted island in the Pacific, replete with coconut trees, jungle, and an azure lagoon. Not only that, but he survived and prospered there and wrote an amazing autobiography of the time, called “An Island to Oneself”.
I tried to borrow “An Island to Oneself” from the National Library on Rarotonga (there is only one library on Rarotonga!) but unfortunately all copies were out. So, I turned to Amazon (the long tail poster child), and was very happy to find they could source me a copy. I don’t want to spoil the tale, but recommend you have a read if you have ever thought about what life would be like on a desert island, surviving only by your own wit and skills, hundreds of miles from civilisation!
UPDATE (6 Jul 2016): Thanks to Don Hirst for this link to the full book online.
Packt Publishing kindly sent me a copy of RESTful PHP Web Services by Samisa Abeysinghe to review. The book’s cover claims that it will help you “Learn the basic architectural concepts and steps through examples of consuming and creating RESTful web services in PHP”. The book succeeds in providing simple steps and examples of creating and consuming web services, but falls short on REST architectural concepts and design principles.
The book starts with a very brief introduction to the principles of REST, and rapidly moves on to a discussion of PHP tools frameworks. The introduction misses some important REST / RESTful web service concepts such as hypermedia, application vs resource state and the relevance of utilising HTTP headers and status codes. Some of the information in the introduction is confusing. For example, on page 12, it says “Resources can have multiple representations that reflect different application states”. This does sound a little odd – resources can have multiple representations, for example, for different requested content types. Representations should reflect resource state, not application state. Also, the coverage of HTTP verbs is misleading, especially when POST and PUT are discussed.
The next couple of chapters discuss PHP support for HTTP, using libraries such as CURL, and XML parsing strategies. The author chooses realistic examples for code samples, such as Flickr and Yahoo Maps clients. The last example given is quite cool – using earthquake latitudes and longitudes from an Australian government site to plot points on Yahoo maps. The example code is generally simple and easy to follow. However, it would have been nice to see some sort of separation between view and data access logic.
The following chapter is a worked example of building RESTful services for a library lending books. It is a good example, and becomes the basis for most future chapters. The resource design and URLs are reasonable, although it may have been nice to have “loans” as resources in their own right. Using links between resources, rather than just relying on known URLs would also benefit the design.
Later chapters cover alternative frameworks such as Zend and WSO2 using the library lending system as an example for code samples. These chapters are useful as they give an idea how the frameworks look when put in practice. It does look as though PHP and frameworks still have significant limitations around routing flexibility from the examples (eg, the .php extension seems to mandatory in URLs). There is also a chapter on debugging with tips around tools and troubleshooting XML parsing issues.
The writing style is generally clear and easy to read. There are occasionally some odd turns of phrase, such as on page 10: “AJAX makes Web applications to become more interactive, faster, and more user-friendly”.
Overall, I would recommend this book to people wanting to write simple URI template based web services or clients in PHP, and also to people interested in getting an overview of libraries and frameworks currently available in the PHP ecosystem. To gain an understanding of the REST architectural constraints and designing good RESTful systems, I would recommend RESTful Web Services, and if you wanted to take it further, digging into Roy Fielding’s thesis and the HTTP 1.1 Spec.
Stance
Moving
Speed
When punching or kicking, you arms and legs should be completely relaxed, although tie gung should be on. If completely relaxed can move faster. Imagine swatting a fly.
When moving in, trust your wing chun. Moving in should be almost like getting pushed from your waist from behind. Legs relaxed, high acceleration, full weight moving forward, taking the space they currently occupy.
Pivoting
Pivot so that both feet finish moving at the same time. Move from the waist.
Guard
Guard should be with arms relaxed and fingers pointing forward towards your opponent’s centre line where the neck meets the trunk, to give even time for high and low attacks.
Defending against head punches
Think primarily of hitting the opponent with your punch/strike, as this will cripple the attack. The dai sau is secondary. Dia sau should keep sheering upwards on contact. It should be a rotation in the shoulder joint, your angles should not collapse. Your shoulder should always be down and the ball of the joint rotating at the back of the joint. Dia sau should be inscribing an even circle of your space. Contact should be shearing with the hard side bones of your arm against the inside of their wrist. Wrist should always stay on centre. Your fingers may be pointing towards the opponent’s head near the end of the move, or your hand may be above your head, depending on strength and hookedness of the attack.
Hook Kick
You really need to swing your hip into a good hook kick. Your leg should go up quite high as it swings around and then drive down into your opponent’s thigh / leg. In close, you may contact with your knee, with more distance, you should be contacting with the front of your lower leg (above ankle, but below knee).
“JavaScript: The Good Parts” was kindly lent to me by my friend and colleague Dave Cameron. It was a highly informative read, and a good length at just under 150 pages. The aim of the book is to define an elegant, recommended subset of JavaScript that allows you to do everything you need, and work around problems in the language. The book is aimed at people who already have a good grasp of programming in other languages.
I learnt quite a bit from the book. Here are a few of the most important parts that come to mind:
Creating objects with private data:
var incrementer = function() {
var value = 0;
return {
increment: function (inc) {
value += typeof inc === 'number' ? inc : 1;
},
getValue: function() {
return value;
}
};
};
var myIncrementer = incrementer();
Functional inheritance
var mammal = function(spec) {
var that = {};
that.getName = function() {
return spec.name;
};
return that;
};
var myMammal = mammal({name: 'Fred'});
myMammal.getName() === 'Fred'
var cat = function(spec) {
var that = mammal(spec);
var super_getName = that.superior('getName');
that.purr = function { /* new catty stuff */ };
that.getName = function {
return super_getName() + ' the Cat!';
};
return that;
};
var myCat = cat({name: 'Kitty'});
myCat.getName() === 'Kitty the Cat!'
// Helpers
Object.method('superior', function(name) {
var that = this, method = that[name];
return function() { return method.apply(that, arguments); };
});
Function.prototype.method = function(name, func) {
this.prototype[name] = func;
return this;
};
There were a few things that I thought could be improved in the book. First of all, although the structure was adequate, it did lend itself to repetition. For example, scope is covered on p36 (in Functions section) and p102 (Awful parts), with very similar words. Secondly, I did not find the frequent syntax diagrams added much to the narrative.
Despite these small blemishes, I’m glad to have read Crockford’s book. I now understand much better which parts of JavaScript to use, and how to build good object oriented code in JavaScript.
Powered by WordPress & Theme by Anders Norén