Thursday, December 28, 2006

Windows Crash: multiple_irp_complete_requests Stop: 0x00000044

Thought I'd do a bit of a defrag on my old Windows 2000 box. A few minutes in, I got a blue screen:

multiple_irp_complete_requests
stop: 0x00000044 (0x852CCE68, 0x00000D39, 0x00000000, 0x00000000)

Tried a chkdsk but got the same error, even when running it on boot in console mode.

After some web trawling, found this google answer, which suggested that the problem was caused by 'Intel Application Accelerator' conflicting with recent service packs.

After uninstalling the 'Intel Application Accelerator' my chkdsk finished successfully and defrag seems to be going fine.

Thank goodness for the internet and its wealth of technical solutions!

Tuesday, December 26, 2006

Bye Bye EDI... Hello ThoughtWorks

Well, after almost four years at EDI (now called CargoWise edi) I am leaving. I finish in the middle of January next year. It has been an interesting time, and I have learnt a lot working with very talented people and from building the framework for a big solution suite (around 4 million lines of C# code). I've also had the opportunity to experience the very different joys and pitfalls of product management.

I will be starting at ThoughtWorks (of NUnit, Jim Webber and Martin Fowler fame) in the middle of February in the new year. I'm expecting that there will be a lot of new exciting stuff to learn, and a lot of variety in terms of clients and technologies. ThoughtWorks are strongly XP, do a lot of development on client sites and even have some Rails projects. The people I have met from ThoughtWorks have all been very friendly and I look forward to starting there soon :-)

Sunday, December 24, 2006

Our Christmas Party '06


Last Saturday, we had a Christmas party at our place. It went really well. Many thanks to Anh and Neeraj for doing such an excellent job with the BBQ.

Tuesday, December 12, 2006

Chark Jong - The Calm in the Eye of the Storm

Doing Chark Jong (breaking of the guard) today, my instructor pointed out that I was tensing up too much, and comitting myself to a big forward rush, when I should have been simply walking forward in my correct stance. After this and some more demonstation, I had an ephinany and things suddenly clicked. Here is my summary of how to do the technique more correctly:
  1. Put on a correct stance.
  2. Imagine yourself being sucked up towards the ceiling head first, or that your body is suspended from a thread going from the top of your head to the ceiling. This will straighten your back and neck and relax your spine.
  3. Mirror your oponent's guard with your guard.
  4. Imagine your arms are very heavy, and relax all the muscles in your arms and shoulders. Your arms should be rotated up and forward by your shoulder ball joint, holding the ultimate angle, but otherwise completely relaxed. Your elbows should feel as though they are pointing towards the floor.
  5. Step forward naturally from your waist.
  6. As you close with your opponent's guard (preferably a bit above it), allow your arms to drop down under their own weight, while focusing strongly on a point (eg, on the centre of your oponent's chest). Don't stop walking as your do this. The combined forward movement of your body and downward fall of your arms will mean that you collapse your oponents guard and hit through to their chest.
  7. Pull back both hands with a circular movement driven from your elbow, like in the form. This will catch the remains of your oponent's guard and further disrupt their stance. If this move isn't working for you, don't overdo it - be careful not to come out of your stance.
  8. Finish by stepping foward from the waist (imagine your belly button is leading the way) and drive your arms forward in a double palm strike.
When it clicks, it feels like the calmness in the eye of a storm. You are relaxed, in control and uncomitted, with time respond to any counters your oponent may choose to do.

Thursday, November 30, 2006

Thai Ordering and Development Mode vs Production Mode for Rails Apps

A while back, I wrote a little rails app for Thai food ordering at my work. My colleagues place orders using the system and then bring money to the nominated orderer of the week. Once all orders are in and paid for (this is also tracked in the app), the orderer rings up our favourite Thai restaurant (Laddas) and places the order.

I have the app running from fairly cheap shared hosting. At peak times during the ordering, I guess that they'd be 15 or so people simultaneously using the app. We've used it many times without problems. Thus, I was quite surprised and displeased (as were my colleagues), when my hosting account was suspended and we couldn't see what had been ordered this morning. A hasty email to my hosting provider revealed that my account had been suspended due to high load and "ruby flooding". They were kind enough to un-suspend my account and we completed the ordering process.

I remembered seeing something about production mode in 'environment.rb'. Some googling confirmed my hunch - in development mode, rails apps are much more resource intensive. Caching is not used, and every single file needs to be reloaded every time it is required. After changing my app to production mode, it seemed to run noticeably faster. Michael and I ran 'top' and it looked like each request used less CPU.

