True Happiness Found in Old Church in Knaphill

Scan_20151112

Driving on the weekly shop to my local Sainsburys in Knaphill I noticed a sign that said meditation centre that piqued my interest. Now I have always been one for the peculiar, perhaps it was my yoga teaching (sometime hippy) mother, or maybe it was watching too many martial art films. But I always believed that there is some secret key to life in the practice of meditation. The fact that the name on the sign was practically unpronounceable made it all the more irresistible to my mind.

A quick google for ‘London Dhammakaya’ and I found a very comprehensive website for the centre. Apparently these Buddhist monks from Thailand had converted the old asylum church building into a warm modern meditation centre. I didn’t really want to pay for anything until I had tried it out so I clicked past the £70 retreat weekends and found they offer a free beginner meditation session every Tuesday night 7-9pm

My father, bless him, was highly concerned that I was about to join a cult. I assured him that at the first sign of crazy I would beat a hasty retreat. I walked the short distance from my house in the cold winter air and was confronted with a rather foreboding bulk of Victorian Architecture. Not completely sure how to get in I walked around the back and found a small wooden door, luckily before I could get cold feet on the threshold a lovely chinese gentleman walked up and opened the door for me, showed me into the vestibule and helped me with the basic etiquette like removing shoes.

Inside the old church is definitely not what you would expect. What has been described to me as a once gloomy church hall, is now warmly lit, and modernised with digital displays, professional announcement system, and a large golden buddha sitting kindly at the head of a meditation hall. Filled with soft thai music the space was just a perfect space for meditation, like a warm hug for the soul.

The session started with a quick 3 bows to the buddha and the monk and then we settled into a 45minute meditation, which I must say was a bit of a shock to the mind after no meditation in a long time. All those things that you have been avoiding thinking about, and all the ones you have been thinking (repeatedly) come crashing in like waves, and I started to fell this was no use at all. But about 40 minutes into the session, my mind suddenly stopped, it was like sailing out of a storm and into perfectly clear water, and it felt good! So good that I had to open my eyes and look around to see if anyone else could see how good I felt. Fatal mistake. But even if my mind restarted immediately it still felt like I had somehow achieved something, like I was on a slower and slightly happier setting in my brain.

After the session the teaching monk slowly described a teaching from Buddha in broken English, it said to distrust everything, ancient books, supposed wise teachers, even your own perceptions at times. The answer apparently is to only trust what seems to lessen suffering in the world and make people (including oneself) happier. My western educated mind is highly suspicious of blind faith in any organised religion, yet I still yearn for some kind of spiritual fulfillment. So this sort of introduction to Buddhism was a god send, it made sense, it was scientific in its approach.

6 months later and I am still enjoying every minute that I spend at the centre. Every week I go on a Tuesday evening and I now try to meditate for at least a few minutes every day. The real benefits took some time, and every session can be a challenge of introspection, but every now and again, and increasingly often I get those stunning moments of calm and clarity. What my teaching monk calls “true happiness”. This centre is a hidden gem, the teaching principles of the Dhammakaya Buddhist order are cleanliness, organisation, timeliness, organisation, and most importantly generosity. There is no expectation of money or of compliance with Bhuddist traditions, the monks and the temple staff just wish the world peace and happiness. Sounded too good to me too, but they really are like that and that is why I frequently suggest to my friends to come along for a session.

If you are also interested in doing a bit of introspection, spirituality without the religion, de-stressing, mind calming, or just a bit of meditation then the centre is open for beginners in Knaphill Church 2 Brushwood Way every Tuesday Evening from 7-9pm, refreshments available. Side effects may include mental calm and happiness.

Posted in Press Clippings | Comments Off on True Happiness Found in Old Church in Knaphill

Overloaded queues are causing my stress

So I finally figured out today another piece of the jigsaw why (despite reading GTD several times) I still ended up in a place of stress with operational work environments.

Its all down to queuing theory (see below). Basically there are only two states for a queue, small and under control, or tending towards infinity and out of control.

A few months ago I switched from inbox 0 to inbox infinity, where I just leave the emails coming in like a twitter feed and check every so often for the important ones and transfer specific tasks into my organisation system. This means that I don’t have to worry about trying to get to inbox zero.

However now the problem is being transferred to the operational management system where the queues of different tasks are becoming too long.

The reality is that most tasks don’t need to be done. Down to the old whats important and whats urgent. You want to be holding onto the best next step at any given point during the day/week, and if the main to do list is more than about 5-10 things I get stressed. So the answer is to just throw things out on a regular basis. And use packet switching to switch between key tasks.

Now I believe there are two modes of human operation. Fast 20min cycles of activity for operational work, and slow 4hr cycles of activity for creativity. This means that I have set up two main queues, one for possible 20minute tasks the other for possible 4 hr tasks and I can mix and match between them as necessary.

