Alternate Day Fasting

I hate the impression of diets that they are something temporary, that will only last until the next imposition of rules, of giving up control to the latest diet guru and fad. Banana diets, paleo diets, Atkin’s… anecdotal evidence is oxymoronic (and sometimes you don’t even need the ‘oxy’)

What would be really nice is to have something that:

  1. is based directly on some scientific grounding (research on the whole diet not just one salient point)
  2. can be integrated into life so that it can be maintained long-term
  3. is simple to follow (e.g. doesn’t require a calculator or require you to check the phase of the moon before you can have a ham sandwich)
  4. has some tangible medical benefits besides weight loss

This excellent BBC documentary (video link) gave information on the first diet I’ve heard of that fulfils the criteria (at least for me!). I am now a Michael Mosley fan

Hold on, wouldn’t that encourage someone to overeat on the “off” days? Yes, but it turns out that it’s just not possible for people to eat more that 110% on the off days so the benefit is still there. Here’s the explanation from the main researcher, Dr. Krista Varady.

I’ve tried it for four days and so far the fasting has been easy to handle.

The documentary is really worth while to see (though be prepared to be a little depressed by the facts and opinions in the first part):

http://www.dailymotion.com/video/xvdbtt_eat-fast-live-longer-hd_shortfilms

Eat, Fast & Live Longer HD von limoslight

Posted in Body | Tagged , | 1 Comment

Divide and Conquer

Although there are many attractive facets to zen Buddhism and taoism, the line between the mental tools it offers and the religious paraphernalia. Buddhism is also prone to the magical thinking involved in professing faith in a peaceful philosophy, while simultaneously condoning violence.

Many explanations fall back to truisms that sound morose or deliberately melodramatic (“Life is suffering”). So it’s a welcome change to come across this wonderfully pragmatic approach from Shin-zen to describing the mental processes and potential involved (GoogleTechTalk).

He rules out nothing in removing the mystery from the mental discipline, including a “secular enlightenment”, if it gives more people the mental tools necessary to gain equanimity. The most appealing part of his talk is where he describes the enjoyment he gets because, as he says, he’s either doing something productive or getting a high from practising mental acrobatics while doing something simple.

Posted in Mind | Tagged , , | Leave a comment

Editing in Emacs

This post is a summary of built-in shortcuts. I keep learning bits and pieces so I thought I should list them all and compare them.

Movement