So, should you be in a similar situation, this is how to change your app to production mode on fast-cgi Apache shared hosting:
  1. Confirm that 'database.yml' in your app's 'config' directory has a section for production mode, and that it has up to date database connection details.
  2. Edit 'environment.rb' in your app's 'config' directory.
  3. Add this line:
         ENV['RAILS_ENV'] ||= 'production'
  4. Run 'ps -u [your_user_name]' to find if you have any 'dispatch.fgi' processes running.
  5. If so, kill all of them (they'll restart and use your new config settings).
  6. Browse to your app, it should now run faster.

Monday, November 27, 2006

Neuro Linguistic Programming - Part 2

This is the second part of my post on NLP. Part 1 is available here.

Building Rapport
To build rapport, the book recommends that you pay careful attention to the person you are speaking with and match their physical posture, expressions, breathing, movements, voice and language patterns. Whole body listening is important - this means you are curious and focused on the person you are speaking with and your language is 'you' focused, rather than 'I/me' centered.

Perceptual Positions
Perceptual positions are a way of appreciating situations from different standpoints and gaining different perspectives. 1st position is when you are in your own body - this position is good for concentrating on what you want and being assertive. 2nd position is when you imagine yourself in somebody else's shoes - good for trying to understand their perspective/actions. 3rd position is when you imagine yourself as a fly on the wall looking at the scene - good for detaching yourself emotionally and considering things logically.

Setting Anchors
Anchors are particular stimuli (eg, a touch, smell or taste) that automatically trigger a linked memory or emotion. Everyone has unconscious anchors - eg, smell of food makes you feel hungry and think of eating. However, you can set anchors for yourself which you can then call up at will to change your emotional state:
  1. Choose a state/feeling that you have experienced in your life that you want to be able to access whenever you choose.
  2. Choose an anchor - eg, touching index finger to thumb on your left hand.
  3. Recall the time when the feeling was it its strongest for you. Make sure you are seeing the memory out of your own eyes (1st position). Think about the time - what colours do you see, what do you hear, what do you feel etc.
  4. Just before your emotions peak, set the anchor and then remove it at the peak of your emotions.
  5. Shake yourself to break state, and then repeat the process several times.
  6. Test the anchor - think of something else and trigger the anchor. You should feel the emotions/state you associated with the anchor.
I had a little bit of a play with anchoring emotions. The technique seems to work at least to some extent for me. I intend to play around with it a bit more.

Friday, November 24, 2006

Neuro Linguistic Programming - Part 1

I recently finished reading "NLP at Work" by Sue Night. It was quite a nice introduction to the topic. Here's some of the more interesting bits through the filter of my interpretation.

Styles of Thought
Visual/Auditory/Feelings - from the way people speak (eg, "that sounds good"), you can guess what style of thought they prefer.

Eye Movements
The way you move your eyes is meant to reflect your thought patterns:
  • Looking up (or straight ahead defocussed) => remembering/constructing images
  • Looking sideways => remembering/constructing sounds
  • Looking down => feelings/internal dialogue

As an aside, if you're talking and somebody looks away, they are probably thinking, and you should wait till they meet your eyes again before continuing.

Empowerment thought Word Choice and Questions
Empowerment means you take responsiblity for your own experience. Resolve ambiguity and abdication of responsiblity though challenging your thoughts with questions.
  • Deletions: "They overlooked me in the recent promotions" - who are they?
  • Vague actions: "We are going to develop Joe's ability to learn" - how are we going to do that, and when?
  • Baseless comparisons: "The company is doing well" - compared to what?
  • Abstraction: "It was a difficult conversation" - who was involved, and what made it difficult?
  • Hidden opinion: "This is the right way to do it" - according to who? The speaker?
  • Generalisations: "She never listens to me" - how do you know that? Has there ever been a time when she listened to you?
  • Blame: "the company demotivates me" - how does the company demotivate you?
  • Drivers: "I want to see my friend" vs "I should see my friend". The former (driven by you) empowers and motivates, the latter (forced on you) triggers opposite feelings.
  • Assumptions: "he is fiddling with his pen => he is bored" - how does fiddling with his mean mean that he is bored? Maybe it is just his habit.
With this approach, you can untangle your beliefs. Eg,
"These presentations never go well" - Never? Has there ever been a time when one did go well? How do you determine if it went well?
"Giving these talks makes me feel stressed" - How exactly does giving the talks cause you to feel stressed? How do you want to feel?

The power of imagination
If you imagine something sufficiently strongly and sensually (when, where, sight, smell, touch, taste, sound, etc), your feelings will be similar to what they would be if it was really happening. Ie, your feeling do not differentiate between what is really happening, and what you imagine.

Hence, if you want to know how you would feel if you did X, simply imagine it in great detail and you'll find out. Similarly, if you want to achieve something, imagine what it would be like in detail and it will be as though you have already achieved it. Believe it is true, and you will act as though it is true, and then it will be easier for it to become true!

No negatives
The unconscious mind does not understand negatives. Hence, if you say "Don't worry" to yourself, you are in effect triggering the "worry" emotion.

Rewriting Memories / Modifying Perception
Bring up a memory in detail, and bring in as many senses as you can. Try changing the lighting, the background sound, the relative size of objects etc and see how you feel. If you do this enough, you can change how you feel in the memory, and how you will feel when something similar arises.

I think that this could be done mentally in real time in real situations as well by changing your perception. Eg, somebody is screaming at you. If mentally imagine yourself to be larger, and the screamer to be smaller and imagine a glass between you, you could avoid feeling overwhelmed or getting angry yourself. You could then respond in a better manner.

Beliefs of Excellence
What you believe will influence how you act. Hence, if you take on positive beliefs, you can become more friendly, productive and motivated. Similarly, negative beliefs (eg, "I can't do it") are often self-fulfilling. According to the book, the important beliefs for excellence are:
  • Each person is unique
  • Everyone makes the best choice available to them at the time
  • There is no failure, only feedback
  • Behind every behaviour is a positive intention
  • The meaning of the communication is its effect
  • There is a solution to every problem
  • The person with the most flexibility in thinking and behaviour has the best chance of succeeding
  • Mind and body are part of the same system
  • Knowledge, thought, memory and imagination are the result of sequences and combinations of ways of filtering and storing information
Presuppose that these beliefs are true for you - try them out :-)
Or go back into memory and imagine how you would have behaved differently had you had these beliefs.
Practice should make the belief become more fixed in you, and change your automatic behaviour.

