Didn’t note in enough detail the unplanned tasks that I had to tackle last week. Am planning this week to note down the things which sidetrack me from the main goals.

Last week:

Work

  • [X] Support major customer project
  • [-] Development work on 2 other projects
  • [-] Stay in touch prospective clients/leads
  • [-] Kick off charity project
  • [-] Expedite tasks that are currently “WAITING”
  • [X] Clean up customer/supplier records on CRM tool
  • [-] Set up virtual machines
  • [ ] Create additional web forms to service other business areas

Life

  • [ ] Tax return
  • [-] Practice Siu Lim Tao and stretching
  • [X] Clean house

Misc

  • [X] Finish FLAC’ing CD collection
  • [-] Learn GnuCash

This Week

Work

  • [-] Development work on 2 customer projects
  • [-] Stay in touch prospective clients/leads
  • [ ] Get list together of targets for Project “L” and plan launch
  • [ ] Review charity project costings: is there a more cost-effective approach?
  • [ ] [Arrange to] visit datacenter for scheduled maintenance – the machines, not me 🙂
  • [ ] Create additional web forms to service other business areas
  • [ ] Minor company homepage change
  • [ ] Review structure of site and content; trim.
  • [ ] Complete SVN/Bugzilla integration project.
  • [ ] Complete new cashflow tool.

Life

  • [ ] Tax return
  • [-] Practice Siu Lim Tao and stretching
  • [ ] Clean house
  • [ ] Try to get a bit of Family Guy in

Misc

  • [ ] Decide on Slovakia trip
  • [-] Learn GnuCash
  • [-] A few more CDs to add to the collection

Summary:

Last week was a bit short, as I went on my little surf expedition early Thursday afternoon. So I’ll forgive myself for not putting X’s in all the boxes.

From last week:

Work

  • [-] Stay in touch prospective clients
  • [-] Kick off charity project
  • [-] Expedite tasks that are currently “WAITING”
  • [X] Complete 2nd quarter accounts
  • [ ] Clean up customer/supplier records on CRM tool
  • [ ] Set up virtual machines
  • [ ] Create additional web forms to service other business areas

Life

  • [ ] Tax return
  • [X] Light grocery shop
  • [ ] Practice Siu Lim Tao and stretching
  • [X] Surf trip
  • [X] Clean house

Misc

  • [ ] Finish FLAC’ing CD collection
  • [ ] Learn GnuCash

This week:

Work

  • [ ] Support major customer project
  • [ ] Development work on 2 other projects
  • [-] Stay in touch prospective clients/leads
  • [-] Kick off charity project
  • [-] Expedite tasks that are currently “WAITING”
  • [ ] Clean up customer/supplier records on CRM tool
  • [ ] Set up virtual machines
  • [ ] Create additional web forms to service other business areas

Life

  • [ ] Tax return
  • [ ] Practice Siu Lim Tao and stretching
  • [ ] Clean house

Misc

  • [ ] Finish FLAC’ing CD collection
  • [ ] Learn GnuCash

Inspired by a well-known figure online, I have decided to imitate her style with a weekly [p]review blog. It is a review of the previous week, and a preview of the coming week. I will try to capture tasks that I want to see complete plus the unexpected events that everyone gets in a typical week.

From last week:

This is my first weekly review, so there’s nothing to see here yet!

This week:

Work

  • [ ] Stay in touch prospective clients
  • [ ] Kick off charity project
  • [ ] Expedite tasks that are currently “WAITING”
  • [ ] Complete 2nd quarter accounts
  • [ ] Clean up customer/supplier records on CRM tool
  • [ ] Set up virtual machines
  • [ ] Create additional web forms to service other business areas

Life

  • [ ] Tax return
  • [ ] Light grocery shop
  • [ ] Practice Siu Lim Tao and stretching
  • [ ] Surf trip
  • [ ] Clean house

Misc

  • [ ] Finish FLAC’ing CD collection
  • [ ] Learn GnuCash