I have also set up a priorities column right next to my 2 main queues. This allows me to cross check my current priorities with the range of activities I currently have on my mind.

Finally I set up a completely new meta board to keep track of the the three main places that I interact with things to get done: my phone, my laptop, and the rest of the world.
So no I have a list of inboxes, someday maybe lists, or queues for each setting, allowing me to review where information and requests are coming to me from.

Source: Queueing theory – Wikipedia, the free encyclopedia

Posted in Musings and Reasons | Comments Off on Overloaded queues are causing my stress

Retreat12th Inner Peace Meditation Retreat London – YouTube

My friends at the local temple asked me to take part in a promotional video for their weekend retreats. Sometimes promotional videos come across as forced, that is definitely not the case here. I genuinely love the feeling of calm that comes from regular meditation.

Posted in Musings and Reasons | Leave a comment

The art of the cheatsheet

I think that kids should all be taught the wonderful art of the cheat sheet.

My father thinks that the term ‘cheating’ has a negative connotation, and I can see why. But I think that society would move along a lot faster if we all let go of some of the guilt complex associated with finding easier ways to do things. Mostly I think that people are more likely to click on this headline than ‘The art of distilling a subject onto a sheet of paper’.

I once met a man at an education conference who explained the idea of the ‘gestalt’ to me. That is to say something that describes the essence of a subject, and if you ‘grok’ (intuitively understand) that idea then the rest of the knowledge and learning in that subject area will fall into place. Let me give you some examples:

  • If you understand this syntax diagram you will understand how to construct a ‘for’ loop in Javascript:
    For Loop
  • If you understand rules of association, commutation, and distribution, you will understand most of simple algebra.
  • If you understand the basic stance and swing in Golf you will be able to get the ball onto the green most of the time.

All of these are the shortcuts in life. They are the essentials that everyone who succeeds at something has understood before they try to do anything more complicated. There is an element of this that relates to the Pareto principle where 20% of the effort gets 80% of the reward. It also is directly linked to this 20-100 hrs of learning concept. If you invest 20-100 hours of learning in anything you will have 80% of the expertise that you would gain from several thousand hours.

Important to note here is that you will need to invest several thousand hours in at least one thing in your life time if you want to achieve real mastery and not just trivial understanding. There is always one thing for everyone.

And so onwards to the cheat sheet. If we distil the short cuts for ourselves into a simple single symbolic page, it works with the human brain as a trigger point that kicks us back into the neural pattern at the time when we first understood the concept. So it works tomorrow or hopefully in 10 years. As long as you have a visual stimulant to re-engage the brain (some people might call this a totem), then you can recover the same understanding. Preferably the cheat sheet is one piece of paper (for me a standard european A4 side). I like to then print it off and laminate it and keep it around as a handy reference guide.

This reference is a very personal thing and is unlikely to be perfectly suited to duplication for others. More to the point the act of actually completing a cheat sheet for oneself crystallises the knowledge in ones own brain. So instead of publishing these cheat sheets as an actual guide, I have decided to publish them as an example of what works for me, but the actual thing to learn is how to complete one by oneself.

So over the coming months and years I will be publishing cheat sheets and how I use them to get work done, and explain in detail how I invented them, so that others might get the same reward that I have experienced.

Posted in Models of thinking | Comments Off on The art of the cheatsheet

Idempotent vs Nullipotent vs Polypotent

Idempotent is a word that turns up a lot in programming (and functional mathematics). I went looking for its definition and realised it is a great concept that needs to be understood.

Idem from the latin root for ‘the same’, and potent from the root for power or control. It could be roughly translated as 1 change. That is it makes one change and no more even if you try the same action over and over.

For example let us set up a simple data structure of 1 variable held in memory:

var x = 0;

Now if we reassign the variable to a new integer and display it on screen:

x = 1;
console.log(x);

This would return the same result (1) every time no matter how many times you assigned it to the same integer and displayed it on screen. This is idempotent.

Nullipotent is a bit different, with a prefix that means no change. So if we where to simply display the variable without attempting to reassign it in any way:

console.log(x);

The difference is subtle but important. In the first situation there is the potential to alter the variable every time you run the code but it is set up to always assign the variable to the same number so in reality there is never an actual change.

There should be one final word to logically complete this progression, one that describes a scenario when every time you run a function or access a particular element it alters the data…

x++;
console.log(x);

This would alter the variable every time you executed it. After some Googling for a suitable candidate (I feel non-idempotent is not acceptable) I decided to derive my own protologistic definition using the same form.

polypotent
adjective:
1. denoting an element of a set which is always changed in value when multiplied or otherwise operated on by itself.
noun:
1. a polypotent element or function

This is all particularly important in HTTP/REST principles which I intent to put into a better article at some point but essentially the 4 verbs of modern apis break down like so…