Outcomes and Goals
What do I really want to achieve in 3 months/6m/1yr/3yrs, beyond..
List, prioritise and choose top 3. For each goal,
  • Imagine it with all senses - how does it feel/look/sound
  • When, where and with whom?
  • What have you got now you'd need to give up?
  • Is it worth the risk/pain? If not, chose another goal and start again.
  • If not self-maintained, chunk up ("recession to ease", ask "what's important about that?") to find the higher level need (eg, "security")
  • Ensure the outcome fits with who you are and who you want to be
  • What alternative ways are there to satisfy this need that will allow you to move towards the outcome?
  • How does having the outcome fit with the other people who are important in your life?
  • Act by dividing what you need to do into many small steps that you can work through in a real way every day or every week, potentially with time frames.
This topic is continued in Part 2.

Saturday, November 18, 2006

Wing Chun Grading

This morning I went for a grading to move from grade 3 to grade 4. I did better than I could have hoped - both passed and got a good score! New and exciting Grade 4 techniques shall be revealed to me next training :-)

Monday, October 16, 2006

Mocha, office style

I'd like to share with you an easy recipe for Mocha, made using only the commodities found in your average office kitchen. I learnt this from a colleague the other day, and it makes a nice change from one's usual tea or coffee in the morning.

Ingredients
  • 2 tsp milo
  • 1/2 tsp instant coffee
  • 1/2 tsp brown sugar
  • milk
  • hot water
Mix all ingredients and stir :-)


Interestingly, tea and milo is not a bad combination...

Tuesday, October 10, 2006

Successful Negotiating

Recently, I read "Successful Negotiating" by Julia Tipler. It's a pretty quick read (just under 100 pages) but has some interesting info. Here's some titbits from the book:

Relationships
Try to build long term relationships based on win-win deals rather than scoring points / grinding down opposition.

Language
Use precise language with dates rather than "ASAP" or "when you have time". Use simple language, and do not assume both sides hold the same assumptions and clarify often with questions.

Preparation
Prepare well by deciding your objectives (needs & wants), non-negotiables, what you can compromise on and limits. Research your opposite number - what do they need and do they have power to sign off?

Agenda
Create agenda and send to other party in advance of the meeting, emphasising that it is a draft and they can add items to it (aim to create a climate of agreement even before discussion begins). Place items that you think will be easy to reach agreement at the top to get momentum.

Place
If you are selling, you should go to the customer as you are making the most effort and people feel more comfortable/polite on their "home ground". Second meeting could be on "your territory". If there's a history of conflict, "neutral ground" may be best.

Time
Make sure you've had time to prepare. On the phone, check that now is a convenient time for the other person.

Exploration
  • If person says they need or want something, ask why and encourage them to explain.
  • "If I can't meet that condition, is there something else that would make this deal work for you?"
  • Identify mutual interest.
  • Chunk down to find out the details of what people want and also chunk up to find out the big picture of why/when. With this understanding, you can then negotiate solutions which meet the needs of both partieis.
  • Show you understand the reasons that lie behind wants/needs as this may reduce resistance to alternative suggestions.
  • Once understanding is reached, move to middle ground of bidding and proposing. Both sides will need to compromise to some extent. At this point, you are asking the other party to consider what a good deal is, rather than firm agreement.
  • Ask "what if" questions (eg, "what if I could offer you slower delivery but lower costs"?) and ask "why not" if they do not agree. Ask direct questions if this fails (eg, "what is the minimum delivery size you would agree to?").
  • Aim to uncover variables in the negotiations and come up with possibilities based on these.
  • Don't concede, exchange - doesn't need to be of equal value however.

Reaching Agreement
  • Summarise and restate after each point is agreed on. Eg, "We've agreed on W, X and Y. That only leaves Z to be decided".
  • Ask series of questions which are closed/leading, where the answer to each is yes, leading to the final question which closes the deal.
Closing
  • Always put agreement in writing (start with a draft framework for discussion).
  • Agree on review and complaint handling processes.
  • Agreement should be specific, measurable, agreed, realistic and time-bound.

Body Language
When interpreting somebody’s body language (or projecting your own), consider these aspects in decreasing order of importance:
  • Eye contact (around 70% of the time ideal, too little suggests disagreement or disinterest, too much suggests aggression, looking up suggests thinking, looking down suggests discomfort)
  • Facial expression (smile, make sure you show what you are feeling, don’t be deadpan, that’s unnerving)
  • Posture (Relaxed and upright, leaning forwarding slightly, crossing legs are all signs of interest. Folding arms or turning body away suggests discomfort with the proceedings. Mirroring other person suggests agreement.)
  • Hand gestures (open hand gestures suggest open mind, fiddling or doodling suggests disinterest or nervousness)
If body language is unclear, clarify. Eg, “Is this still all right with you?”

Listening
  • Do make listening noises such as "uhuh" and "mmm".
  • Do not finish other people's sentences for them, as they may find this irritating.
  • Take notes to show you're interested and to help you summarise the agreement as you approach the close.
Respond
  • Keep cool and respond, rather than react. Stay adult and detached and offer time out if the opposite part is losing it.
  • Show respect at all times.

Sunday, October 08, 2006

My Sister's Wedding

Today was Mia and Neeraj's wedding. It went really well, and the newly weds looked awesome :-) After so much planning, everything was very smooth. Neeraj and Mia made their vows and danced very nicely and the speeches were all good.