I recently ‘dented’ (tweeted on identi.ca) a question to a group of software developers: what music do they listen to that is conducive to coding?I received a variety of answers, with just as wide-ranging tastes as you could expect, really. Clearly, I hadn’t conducted a very economic experiment. Perhaps I was asking the wrong question.

The question I should have asked is this: which music do you listen to that evokes a calm, creative and logical state of mind? In other words, I needed to key-word the question to (a) elicit greater impact on the reader and (b) give the question more scope, more context.

The premise of the question is the science behind brainwaves. Apparently, alpha waves in the brain (those which occur at between 8-13Hz [cycles per second]) are the most conducive to creative AND logical thinking. It is commonly associated with a meditative state of mind, deeply relaxed, daydreaming, fantasizing and creatively visualising various scenarios.

This dispels some notion that left brain/right brain dominance exists. I can’t remember which is which, but it is said that the right hemisphere is more creative and the left, more logical/analytical. Or vice versa.

But this alpha wave state could, in fact, also support such dominance, if it allowed for the idea of submission of the dominant region during periods of relaxation. In other words, we will have one personality profile when active, busy, even stressed, and another profile when relaxed, calm, clear.

It follows, then, the people seeking to produce creative works – whether it be software code, writing, visual art or music, should always seek the best environment to create alpha brain waves. Music is just one component; meditation, light scents, lighting, physical comfort and staying hydrated also contribute, as does the avoidance of caffiene and alcohol.

But for me, most of all, it’s music.  And quite often, that’s trance. 😉

The full title of this blog should really be ‘SELinux is preventing mysqld (mysqld_t) “search” to ./tmp (public_content_rw_t)’ as that is the problem I’ve been having with CentOS recently (and hence my searches on the web for a solution).
The cause of the problem
I use SugarCRM for customer and project management data – and very good it is too! (Gratuitous plug – I can help your company install and use this fine software :-) ). Except that recently, when listing my Accounts within Sugar, I would not see all of the account context. Only the account data itself would be displayed and none of the subpanels/links. The query to retrieve more data was failing, with this error message displayed in the browser window:
mysqld: Can't create/write to file '/tmp/#08y2jw' (Errcode: 13)
In my system log (/var/log/messages), I also got multiple SELinux errors like this:
Oct 13 09:07:50 server setroubleshoot: SELinux is preventing mysqld (mysqld_t) "read" to ./tmp (public_content_rw_t). For complete SELinux messages. run sealert -l 1762c478-f3a2-4eeb-be09-bd3dc037d945
Clearly, the reason for “Errcode: 13″ was due to SELinux.
Incidentally. if you have seen a similar error on your web site, but with (Errcode: 28) instead, this is likely due to shortage of disk space. A great way of determining operating system errors like this, is to use ‘PError’, thus:
# perror 28
OS error code 28: No space left on device

# perror 13
OS error code 13: Permission denied

So there we are – two distinct and different issues.
With SELinux, resolving the permission issue can be difficult. By issuing # sealert -l 1762c478-f3a2-4eeb-be09-bd3dc037d945, as suggested above, I got the following output (trimmed and highlighted for clarity):

Summary:
SELinux is preventing mysqld (mysqld_t) “search” to ./tmp (public_content_rw_t).
Allowing Access:
Sometimes labeling problems can cause SELinux denials. You could try to restore
the default system file context for ./tmp,
restorecon -v ‘./tmp’
Additional Information:
Source Context root:system_r:mysqld_t
Target Context system_u:object_r:public_content_rw_t

First things first: issuing # restorecon -v './tmp' didn’t fix it for me. I was also surprised to see that the path to /tmp was relative to the current working directory, so I tried a slightly modified # restorecon -v '/tmp', but to no avail. After restarting mysqld, the problem persisted: MySQL was simply being refused access to /tmp. Somewhere, a policy is disallowing this.
It’s a mistake to assume the the source context and target context should be the same; they don’t have to be, as it’s entirely policy-driven.  I made bold those aspects (the file Type) above to highlight this incorrect assumption (that I previously held).
Find and fix a policy?
Although finding the troublesome policy and analysing it is a Good Thing, it’s also time-consuming and requires significant knowledge of SELinux, chiefly to avoid creating security holes. A better way, I found, was simply to relocate where mysqld tries to store temporary data.
Thanks to Surachart Opun’s blog, I learned that you can specify a new location for temporary files. In /etc/my.cnf, add or edit the following:
[mysqld]
tmpdir=/tmp # # e.g.
tmpdir=/var/lib/mysql/tmp