Verb Status
Post Polypotent
Get Nullipotent
Update Idempotent
Delete Idempotent

If you consider those verbs in this context then you will always make sure to form your functions in such a way as to protect the end user from doing something stupid like deleting their entire database.

The last thing to consider is ‘Race Conditions’ when you have two parallel threads of processing perhaps even on different machines, each acting in a supposed idempotent fashion but one might create a record while the other is deleting it etc. So when considering this mental model for laterally scalable systems it is important to build in safety mechanisms for so called ‘Race conditions’. Let me end with the famous statement of the two hardest problems in computer science.

1. Naming things
2. Cache invalidation (race conditions)
3. +1 errors

The end.

Posted in Models of thinking, Web Applications | Comments Off on Idempotent vs Nullipotent vs Polypotent

Logging best practices

I’m starting to see the need for good logging, least of all as a way to pass messages between workers in a web app. So I decided to find some best practices for logging individual events.

First of all I fell upon Morgan and Winston as excellent tools to log events locally.

Next I discovered the wonders of Splunk. Where I found an article on best format for a log event.

  1. Use json type format where possible
  2. Timestamp at the beginning to the microsecond and include a timezone
  3. Use unique identifiers
  4. Log more than errors, log everything
  5. Output to individual files as a buffer
  6. Categorize events with tags: Info, Warn, Error, Debug
  7. Try to keep events to 1 line (tough with above)
  8. Rotate olderlogs off your production machines

And there was a good list of possible sources for logs:

  • Applications
  • Databases
  • Network
  • Configuration FIles
  • Performance Data
  • Anything else with time component

Once you have all of that down then try setting up queues between services, or setting up automatic threshold triggers to warn of an impending issue.

For further reading see the splunk website. Meanwhile I have some work to do on my logs.
Logging best practices | Splunk.

Posted in Web Applications | Leave a comment

Prioritisation for small team management

The below diagram shows a traditional evaluation of priorities. Using something like the Covey method of 2×2 quadrant matrix, as in urgent vs important. The aim is to minimize the urgent and focus on the important, and optimally to end up primarily in zone 2. If done right this should leave you mostly doing work for things not yet on the agenda and being well ahead of the game, and being able to easily handle any emergencies that come up.

Priorities - Google Drawings

I often tell people the story of the zone 1 man meeting the zone 2 man. Zone 1 man says to zone 2, “help I have this emergency do you have any time.” Zone 2 sighs and looks up from his well planned activity, “yes of course, anything to help a friend.” Zone 1 says great, “well I need this thing done today otherwise the world will fall apart.” Zone 2 looks at the problem then leads zone 1 over to the wall and says “I understand your fear, this is obviously really important to you, I also have many important tasks that I must get done. Look at my wall, each of these items pinned to my wall is important now which one should I remove and instead work on your task?” Zone 1 stares in horror at all the order, then says “oh I see you are really busy, you should have said, I will find some one else to help with my problem.” Zone 1 then rushes off. Zone 2 sighs as he knows zone 1 will probably be back, many times. But zone 2 is not really busy he has a clear plan of work that he finishes by the end of the day, without stress. This is the state that every business person wishes for, a state of ‘flow’. Something that I am currently spending more time reading about and should definitely do a blog article on at some point in the future. Here are some examples of the urgent vs important tasks. The 1st item in each quadrant is what should optimally be considered. The 2nd item it what is usually included and a result of mismanagement.

Priorities - Google Drawings

Please note that most people never really do any quadrant 4 activities. They spend most of their time on the left hand side of the diagram. When the much healthier approach is to be bouncing up and down in the right hand side. Between indolence, contemplation, and simple completion of work on things that have not yet become urgent, and so by the time things come up they are already planned for and dealt with. In a future article I would like to add another layer to this model by considering it within the context of simple cognitive conditioning. That is to say if you have a carrot and a stick scenario how can one encourage oneself and those around us to move into an optimal state of existence.

Posted in Models of thinking | Comments Off on Prioritisation for small team management

Speed vs environment

Speed vs environment - Google Drawings

Simple diagram. Let me explain. When maintaining software in the real world there appears to be two key variables. Environment stability and patch speed capability. That is to say the likelihood of the customer requiring a change in functionality, vs the speed at which a team can implement a change. If you are developing an operating system the speed at which you can implement major change is limited often the cycle of patching and upgrading can take years. Where as in web development the change can often be implemented near instantly.

You will notice on the bottom left of the graph where there is a Chaos box. This is the natural state of much of the world until we as individuals train and learn and develop best practice. The environment stability is low, as in things are changing and have no idea what is even needed right now. Equally the patch speed is low. We have no tools, best practices, or common resources to utilise and create order and react to change.

On the far right is the area traditionally reserved for classical engineering and even older programming languages. To take it to the extreme might be something like the process for building a bridge. The environment and variables are unlikely to change during the many months over which the bridge is constructed so there is little need to constant change to the plan.