I got to sit at the top table facing all the other guests for the wedding ceremony, as I was doing a reading of a poem. Afterwards, I joined Soosun on the family table for the reception.

After the reception, Mia and Neeraj left for their honeymoon, we went back to Neeraj's family's place. We dressed up in our Bangladeshi clothes (many thanks to our flatmate Asif and his family for these!) and ate far too much tasty curry.
A wonderful day was had by all :-)

Saturday, October 07, 2006

Dance Dance Dance

Just finished reading Dance Dance Dance by Haruki Murakami. Amazing novel. Not exciting, but totally gripping. I couldn't put the thing down. The plot is a little unconventional to say the least, but my empathy with the narrator was overridingly strong and it is really this that made the novel so gripping.

Our narrator is 34, and in many ways, leads a normal and boring life. The boring parts of his life are described in detail. If you counted the pages devoted to descriptions of his every day life such as cooking, eating etc, I think you'd count about 1/3 of the novel. Rather than making the novel boring, as you would expect, it instead makes our narrator more real and human. And since he is so real, and so like you and me, even the "boring" parts of his life are interesting and enjoyable. For example, having a good meal and reading a book are nothing "exciting" in the traditional sense. However, since the narrator is so real, and so human, you can easily remember your own feelings when doing a similar thing.

There is something so real in the mediocrity of our narrator that strikes a chord with me. Our narrator is a good, fair guy, playing his part in an "advanced capitalist society". He's not amazingly talented at anything, he doesn't fit in and he's not very socially ept. He "shovels cultural snow" writing pieces for magazines. He has a few friends and romantic interests. He tries not to hurt people but doesn't know where his life is going or what he really wants. When you look at him, and think about him, it forces you to look at yourself, in a very similar advanced capitalist society, shovelling virtual snow, or whatever you do. At the end of the day though, he's the best of the bunch. He's responsible and he cares. Maybe that's cause for hope.

Dance Dance Dance follows on from A Wild Sheep Chase, although you could probably get by without reading the earlier novel. It's a great book, go forth and read it :-)

Sunday, September 10, 2006

Rails and the initialize() method

I spent a bit of time this weekend on a pet rails project. I came across a strange error when trying to create new records through the application. Editing was working just fine, but creating a new record just seemed to hang.

Breakpoints came to my rescue. In Ruby, they're really handy. You can put a 'breakpoint' call anywhere in your code, and if you have a breakpointer process running (start this with the command 'ruby script/breakpointer'), you jump straight into an interactive ruby console debug session when the breakpoint is hit.

Using the development log and a few breakpoints, I found the that the error was:
ArgumentError: wrong number of arguments (1 for 0)
And that it was caused by a line similar to this:
@order = order.new(params[:order])
Ie, the controller was creating a new order from the post parameters.

Then all became clear - some time earlier, I'd overridden the initialize() method in the order to default some dates. My code was similar to this:
def initialize
super()

if (@new_record)
self.validFrom = Date.today
self.validTo = 1.year.from_now.to_date
end
end

Great for creating new objects in my tests and console sessions where I always just created the object and then set properties. However, the controller was relying on passing in the post parameters in the constructor.

The solution is to accept any number of params and pass these to the base class:
def initialize(*params)
super(*params)

if (@new_record)
self.validFrom = Date.today
self.validTo = 1.year.from_now.to_date
end
end

That way, the order can accept the post parameters in its constructor.

I'm very pleased to say that I can now create new records again!

Wednesday, September 06, 2006

How to do Tax Deductions for an Investment Property in NSW, Australia

Last year I bought a house. Recently, I've been doing my tax. It is much more complex this year with the property, but there are a lot more deductions. Here's some tips:

Renting a out part of your property
If you rent some of your property, you are eligible for tax deductions for a proportion of your expenses. This proportion is based on the floor area that is rented, compared with the floor area which is not rented. Make sure you include common areas in your calculation.

Keep receipts and record all expenses
They then need to be classified into areas such as:
  • Interest on loan
  • Advertising
  • Insurance
  • Rates
  • Repairs
  • Postage
  • Cleaning
  • Garden
  • Borrowing expenses
  • Legal Expenses
  • Depreciation
  • Capital Works

Most of these are straight forward, and immediate write offs in the year they are incurred.
I'll go into more detail on the complex ones below.

Borrowing Expenses
Generally, you will need to spread these over 5 years, or the length of your loan, whichever is shorter. In most cases, this will mean you'll tax deduct 1/5 of them each year for the first 5 years of your loan. They include things like government stamp duty on the loan and bank charges.

Legal Costs
Unfortunately, these do not include the cost of legal fees in acquiring your property. They are for when you need to fight with tenants in court and similar. Hopefully you won't have any of these.

Depreciation and Capital Works
This is the most complex area. First, download the Rental Properties Guide 06 (NAT1729-06) from the ATO. This document is invaluable. I'd recommend you at least skim read it.

Capital Works
Okay, now, if your house has been built or had any significant renovations since 1979, you may well have capital works deductions. The conditions on these vary. Have at look at the guide mentioned above, page 23 of the PDF. In most cases, you will be able to claim construction costs at 2.5% for 40 years. If there was a couple of hundred thousand dollars of construction costs, 2.5% could be quite a bit of money every year. If you know the cost of the construction, this is easy to calculate. If not, you will need to get this estimated - you can't do this yourself. I used Depreciator. They employ quantity surveyors and meet ATO requirements. I was quite happy with them - see my post on the Somersoft investment forum for more details. They also estimate costs of assets such as hot water systems, stoves, blinds etc.