Now do the legwork to set up the directory properly:
First, create directory with appropriate permissions
# cd /var/lib/mysql
# mkdir tmp
# chown mysql:mysql tmp
# chmod 1750 tmp

Now set the SELinux context up:
# chcon --reference /var/lib/mysql tmp
and make the SELinuiux context permanent:
# semanage fcontext -a -t mysql_db_t "/var/lib/mysql/tmp(/.*)?"
Finally, restart mysql:

SugarCRM – Open Source CRM system

# service mysqld restart
Closing thoughts: optimisation
The methods above fixed the particular problem I was having. They didn’t, however, actually pinpoint the cause. This is one of the good things about Linux and SELinux in particular: you are forced to rethink what the system is doing and work out a solution that sits within the predefined security context – or learn how to write SELinux policies. Personally, I prefer the former ;-)
There is an additional benefit to the solution above – namely, optimisation. Because we have specified the security context with semanage, we are free to mount an external file system and use that instead for MySQL’s temporary files. In other words, we can maintain the security but increase the performance.  One such filesystem could be tmpfs. tmpfs is actually a RAM Disk, uses a fixed amount of RAM to provide file storage. It is much quicker than an on-disk filesystem and thus perfectly optimised for storing temporary, caching data. There are many resources about tmpfs on the web. A good introduction to tmpfs can be at Planet Admon.