On the other extreme is agile based web development which has a very low enviroment stability because there is a lot of disagreement over the best practices especially when scaling. We have to choose between Ruby, Node, Python. We have to choose our frameworks, scaffolds, testing frameworks, best practices, PaaS, Queing libraries. And that was just on the back end. The only good news is that web development patching can be implemented extremely quickly. We can iterate fast, but only if the core foundations of our app or architecture allow constant implementation. That is why we must maintain modularity. Particularly the last principle of object oriented programming which is ‘dependency inversion principle’ which I will elaborate on in a later post.

In the middle of the diagram you will see native mobile development. This is because it has a moderately stable environment, although subject to the whims of a few multinationals, native development does have a clear set of best practices. On the other hand patch implementation is still a lot slower than web development. And it uses a pull rather than push model. That is to say that customers have to be incentivised to pull the latest update, and often people never pull the update and are left with an old version of the software which they quickly become tire of.

There are many ways to both increase environment stability and increase patch speed. In an optimal world, project managers, developers and engineers would be able to quickly identify problems, communicate them, solve them and implement them in a constant iterating loop that is nearly real time. The customer would never even notice a problem and have a completely intuitive experience.

Posted in Models of thinking, Web Applications | Comments Off on Speed vs environment

How can a server store user details and still be restful?

This is something that has perpetually confused me as I develop apps. A restful architecture obviously seems to be an optimal approach to building web based APIs. It limits the ajax function to 4 different CRUD calls (Get, post, Update, Delete). This allows much simpler interfacing. One method for each type of action. It uses a url for each group of calls.

But the requirement to keep the server stateless (as in it doesnt try to keep up with the client and keep a record of client state) always confused me. So many tutorials and code repositories seem to fudge this requirement in various ways.

Here is how I have finally solved it in my mind…

Why is it stateless?
The reason it is stateless in the first place to make scaling of the app much easier. If two server processes try to keep track of the same client and they get out of sync we have problems.

The solution
So the solution is for the server to issue a token hopefully with an expiry date, and store it in a really fast cache like redis. This way every request from the client contains the token which has enough information to confirm the identity of an existing relationship via the cached token credentials. But and this is the important part. In the eventuality of a server failure, or multiple servers serving the same client, the client identity can quickly be confirmed via the centrally cached token.

So there you have it. An API can be restful even when storing basic authenticated user identification in a central cache.

Original Thesis on Restful architecture
node.js – passport.js RESTful auth – Stack Overflow.

Update 7th March 2015
Upon reviewing this article I realised that my thinking has now evolved further. Based on some of the excellent answers here
http://stackoverflow.com/questions/14572600/passport-js-restful-auth

Specifically:

Instead of forcing clients to send username and password with every request you can have a “get_access_token” function in your RESTful service that takes the username and password and responds with a token, which is some sort of cryptographic hash that is unique and has some expiration date associated with it. These tokens are stored in the database with each user. Then the client sends the access token in subsequent requests. The access token will then be validated against the database instead of the username and password.

Whilst we could still replace with a redis cache for optimisation it is still paramount to understand that EVERY request from the client app (whether single page app or otherwise) needs to include auth credentials. These credentials may be a full username and password, or they may be just a current auth token.

Isn’t Storing a token in a database maintaining state on the server?
No because the database as a central datastore can be accessed from any concurrently working server operation. That is to say you can scale sideways to more servers without mucking up the server-client communication to any one particular client. No matter which server handles an individual api call it will still be able to authenticate that request correctly.

Posted in Musings and Reasons | Comments Off on How can a server store user details and still be restful?

How to include units in algebraic variables

So I ran across another chink in my mathematical understanding.

When applying units to algebraic variables I didn’t realise I did not have a complete grasp of the principles. Here is how I fell down.

When I apply the units to the variables I tried this…
[pmath size=03]K = {b*cm}/{{s^2}*{g/{cm^2}}}[/pmath]

But this works out wrong. It leads to this …
[pmath size=03]K = {{b}/{s^2}}*{{cm^3}/{g}}[/pmath]

When in fact an algebraic symbol is representative of both the coefficient value and the unit to which it is associated. So it should be interpreted as such (using 1 as a simple integer value for the measure of the units)…
[pmath size=03]K = {1*cm}/{({1}*{g/{cm^2}})^2}[/pmath]

And this leads to the correct evaluation of K’s units as such…
[pmath size=03]K = {1}*{{cm^3}/{g^2}}[/pmath]

So another week and another algebraic principle relearned. Who knows how much untold damage this simple error in my base assumptions has/could have caused for me?

(1) Figuring out units from formula | Working with units algebraically | Khan Academy.

Posted in Models of thinking | Comments Off on How to include units in algebraic variables