Deductions
You need to classify all your assets according to their cost and depreciate accordingly:
  • $1-300: write off straight away in the current tax year
  • $301-1000: put in low value pool (deduct at 18.5% for the first year when adding to the pool, 37% for assets already in the pool)
  • $1001 or more: depreciate with straight line or curved line methods over effective life set out by ATO. You can find these in the rental guide from the ATO mentioned above.
What is a asset (can be depreciated) and what is a capital work
There is a reasonably arbitrary seeming classification of items between capital works and deductions. A hot water system, for example, is a depreciable asset but a kitchen cupboard is a capital work. Check all your items with the rental guide mentioned above. If an item is an asset, you can estimate its market value, and you can depreciate it over the effective life in the guide. If it is a capital work, then you cannot depreciate it. It is part of construction costs - see above section on capital works for more details on claiming these.

Disclaimer
I'm not a tax professional. This post is my personal opinion and interpretation. No responsibility taken for an errors or omissions. Use at your own risk.

Sunday, September 03, 2006

Learn English using a Blog and Programming Tools!

My fiancee, Soosun, is brushing up on her English skills before going to uni next year. As part of the plan to improve her writing, she's started a blog. Friends and family can write comments on her posts to help improve her written English.

She just wrote a nice article on making kimchi, and I posted a comment containing a copy of her article with English improvements. But how can she tell what I've suggested? The solution we decided to use is kdiff3, a tool I use at work for comparing and merging source code. You can download it here. If you turn word wrap on, it is great for comparing English - shows up the differences beautifully.

From "A Wild Sheep Chase" by Haruki Murakami

"Nor do you know where you stand. Now listen, I thought it over last night. And it struck me. What have I got to feel threatened about? Next to nothing. I broke up with my wife, I plan to quit my job today, my apartment is rented, and I have no furnishings worth worrying about. By way of holdings, I've got maybe two million yen in savings, a used car, and a cat who's getting on in years. My clothes are all out of fashion, and my records are ancient. I've made no name for myself, have no social credibility, no sex appeal, no talent. I'm not so young anymore, and I'm always saying dumb things that I later regret. In a word, to borrow your turn of phrase, I am an utterly mediocre person. What have I got to lose? If you can think of anything, clue me in, why don't you?"

Great passage, ya?

Saturday, September 02, 2006

Sunday, August 27, 2006

Litost in Le Petit Prince

I was reading a post on Phillip Eby's blog recently which quoted a little of "Le Petit Prince" by Antoine de Saint-Exupéry ("The Little Prince" in English). It's been a long time since I read it (I studied it in French class at school), so I got hold of my old copy and have been re-reading it. It's really great - both funny and serious, and I've been enjoying exercising my atrophied French muscles a bit. If you haven't read it, I recommend you get it and have a read in either French or English. Wikipedia has got some more information on the novel here.

Anyway, I came across an interesting passage that seems to dove tail very well with my recent post on Litost. Here we go:

"Elle serait bien vexée, se dit-il, si elle voyait ça... elle tousserait énormément et ferait semblant de mourir pour échapper au ridicule. Et je serais bien obligé de faire semblant de la soigner, car, sinon, pour m'humilier moi aussi, elle se laisserait vraiment mourir..."

And here's my rough translation into English:

"She would be very vexed, he said to himself, if she could see that... she would cough violently and pretend to die to escape being laughed at. And I would be obliged to pretend to heal her, so that I could humiliate myself as well, otherwise, she would really let herself die."

PS - Found the full-text available online in English, French and some other languages!

Engagement Party!

Last night was our engagement party! It went really well :-)

We had it at the Royal Exchange Hotel in Marrickville. The weather was great, and the venue was really nice, and our guests were awesome!

Many thanks to my mum and grandma for the cakes, my family for being so helpful on the night, to Dennis Building for the drinks tab, and to everyone for coming along to celebrate our engagement with us. We had a really great time and I hope everyone else did too :-)

Monday, August 21, 2006

Litost

For some reason, while doing the washing up today, my mind was wandering and I remembered reading "The Book of Laughter and Forgetting" by Milan Kundera. A colleague and friend of mine gave me the book for my 24th birthday. It was a fun and interesting read with a good story. The passage I was day dreaming about was "What is Litost?". I was thinking I might take a stab at explaining it in my own words, but having read the passage again, I'm sure Milan Kundera has done a better job than I could hope to achieve. Hence I give you the passage verbatim:

What is Litost?
Litost is an untranslatable Czech word. Its first syllable, which is long and stressed, sounds like the wail of an abandoned dog. As for the meaning of this word, I have looked in vain in other languages for an equivalent, though I find it difficult to imagine how anyone can understand the human soul without it.

Let me give an example: The student went swimming in the river one day with his girlfriend, a fellow student. She was athletic, but he was a very poor swimmer. He could not time his breathing properly and swam slowly, his head held tensely high above the surface. She was madly in love with him and tactfully swam as slowly as he did. But when their swim was coming to an end, she wanted to give her athletic instincts a few moments' free rein and headed for the opposite bank at a rapid crawl. The student made an effort to swim faster too and swallowed water. Feeling humbled, his physical inferiority laid bare, he felt litost. He recalled his sickly childhood, lacking in physical exercise and friends and spent under the constant gaze of his mother's overfond eye, and fell into despair about himself and his life. They walked back to the city together in silence on a country lane. Wounded and humiliated, he felt an irresistible desire to hit her. "What's the matter with you?" she asked him, and he started to reproach her: she knew about the current near the other bank, and that he had forbidden her to swim there because of the risk of drowning - and then he slapped her face. The girl began to cry, and when he saw the tears on her cheeks, he took pity on her and put his arms around her, and his litost melted away.

