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):

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.

Video | Posted on by | 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

denki0tokage:

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

Originally posted on 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 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