Key Action
C-n down line
C-p up line
C-f forward char
M-f forward word
C-M-f forward by expression
M-b back word
C-b back char
C-M-b backward by expression
C-a start of line
M-a start of sentence
C-e end of line
M-e end of sentence
M-m first non-blank on line
C-v scroll down a page
M-v scroll up a page
C-M-v scroll the other window down
C-M-S-v scroll the other window up
M-< start of buffer
M-> end of buffer
C-x h select entire buffer
C-M-d down in list
C-M-u up in list
M-g g goto line
M-} foward “element”
M-{ back “element”

Killing

Key Action
M-d delete word forward
M-BACKSPACE delete work backward
C-k kill from point ’til end of line

Yanking

Key Action
C-y yank last string
M-y iterate through yanked strings

Searching (isearch)

Key Action
C-s search forward
.. C-w add word after cursor (repeat C-w for more)
.. C-h C-h show isearch help
.. M-e edit search term
C-M-s regexp search forward
C-r search backward
C-M-r regexp search backward
M-s o list regexp occurrences in new window
M-s w fuzzy find
M-g M-n next entry in error/grep/occur list
M-g M-p prev entry in error/grep/occur list

Registers

Key Action
C-x r SPC store point in register
C-x r j jump to the point in the register

Bookmarks

Key Action
C-x r m save a named bookmark
C-x r b jump to a named bookmark
C-x r l save all bookmarks

Posted in Productivity | Tagged , | Leave a comment

MPlayer compilation in Cygwin

We bought some Di$ney DVDs for our kids in Japan. They like the stories but there are a couple of problems.

  1. We didn’t buy any DVD player after moving and I can’t find a DLNA server that will play direct from disk.
  2. The very considerate corporate drones in Di$ney have made sure that we have to sit through ridiculously long ads unless you select the “enhanced fast start” option on startup. (For “enhanced”, read “the normal format before greed took precedence over user convenience”)

So I’d like to copy our DVDs to my laptop and stream it to the TV via DLNA without ads when the kids want it. (I still find it incredible that I have to go to so much trouble to make something legal, usable?!)

I thought I’d try MPlayer because it’s popular, seems to have a lot of codecs available and it’s something different. Besides, I’m curious to see how much trouble it is to build something like this from cygwin.

Setup

  1. Install Cygwin
  2. Install alias for GNU Emacs in Windows
  3. Download the source and codecs for MPlayer
  4. tar --xvf in the cygwin terminal to extract the files

Configure

Just running ./configure produces some error messages. I’m missing the codecs (I’ve put them in a separate folder) and there are some core packages missing. In my case yasm is missing.

I selected yasm by running the cygwin setup again. Now the configure is running through but I suspect there are more libraries that I could find in cygwin.

I found that I need the --enable-gui option to get a GUI. I also need to use another command line arg: --codecsdir=DIR.

Compilation

Everything seems to work OK but there are a load of warnings. My first compilation doesn’t seem to see my DVD properly, so I recompile with the GUI option. I’ve downloaded the “Blue” skin so this has to go into the .mplayer/skins/Blue directory. Then I added skin=Blue to the .mplayer/config file.

‘Make’ succeeds and I get the correct output but without any gui?! What’s up with that? –> It seems that the gui must be run from the windows system. In the case of cygwin, that appears to be X11. Not to worry; the command line arguments seem relatively simple.

./mplayer DVD:\\1

The empire strikes back

Ah, but the soulless corporate giant has prevailed. Only the extras on the DVD are playable. The title for the film is unplayable. Mplayer borks almost immediately.

Time to download the latest version of VLC I think.

Conclusion

The integration of Win emacs and cygwin seems to work quite well, although I will have to change the shell to cygwin if I use it long term. The configuration was painless and the error messages obvious, even for someone who’s unfamiliar with the encoding libraries. All in all I was quite impressed.. despite the victory of corporate psychosis

Posted in Programming | Tagged , , | Leave a comment

Rat-race

“… and don’t forget that the output may only be correct if you cross reference the configurations”, Elton said in a tight voice, yet again interrupting Hilda mid-sentence. Johannes chimed in with a further comment. Hilda just grimaced slightly while looking at the podium. There were around 30 people in the room around me but I suspected that I wasn’t the only one who saw an undercurrent in the relationship between the presenters.

The presentation was intended as training for SW developers provided by our group. The three presenters, Johannes, Hilda and Elton, have been recently nominated as experts on the same topic. Johannes is the most experienced and has been involved in the original development. He’s normally very helpful but likes to work in an unstructured way. Hilda is clever and has picked up a remarkable amount of detail in a year or so of development. Unfortunately, she’s also not very pro-active. She demurs to Johannes on most all topics but probably more out of practicality than respect, and I can sense a lot of frustration building up underneath.

Elton is the upstart. He’s from a different group, younger than either of the other two. He’s also a foreigner but with pretty good language ability. He upset Johannes straight away by insisting on giving some structure to the overall area and trying to decide on priorities. He can also be prickly and his priorities are sometimes confused. Giving demonstrations he also seems to fall into the trap of presuming the explanation is clear because he understands it instead of thinking about how a beginner would understand it. All this adds up to a slight imbalance in his effectiveness but he actually shows more potential than Johannes in the long run if he gains more experience.

The end result is that the three engineers are competing for the same topic and against each other.

Today is the culmination of delicate negotiation. They agreed to share presentation of the latest training. Johannes mentioned to me that he has no time for Elton, Hilda told me that Johannes rewrote the material on the Sunday night before the training. Elton forced the usage of a particular tool in the presentation content. In total, it sounded more like the Mexican stand-off in reservoir dogs than a reasoned negotiation between professionals.

Part of this is the politics of the role. For engineers, who want to advance, there is a path to the dark side via management, or the possibility of promotion via an “Expert” rating. The organisation has been changed around a few times in the last few months so this particular death-match was not intended.

The training course started to run aground when Johannes started to correct the other two presenters mid-sentence. Not to be out-done, Elton returned the favour.

The end-result is Johannes is full of testosterone and quite cranky. Problem: I have to work with him on my current task and he’s like a demon….

Posted in Personal | Tagged | Leave a comment

The nice thing about Emacs is that every time I go looking I find some more built-in functionality that saves even more time…..

minor emacs wizardry

In my experience, dired is one of the most underused modes of Emacs. Just C-xC-f to any directory in your hard disk and you’ll be presented with a list of its files and directories. One can browse this list, and execute all kinds of commands and transformations on them. If you’ve never done that before, just give it a try, and look at the menubar for a list of nifty things you can do inside dired. There’re several ways to mark files and operate on them afterwards: for instance, just type A to find inside the selected files any regexp, or Q to search and substitute.

One of my favorites dired functionalities is wdired-change-to-wdired-mode. When you invoke this interactive function (using M-x wdired-change-to-wdired-mode), the dired buffer becomes editable. That is, you can go around and edit directly the filenames as you would edit any other emacs text buffer…

View original post 124 more words

Posted in Programming | Tagged , | Leave a comment

Effective Firefox Shortcuts

Jumping from one SW application to another can be frustrating if I’m in a hurry. The main problem is having to switch between keyboard and mouse. There are most definitely use-cases for mouse usage but for quick, effective actions, the keyboard and command line always prove more effective for me. I’ve noticed that a lot of the bottleneck comes from quick searches on our work intra-net or online-searches for additional information.

My favourite solution

  1. Install the DuckDuckGo search engine in firefox (right click the search and click “Manage”)
  2. go to the intra-net/internet pages that contain the searches you use most often
  3. For each of these pages, select the search field for the page, right-click the search field and select the “add a keyword” option from the context menu. This will add a firefox “smart keyword”.

Smart Keywords

I use the smallest memorable keyword possible e.g.

  • google search = “g”,
  • google image search = “gimg”
  • intra-net people search = “ppl”
  • intra-net wiki search = “iw”
  • stack exchange search = “stack”

A better search engine

DuckDuckGo presents a number of advantages for me.

  • it doesn’t monetise my personal information
  • it allows selection and movement through search results via keyboard shortcuts
  • it allows special keywords to restrict the search
  • there seems to be less rubbish included in the searches

Apart from the nifty java-script keyboard shortcuts, the main reason I love DuckDuckGo is because they provide the same sort of quality of results and clear interface that google search used to provide before it got turned into a bloated, GUI Frankenstein of instant searches and graphical previews where useful options are hidden behind menu picks (“cached pages” anyone? I guess that’s what happens when you poach Microsoft bloatware architects)

A decade and a half ago, I changed from AltaVista to google for similar reasons. I have a feeling of deja-vu, deja-vu, deja-vu…..

Use-Case

You’re working on a SW design or a piece of code. You have to look up:

  1. a contact name on the intra-net e.g. John Smith
    • Solution: <Alt-TAB> to Firefox then <Ctrl+t><Ctrl+l>ppl John Smith<Enter>

    This will open a new tab, switch to the location bar and search for “John Smith”

  2. related technical information on “Ethernet security”
    • Solution: <Ctrl+k>ethernet security<Enter> then j or k to move through the results, then <Ctrl+Enter> to open a page
  3. search for a sample code fragment for opening a socket on Stack Exchange
    • Solution: <Alt-TAB> to Firefox then <Ctrl+t><Ctrl+l>stack open socket<Enter>

What now?…

“So you’ve open one of the resulting pages, then it’s back to the mouse so what have time is really saved?”, I hear you ask. Well, actually firefox will allow you to navigate pages with the keyboard.

Key Action
<SPACE> Scroll down one page
<Shift+SPACE> Scroll up one page
<Ctrl+f> Search text
<‘> Search link text
<TAB> Move to next link
<Shift+TAB> Move to previous link

If you want to copy and paste text from pages then you can switch to “Caret Browsing” in Firefox with <F7>. Firefox will display a cursor on new pages that you can move and select with. Selection is possible in the same way as normal text-editors i.e. with the arrow and shift keys.

An abundance of shortcuts

There are lots more useful keyboard shortcuts in Firefox. Here are the ones that I get most utility from.

Key Action
<F7> Turn on Caret Browsing
<F6> Jump from Location bar to text or back again
<Ctrl+l> Jump to firefox Location bar
<Ctrl+k> Jump to the search bar
<Shift+F10> Open the context menu (when link) selected, or
open search engine menu when the search bar is selected
<Ctrl+b> open bookmark search tool-bar
<Ctrl+h> open history search tool-bar
<Ctrl+d> bookmark current page
<Ctrl+t> Open a new tab
<Ctrl+w> Close tab
<Ctrl+Shift+w> Reopen closed tab
<Ctrl+TAB> Move to next Firefox tab
<Ctrl+Shift+TAB> Move to previous Firefox tab
<Ctrl+9> Move to the right-most Firefox tab

Mouse vs. Keyboard

Compared to mouse based actions for the same searches, the time I personally take is dramatically reduced. Obviously this depends on your normal usage of a browser and how comfortable you are with the keyboard. For me, it’s a super combination.

Posted in Productivity | Tagged , , , | Leave a comment

Xah Emacs tutorial

In order to gain at least minimal understanding of the emacs debug messages, I need some information on Lisp. I’ve read that the notation is similar to that which I’ve seen used in calculators (Reverse Polish Notation). The difference is that the operand seems to be at the start instead of the end of the sequence.

Sure enough firing up Wikipedia shows that Polish Notation exists and the article even mentions lisp.

I came across a neatly laid out tutorial that I’m going to try to work through over the next few days. My notes from the first part are below for my benefit. Take a look at the original page for the real goodies.

I’m not sure if there are differences in the elisp syntax for this variant of Emacs, but the tutorial appeals to me. It’s orderly and easy to read, with examples for everything.

Notes

  • operators before arguments within brackets e.g. (fun arg1 arg2)
  • print something in the message buffer (message formatstring args...)
  • use the following command to evaluate expressions C-x C-e or ielm (the interactive command line)
  • expt = exponential
  • function name ending in p = predicate = return = t or nil
  • only nil and () are false; everything else returns true
  • not equal operator : /= (for numbers only)
  • comparison functions:
    • string-equal
    • equal : statues mismatch also results in nil
    • to set global variable use (setq var1 val1 var2 val2 ...)
    • to set local variable use:
      • ((let var1 var2) (setq var1))
      • (let ((var1 val1) (var2 val2)) (...))
    • (if ‹test› ‹true body› ‹false body›)
    • group a block of expressions with (progn (exp1) (exp2))
    • (while ‹test› ‹body›)
    • no for loop exists in elisp syntax
    • (defun ‹function name› (‹param1› ‹param2› …) "‹doc string›" ‹body›)
      • add (interactive) after the doc string to make the function available with <M-x> <function name>
      • interactive has up to 30 args. Most useful as follows:
        • (interactive "r") passes current text selection begin/end position as arguments
        • (interactive "n") number prompt e.g. (interactive "nWhat is your age?")
        • (interactive "s") prompt user for a string as argument.

Posted in Programming | Tagged , , | Leave a comment

Argh… Emacs/Win7 and Perl …

I’ve recently converted to using Emacs in work and home. I like the idea of the extensibility and of all the preloaded packages. Unfortunately, it has a steep learning curve when trying to configure the details. I’m still impressed but it can be a little challenging to get info on Win7 usage.

I’ve found lots of information from EmacsWiki and an exemplary blog called Emacs-fu. I’m actually pretty happy with the basic set-up but I did decide to install the latest version of orgmode and org2blog. I also installed built and installed w3m in order to read html mail through the built in gnus package. At this point I was feeling very self-satisfied and convinced that I was ready to begin programming.

I thought I would start with something simple….

Perls of wisdom

I use perl a lot on the job. As a rough but powerful tool, nothing beats it. I have never used Emacs with perl except as an editor and I didn’t want to spend too much time on the task of customization until I get a feel for what’s possible The following lisp function on perlmonks gave me a start. It starts the perl syntax check in a separate buffer with the error messages… very neat.

The rocky road to enlightenment

I had problems with Perl syntax checking. I was getting locale warnings but soon found some useful input on Stack Exchange. After setting LC_ALL (to de_DE in my case), the warnings disappeared

Execution is everything

Ok, so now I’m able to check the syntax but what about running. Both M-! and M-x shell allow me to call the perl interpreter but when I call a script it freezes the buffer. Keys are echoed but I get nothing useful back…. Very annoying. Another look at the stack exchange entry provides the answer. NUL is required. But why?

Open points…

I tried to figure this out in 30 min and it wasn’t enough. The M-x compile function has the same problem as shell and eshell. I also want to find out how to get the errors parsed so that the next error function works with the interpreter output. I’m going to leave that for another time.

Update 2013-01-27 So

I found a reference on how to run the perl debugger here. ‘M-x perldb’ prompts for input with Run perl like this: perl -d <script name>. It opens a new buffer for the output and shows a cursor mark on the original script to show the current line of execution. It’s also possible to remove the -d flag to capture script output but it’s definitely a kludge.

Posted in Programming | Tagged , , , , | Leave a comment

The other side has another side…


裏には裏がある


人の世は複雑に入り組んでおり、ものごとには隠された裏面があるということ。そういうことを理解して対応せよとの教え。- link

I’ve worked in a number of countries but sometimes I still forget that everyone lives by different rules.

The I in Team

Dieter says you don’t want to work and that you’re only in the office a few hours a day“.

The chunk of pork slid from my fork, then splattered greasy sauce from my plate. My boss smirked.

Don’t worry, if I really thought there was a problem then we wouldn’t be having this conversation in the canteen. But you should understand what’s going on

Since being back from holidays I had been reducing the 70 hours overtime I’d built up from 2012 before the project restarted again in earnest. Both Dieter and my boss knew.

The A-team

In my own country and also in Japan, the personal connection between people forms the basis of how you work. Not so much favours for friends, rather that you go an extra step to help those who help you. For the others, you do your job but not theirs. For me, that’s just good teamwork and it’s all positive. Everybody gets what I should deliver but the staff that go an extra step for me get that extra step back when they need it.

That also means that those same people have to be a bit more honest with each-other. No BS, and an open conversation are sometimes more effective than the best project planning.

The beginning of the end

In Germany, the people I work with are motivated, interested in their jobs and generally a lot of fun. Unfortunately, like all organisations there are conflicts. I’ve been lucky enough to avoid it until recently.

Now, thanks to some reorganisation, I have to hand-over a difficult task to Dieter’s group. The group is made up of my old colleagues but Dieter is only a manager since January. In his previous role he was capable, pleasant and is good at scheduling/tracking. However, he has made his name by being hard on his own group and nice to the project managers. He also lacked an interest in people on his own team. He depends on, and champions, one or two strong players and leaves the others languish. It’s a weakness that didn’t matter so much as project/team leader but seems naive in a manager.

Normally, that wouldn’t bother me but he is reassigning work that I am responsible for. That should be good news, but he wants to leave me ambiguously responsible and let others control the work. This leaves me in a difficult position. I see there are going to be problems and those who’ve taken over are new to the role and Dieter has planned no co-ordination between them. When I talk to him about the risks, he doesn’t want to take any decisions because he doesn’t want to be pinned down. The end result is that we are late with everything, I have no idea what Dieter has promised the project managers and nobody knows what’s going on. Dieter can happily point to me at the end and say he and his group are blameless.

Such situations are common and I’ve dealt with them before. My approach is to document the progress, send it to him with a request for a decision, and try to talk to the others to co-ordinate what we know about i.e. do your best and document the lack of leadership in case finger-pointing starts.

Dieter has responded by trying to make sure that I am still responsible on paper but my boss knows the situation and is cool about it.

Hulk-out

Maurice can I have a word?” Dieter loomed over me with a fake smile.

About the scheduling?“, I asked with the feeble hope I had dying as I saw his expression.

About the assignments; I heard you had agreed a work-split with Johannes“. Johannes stood smiling sheepishly to one-side.

Actually I don’t see that everything is clear. In fact, I’d appreciate some decisions on the following items” …. cue green tinge to skin and bursting of fabric

So what’s the point?

In this case, one of Dieter’s champions is a colleague that I’ve been very friendly with. Johannes’s a nice guy and an experienced engineer. He’s been assigned to my former task as co-ordinator and needs as much help as he can get, but the development plan is all Dieter’s; it’s ill considered and I know it will fail.

Johannes seemed worried and annoyed when he realised how difficult the planning is so I let him know that I would unofficially support him in whatever he needed, but because I could not accept the official assignment without Dieter, I didn’t want to wait for him to talk to my manager. (I expected him to avoid doing so as his goal seemed to be to avoid that) Johannes and I agreed the technical content and that was that… or so I thought.

Based on our previous relationship, I had started to think of him in terms of my own culture. The conversation would remain confidential because our working relationship and the practical result would be more important to an engineer. What I failed to remember is that people have a far higher impulse to follow the rules in Germany, regardless of consequence. This is only my interpretation. From Johannes’s point of view, everything was not officially decided and that is not correct. If it’s not correct then he must talk to his manager… and then Dieter has more info to leverage

The end result was being called aside by Dieter (of course without my own manager being present), and me losing my temper. My own boss is now annoyed that I wouldn’t let sleeping dogs lie, my relationship with Johannes is strained and I have gained no advantage.

Pointing fingers…

People seem not to see that their opinion of the world is also a confession of character.” – Emerson

Who’s to blame? Dieter for being a political animal and a poor leader? Johannes for acting on his need for official approval.

In retrospect, I can see the problem was my unreasonable expectation that Johannes behave according to my own cultural conventions. This is a lesson I learnt the hard way in Japan but Germany is culturally closer than Japan so I fell into the trap again. I was also operating on my impulse for clarity, but in my case, it was clarity based on the working relationship and not on official approval.

Silence is golden

I could have left Johannes alone and simply put my own plan into action. It would have shown him that I was willing to support him as usual. He didn’t see the risk anyway so there was no need to require that he forgo official approval from Dieter. I expected the conversation to remain confidential when I asked Johannes to keep it so. From his point of view, that was asking him not to do his job.

My lesson from the day: do more, say less…. Not so easy when you’re frustrated

Posted in Personal | Tagged , , | Leave a comment