Or take an instance from the student's childhood: His parents made him take violin lessons. He was not very gifted and his teacher would interrupt him to criticize his mistakes in a cold, unbearable voice. He felt humiliated, and he wanted to cry. But instead of trying to play in tune and not make mistakes, he would deliberately play wrong notes, the teacher's voice would become still more unbearable and harsh, and he himself would sink deeper and deeper into his litost.

What then is litost?

Litost
is a state of torment created by the sudden sight of one's own misery.

One of the customary remedies for misery is love. Because someone loved absolutely cannot be miserable. All his faults are redeemed by love's magical gaze, under which even inept swimming, with the head held high above the surface, can become charming.

Love's absolute is actually a desire for absolute identity: the woman we love ought to swim as slowly as we do, she ought to have no past of her own to look back on happily. But when the illusion of absolute identity vanishes (the girl looks back happily on her past or swims faster), love becomes a permanent source of the great torment we call litost.

Anyone with wide experience of the common imperfection of mankind is relatively sheltered from the shocks of litost. For him, the sight of his own misery is ordinary and uninteresting. Litost, therefore, is characteristic of the age of inexperience. It is one of the ornaments of youth.

Litost works like a two-stroke engine. Torment is followed by the desire for revenge. The goal of revenge is to make one's partner look as miserable as oneself. The man cannot swim, but the slapped woman cries. It makes them feel equal and keeps their love going.

Saturday, August 19, 2006

Ruby on Rails Hosting, Setup And Migration

I've been doing a little rails of late.. Here's a summary of the stuff that I've learnt.


What hosting should I use in Australia for rails?

NOT JUMBA - SEE UPDATED REVIEW BELOW

I'm using jumba (http://www.jumba.com.au). Jumba is very cheap (~$30AUD/year), and they give you shell access, mysql etc. However, there was a period of several weeks when they moved me to some server without an install of rails and kept promising to install rails and never did. I finally got them to move me back to their main server which has rails installed. It was a painful process, so I'm not sure if I would recommend them. That being said, things are going OK at the moment, and I've got a few development apps up and running on their service.

UPDATE 29 March 2006: Jumba summarily stopped rails support without notice and was rude when I contacted them about it. I would not recommend Jumba for web hosting anything - they have frequent down time, server switches and reboots and their low price is made up for by the amount of time you waste. They used to be OK, but no longer. I'm in the market for a new host, will post on how it goes.