Having installed CentOS (wikipedia) on a server here, I was surprised to find that, by default, the source repositories were not enabled.
Below are the source repo definitions I use.  Simply create a file called “Centos-Source.repo” (# chmod 644) in /etc/yum.repos.d/ and enable repositories as required (using enabled=1).  Please note that this example is for CentOS version 5 and may differ from any official versions out there.  I offer no warranty… it just works for me.  ;-)

[base-SRPMS]
name=CentOS-$releasever – Base SRPMS
baseurl=http://mirror.centos.org/centos/$releasever/os/SRPMS/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=1
enabled=1
#released updates
[update-SRPMS]
name=CentOS-$releasever – Updates SRPMS
baseurl=http://mirror.centos.org/centos/$releasever/updates/SRPMS/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=1
enabled=1
#packages used/produced in the build but not released
[addons-SRPMS]
name=CentOS-$releasever – Addons SRPMS
baseurl=http://mirror.centos.org/centos/$releasever/addons/SRPMS/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=1
enabled=0
#additional packages that may be useful
[extras-SRPMS]
name=CentOS-$releasever – Extras SRPMS
baseurl=http://mirror.centos.org/centos/$releasever/extras/SRPMS/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=1
enabled=0
#additional packages that extend functionality of existing packages
[centosplus-SRPMS]
name=CentOS-$releasever – Plus SRPMS
baseurl=http://mirror.centos.org/centos/$releasever/centosplus/SRPMS/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=1
#contrib – packages by Centos Users
[contrib-SRPMS]
name=CentOS-$releasever – Contrib SRPMS
baseurl=http://mirror.centos.org/centos/$releasever/contrib/SRPMS/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=1

Some time ago, mainly because my then-girlfriend bought me 3 Hacky Sacks (or ‘juggling balls‘, as they seem to be known these days), I took it upon myself to learn how to juggle.
An image of three juggling balls

The learning process is actually quite simple.  This is the method I have used:

  1. With two in one hand (e.g. left) and one in the other, throw up one (of the two) first and simply catch it with the other hand.
  2. Then, repeat but throw back from the right to the left.

    Completing just this first step is the key to learning how to juggle. 

    Continue to practice this method, tossing the sack from one to the other hand.  When you can always catch it, try the next step:

  3. When the ball is up in the air, throw the opposite ball up too.  The best time to throw it is just before the first ball reaches the parabolic peak (the top of the arc of travel).   Now that your second hand is free, catch the first ball.
  4. If you can, try to catch the second ball as well, using your first hand – just as you have already practised.

    Once you have got this far, you are well on the way to becoming an expert! 😉

  5. It goes without saying that, to improve, you need to throw the third ball into the air before catching either the first, or the second.

The paradox

This is the secret to success.  In order to successfully catch, time after time, you must successfully throw.  In other words, to hold on, you have to let go.

Perhaps it can be best summarised with a quote from Star Wars.  When Princess Leia is speaking to Governer Tarkin, shortly before he destroys the planet of Dantooine, she says (paraphrased), “the more you tighten your grip, the more will slip through your fingers”.

Today is Document Freedom Day. To celebrate, many of us open source netizens are doing the right thing and rejecting email attachments sent in proprietary formats, such as Microsoft Word, Excel and Access – 95, 97-2003 and so on.

The campaign is quite simple: refuse locked-in file formats.

The Free Software Foundation has provided some interesting examples of “polite” rejections to send to people who have emailed an attachment with a proprietary file format.

It’s a difficult thing, to tell someone that you are rejecting their attachment through choice.  You fear that it comes across as being awkward.  Breaking the social “norm” and standing for something you believe in is rarely painless.

There are ways to deal with this though, and the best way is probably humour.  It’s a serious message, yes, but that doesn’t mean it has to be all haughty overtones and morally correct principles shoved in people’s faces.  Making it funny will make it stick just as well.

Here are a few of my suggestions for handling your email rejections with a bit of added spice.  It’s a safe assumption that your friend uses Microsoft Office, so you could include this link at the end (http://www.sun.com/software/star/odf_plugin/get.jsp):

  • “Thanks for your email attachment.  Unfortunately, my dog ate it. He likes anything that is completely unpalatable, especially proprietary file formats.  He doesn’t seem bothered at all with open standards formats like the ODF, though.  Could you re-send your file using that format please? “

 

  • “Thanks for the document.  Sadly, we do not use proprietary file formats any more as the internet has brought about a revolution in open document format usage.  It happened so quickly that no-one noticed!! Please could you re-send your file in Open Document Format (ODF)?..”
  • “Thanks for the information. Regrettably, I am unable to open this format of document because I have become enlightened.  In my new karmic state, I only desire peace and harmony, and closed-off formats disrupt my inner sanctum.  Please could you re-send this file in natural, organic and eco-friendly Open Document Format?”

 

And of course, you MUST MUST MUST include a link to the Document Freedom Day web site, or to the Free Software Foundation, or to the Electronic Frontier Foundation, or to the Open Rights Group, or …

Links:

Thanks for watching!

In every day life, I come across a number of things that I find extremely useful.  Instead of clogging up my browser’s bookmarks, I’ll list there here for my reference.

I hope they might be of use to you too!

Programming

  • PHP
  • Flex
  • There is one thing I want from Org-mode more than anything: the ability to record the time I spend on various activities – even unplanned ones – and then see a summary of this time at the end of the week.

    Luckily, this is actually really simple.  I won’t go through the details of how to install or set-up Org-mode; that information is easy to read through at its rightful place.  Instead, it’s the key time-recording feature which I’ll briefly touch on here.

    How to start:

    1. Open up Emacs (not got Emacs? See the GNU web site or download it straight from the GNU FTP site)
    2. Start Org-mode by opening a .org file:

       C-x C-f  ~/org/work.org

    3. Start the clock on any item:

       C-c C-x C-i

    4. Leave it running for a minute or two and then stop the clock:

       C-c C-x C-o

    5. Now go into Agenda view:

       C-c a a

    6. When in Agenda view (commonly this opens in a second frame), just hit R:

       R

    Et voila! You should be able to see a summary of the time you have booked on your activities.