How to set up rails applications in your home directory (in public_html) under a UNIX/Apache/cgi/fcgi environment
  1. Upload or create your application in your home directory. Eg, ~/MyRailsApp/
  2. In your public_html directory, create a soft link to the public directory of your app. Eg,
    ln -s ~/MyRailsApp/public ~/public_html/MyRailsApp
  3. Make sure dispatch.fcgi in the ~/MyRailsApp/public directory is executable. If not, chmod it a+x.
  4. Confirm that dispatch.fcgi has a valid path to ruby on the first line. If you've created this project on another machine, you'll quite possibly need to update the path. The path is often something like '#!/usr/local/bin/ruby', but check what it is under your system with 'which ruby'. Special note for InstantRails users - you'll always need to update the path when uploading to unix hosting, as instant rails uses a windows style path with the slashes the other way around.
  5. Update your 'database.yml' file (in the 'config' directory of your app) with correct database names, user names and passwords.
  6. Run 'dispatch.fcgi' (in the 'public' directory of your app). If you see an 'Internal Server Error' message, you know things are going OK. If you've got the path to ruby wrong on the first line, or some other similar problem, you'll find out about it here, where as if you run through the web, you don't get these sorts of problems reported in an easy to understand way.
  7. Check out your running system in the browser (eg, browse to http://myhostingcompany.com/MyRailsApp/)

Tips for trouble shooting rails errors
  1. A good place to start is by reading your logs in the 'log' directory of your rails app. If you're running a development configuration, have a read of 'development.log'.
  2. Try manually running 'dispatch.fcgi' in the 'public' directory of your app. If you get an 'Internal Server Error' message printed out on the console, it's probably working ok. Alternatives to this are reports of missing files and unable to find ruby - often these aren't shown when browsing to your web site.

Rails problems and solutions


1. Browser and logs show: Application Error - Rails app failed to start properly
"

I got this after my app was moved from one unix host to another by my hosting company. I tried heaps of stuff to try and resolve this. Eventually I created a brand new dummy project on the unix host called 'Test' and Test worked fine from the browser. I then tried my original project again and suddenly it worked fine! It has been working fine since. I can only imagine that there was some sort of problem in temporary files or similar which got flushed. No good explanation for this currently.


2. in `start_engine': undefined method `add_path' for Controllers:Module (NoMethodError)

I got this one when migrating a project from rails 1.1 to a later version of rails. The solution is to force update your rails engines:

script/plugin source http://svn.rails-engines.org/plugins
script/plugin install engines --force
script/plugin install login_engine --force


3. My app works fine if there is a trailing slash on the url. Otherwise, I get a 'Bad Request' error page. Eg, 'http://myhost.com/myapp/' works, but 'http://myhost.com/myapp' does not work.

Add a RewriteRule to the .htaccess file in your application's public folder:
RewriteRule ^.*myapp$ http://%{HTTP_HOST}/myapp/ [R=301,L]

My basic .htaccess rewrites are as follows:
RewriteEngine On
RewriteRule ^.*myapp$ http://%{HTTP_HOST}/myapp/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

I tried removing the RewriteCond !-f, and my pages lost their styles. I think the condition allows the rails framework to load .css files directly without having the requests go through dispatch.fcgi.

Saturday, August 12, 2006

What is Wing Chun About?

For those of you who haven't heard of it, Wing Chun is a type of Kung Fu which was developed by a nun in China, a couple of hundred years ago. It focuses on technique rather than strength and, as such, is designed so that a smaller person can successfully fight a much larger person, and not get too tired out in the process. There's no messing around in Wing Chun, it's not like the movies where fights go on for ages. The aim is to take out your opponent rapidly and effectively.

Here are the principles of Wing Chun, according to the masters:
  • Economy of movement
  • Directness
  • Practicality

As a Wing Chun student of about 3 years (ie, by no means an expert), I think this means:
  • Carefully angling legs and arms (the ultimate angle) at which point they are very strong and take very little energy to resist force applied by an adversary.
  • Applying full body weight in every movement (eg, force going from shoulder, to elbow, to wrist in each movement).
  • Relaxation of muscles to increase speed, decrease energy use and make it very difficult for your adversary to grab you.
  • Redirection of strikes rather than blocking.
  • Increasing force of your strikes through pivoting and stepping forward.
  • Simplicity. Movements are simple with no adornments.
  • Ruthlessness. Nowhere is off bounds to a strike when you're fighting for your life.
  • Keeping your pelvic floor muscles lightly tensed so that your body works as a single unit.
  • Every defence is also an attack.
  • Stance is very important. From a strong stance, your blows have much more force as you do not move backwards when you strike. All your force goes into your opponent, rather than rocking you backwards.
  • Upsetting the stance and breaking the guard of your opponent is a major goal. Once that's done, they are at your mercy, you can keep them off balance by constantly moving forward.
I really enjoy Wing Chun. Also, it keeps me fit, and I think I'm much better equipped to deal with any sort of physical aggression as a result of my training. I haven't tried any other school, but I'm happy with my current one, the International Wing Chun Academy.

Tuesday, August 08, 2006

"Norwegian Wood" by Haruki Murakami

Norwegian Wood is an excellent novel. I finished reading it at lunch today, and haven't stopped thinking about it since. The novel is really subtle, and at the start, I wasn't immediately interested. However, once I got into it, I couldn't put it down. Toru, the narrator is so well developed in the novel that he seems almost like somebody I have met in real life. If you haven't read it, don't hesitate - start reading it right away! And don't read any more of this post.

If you have read it, what do you think of the ending? I've read people suggesting that Toru committed suicide or similar, but I don't believe that that is the case. For one thing, he's got to live to 37 and catch a plane, as described at the start of the novel. I think the "dead centre" reference is due to Toru being dead centre of the "countless shapes of people walking by to nowhere", rather than having died. I think the ending is happy. Or maybe I just want it to be. Here's my interpretation. Toru is lost in the middle of nowhere. His old life was based around Naoko and Kizuki (plus Reiko as a link to them). They have all died or left. He is in the middle of nowhere. But Midori can rescue him from this. She is his anchor to reality and a new life. She will give his life direction and meaning - that's why he calls out to her again. If anyone in the novel is a symbol of life, it is Midori, and by calling out to her, I can only understand that Toru has chosen to keep living and to pursue happiness. Midori's silence is "the silence of all the misty rain in the world falling on all the new-mown lawns of the world". That's a positive image for me at least, pregnant with possibility.

If only I could read Japanese, perhaps I would understand better.

PS - Many thanks to my friend Jim for lending this most excellent book to me.

Saturday, August 05, 2006

Some Random Writing

You've heard the expression 'All men are the same'? That's obviously not true. However, there are some things that most heterosexual men share. One of them is an inbuilt, natural response to stimuli, a certain bond that eats cultural differences for lunch, and that applies across all ages and languages. No matter what they pretend, a visit to a womans' clothing warehouse is a daunting experience for a man.

Just look around. Sure, there are one or two women who look like they find shopping for clothes a chore. But the majority, see their rapt attention and concentration, circling the racks of clothes, looking, holding, touching, and cradling the cascading cloth against their bodies.

Now, for the men. You can see four sitting around the room - two are reading newspapers, one is operating a PDA and the last is just staring at his legs, spacing out. Only men sit in the chairs. They are the loved ones and drivers. Their opinion is sometimes sought, but generally only out of politeness. The women already know what suits them best.

Thursday, July 27, 2006

Some Interesting Quotes

"Imagine, Paul said to me once, that the present is simply a reflection of the future. Imagine that we spend our whole lives staring into a mirror with the future at our backs, seeing it only in the reflection of what is here and now. Some of us would begin to believe that we could see tomorrow better by turning around to look at it directly. But those who did, without realising it, would've lost the key to the perspective they once had. For the one thing they would never be able to see in it was themselves. By turning their backs on the mirror, they would become the one element of the future their eyes could never find...
For years I've been determined to get on with my life by doggedly hunting down the future... It's a blind way to face life, a stance that lets the world pass you by, just as you think you're coming to grips with it."
-- Extract from "The Rule of Four" by Ian Caldwell and Dustin Thomason

"You know, for the longest time, I kept trying to make my life easier. It wasn't until a month or so ago that I started to realize just how unbelievably fucking stupid that was. We're not here to have an easy life. We're not even here to do the things that we have to do. We are here to do the things we choose to do, and sometimes we choose to do them because they are challenging, not in spite of it. Would you keep playing a video game that was trivial to beat?"
-- Phillip J. Eby

"Don't feel sorry for yourself. Only arseholes do that." (Nagasawa)
"You try too hard to make life fit your way of doing things. If you don't want to spend time in an insane asylum, you have to open up a little more and let yourself go with life's natural flow... So stop what you're doing this minute and get happy. Work at making yourself happy." (Reiko)
-- from "Norwegian Wood" by Haruki Murakami

Engaged!


Haven't had a chance to write on the blog for a little while, but Soosun and I are now engaged! We went away about two months ago to Palm Beach for a long weekend, and I proposed there... and she said yes :-)

Wednesday, May 24, 2006

Book Review: UML Distilled

UML Distilled: A brief guide to the standard object modelling language
(3rd Edition)
by Martin Fowler

UML Distilled is good. It is written carefully and concisely and has been heavily revised to cover UML 2. It is a opinionated book - it presents Martin Fowler's view of UML. This is a good thing. Fowler concentrates on the parts of UML that he has found widely used in the industry, and the most useful in his own work. Fowler is not bound by the UML specification, he also describes "non-normative" diagrams (ie, variations on UML which are not standard but widely used). Fowler often provides his own view on a particular diagram or component. For example, I've often wondered when to use aggregation rather than association in a class diagram. Fowler cleared this up for me:

"Aggregation is strictly meaningless; as a result, I recommend that you ignore it in your own diagrams. If you see it in other people's diagrams, you'll need to dig deeper to find out what they mean by it. Different authors and teams use it for very different purposes."

UML Distilled starts with an introduction about UML's history and aims, and then a rapid look at different development methodologies and where to fit UML into them.

The core of the book covers the following diagrams/specs:

Class Diagrams
Sequence Diagrams
Object Diagrams
Package Diagrams
Deployment Diagrams
Use Cases
State Machine Diagrams
Activity Diagrams
Communication Diagrams
Composite Structures
Component Diagrams
Collaborations
Interaction Overview Diagrams
Timing Diagrams

Class diagrams and sequence diagrams are covered in detail, the other diagrams more briefly. The book is quite short, but gives enough information on each topic to allow you to understand and draw the diagrams. At the end of each chapter, there is a helpful "where to find out more" section and a "when to use this type of diagram" section.

There is also an appendix at the end of the book on changes between various versions of UML.

The book is surprisingly easy to read. Fowler's style is clear and friendly and examples are well chosen.

My only complaint is that perhaps the book could have been a little longer to allow a bit more detail on some of the diagram types. I would have liked to have read a little bit more on object diagrams in particular.

I'd recommend the book to anyone who wants a rapid and concise introduction to or revision of UML 2.

Rating: 9/10

Sunday, May 21, 2006

Happiness

A few weeks ago, I read an interesting article in the Sydney Morning Herald about happiness and also listened to a talk by the abbess of the Nan Tien Buddhist temple near Wollongong. These have merged together in my mind as they covered a lot of the same ground. I'm going to summarise the points that seemed important to me, and also include my own take on some of the ideas.

A mental approach
* If you're happy, and your emotions are generally well balanced, you enjoy life more, other people enjoy your company more, and you're more productive.
* Happiness is only in the mind.
* In your life, there's a lot of things that happen to you. Some of these improve your life and some of them negatively effect you.
There's a lot of chance involved that you can't control.
* Therefore, if you want to be happy, you can't rely on external events to make you happy.
* However, your mind is your own, and it is the organ through which you interpret everything.
* Since you are in control of your mind, you are in control of your interpretation of the events that happen to you.
* Therefore, by actively shaping your own interpretation and view of the events that happen to you in your life, you can choose to achieve happiness.

Completing goals
Completing goals makes you feel good.. for a little while. But there is always more to achieve. This means that you spend almost all your time trying to achieve, and the actual time after achieving is in fact very short before you need to rush on to the next task. Therefore, you've got to enjoy the path, not just the goal. Thus, see the mental approach above.

Ways that don't work
* Achieving happiness through possessing things never works. No matter how much you have, you always get used to that amount, and want more. This means you're always seeking, and the achievement is almost an anti-climax.
* No use comparing yourself with others to feel superior. Even if you are the "best" in your circle of acquaintances, it won't be long before you find someone who is "better". They'll always be people who are richer, faster, smarter or better than you in a particular area, so this approach will only lead to disappointment.

Other Thoughts
Since happiness is only in the mind, the reality of your situation is completely irrelevant. If you feel like you are in control of your life, you think you are achieving your goals and you think you are doing well, then you are.

Book Review: My Job Went to India, 52 Ways to Save Your Job

Full Title: My Job Went to India (And All I Got Was This Lousy Book), 52 Ways to Save your Job

Author: Chad Fowler of the Pragmatic Programmers

185 pages, Paperback

An interesting book written by Chad Fowler, who spent 1.5 years in India hiring and managing an outsourced team of developers. The book's main focus is on how you can make yourself as, a developer, more valuable to your company / community so that your job is not outsourced. There are quite a lot of valuable and interesting ideas in the book for professional development, and "getting your name out there". The book also gives the reader some idea of what development is like in India, some tips and the pluses and minuses of outsourcing.

The style of the book is conversational, and easy to read. I finished it in 2 days. I'd recommend it to developers wondering about outsourcing and looking for some tips on professional development.

Rating: 8/10