15 February 2012

66. Minor bug: evolution 3.2.2 crashes, google chrome sync going crazy on debian testing

Symptom:

  • Evolution 3.2.2 crashes every few minutes -- presumably on retrieving new mail every ten minutes
  • Evolution uses 150% of your resources and becomes unresponsive if you try to recover messages lost in the crash
  • If you sync your Chrome/Chromium browser with google, you get a warning triangle saying that sync failed. On trying to log in again the log-in window keeps disappearing

Logging evolution using CAMEL_DEBUG=all evolution >&evo.log gives
(evolution:8112): evolution-mail-CRITICAL **: e_mail_folder_uri_from_folder: assertion `CAMEL_IS_FOLDER (folder)' failed
**
GLib-GIO:ERROR:/tmp/buildd/glib2.0-2.30.2/./gio/gdbusmessage.c:1986:append_value_to_blob: assertion failed: (g_utf8_validate (v, -1, &end) && (end == v + len))
[imapx:F] adding command, fmt = 'IDLE'
[imapx:F] completing command buffer is [4] 'IDLE'
[imapx:F] Starting command (active=1, literal) F00104 IDLE
[imapx:F] camel_imapx_write: 'F00104 IDLE
'
[imapx:F] camel_imapx_read: buffer is '+ idling
'
[imapx:F] token '+'
[imapx:F] token TOKEN 'idling'
[imapx:F] token '
'
[imapx:F] Got continuation response for IDLE
[imapx:F] ** Starting next command
[imapx:F] * no, no jobs
Here's the log from another crash:

(evolution:19158): evolution-mail-CRITICAL **: e_mail_folder_uri_from_folder: assertion `CAMEL_IS_FOLDER (folder)' failed
(evolution:19158): GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed
(evolution:19158): evolution-mail-CRITICAL **: e_mail_folder_uri_from_folder: assertion `CAMEL_IS_FOLDER (folder)' failed
**

GLib-GIO:ERROR:/tmp/buildd/glib2.0-2.30.2/./gio/gdbusmessage.c:1986:append_value_to_blob: assertion failed: (g_utf8_validate (v, -1, &end) && (end == v + len))
Followed by instant Evolution disappearance

If I start evolution and disable all gmail related accounts, it stays stable. If I enable our university gmail-hosted account it crashes --

Icedove/thunderbird is not crashing.

The whole thing seems to be a combination of weird Google stuff and Evolution behaviour.


Solution - sort of:  
I solved the google chrome issue by signing out/disabling sync, then re-enabling again. I also removed my Online Accounts in gnome, then added them again.
I also installed libnss3-tools due to some errors chrome was throwing up, but it's probably unrelated.
Evolution was still unhappy though. I did the 'windows' thing and rebooted -- evolution crashed after about twenty minutes. After starting evolution again it ran without a hickup for 8 hours before I shut my system down.

65. LaTeX for 2013 ARC proposals

If you're in the limbo where you're not quite expert enough with LaTeX, but have happily said goodbye to MS Office, and you're an Australia scientist who annually has to fight the endless bureaucracy of the Australian Research Council (seriously -- 10 page limit about the science, followed by 70 pages about personal qualities?) you may find that you're in for a lot of grief.

If you collaborate with other people you will have to settle for a file format everyone can deal with ('everyone' except linux users), which is likely to be Word run in a virtual environment. If you're writing by yourself or together with more computer-savvy colleagues you will get away with using LaTeX for a fair number of the sections, while using gEdit for others.

I'm presuming that you will create a separate .tex file for each section.

The rules (http://www.arc.gov.au/ncgp/dp/dp_instructions.htm) says that you need

  • Black type
  • Single column
  • A4
  • 0.5 cm margin on all sides (top, bottom, right, left)
  • A 'highly legible font', preferably 12 pt Times New Roman


Also, reading between the lines, you shouldn't/needn't include page numbers since this will be generated by the RMS.

\usepackage{nopageno}

with \pagestyle{plain} just after \begin{document} may do the trick.


Black type and single column are defaults in LaTeX, so need no action. Everything below goes into the preamble.

For A4 and 12 point font, set that in the documentclass

\documentclass[12pt,a4paper]{article}\usepackage[latin1]{inputenc}\usepackage{amsmath}\usepackage{amsfonts}\usepackage{amssymb}\usepackage{mhchem}


For 0.5 cm margins on all sides 

\usepackage[margin=0.5cm]{geometry}
Additional for all sections:

\setlength\parindent{0pt} %no indent on first paragraph \usepackage{fullpage} % an alternative if you don't need 0.5 cm margins \author{} %we don't want author\date{} %we don't want date\begin{document}

Part C, section C1 Here you have several sections, such as AIMS AND BACKGROUND, RESEARCH PROJECT etc. To make sure that these DO NOT get numbered, use
\seccounter{secnumbdepth}{0}

Since the references are a separate document, set
\documentclass[10pt,a4paper]{article}
Part D is filled out online.

Part E, while a pain to write, uses regular 12 pt Times New Roman. If you don't want section numbering, use {secnumbdepth}{0}. If you want your sections to look like this
E1. Justification....
E2. Details of non-ARC contributions

Use
\seccounter{secnumbdepth}{1}\def\thesection{E\arabic{section}.}
As usual, this goes into the preamble, not the body. You should -- ideally -- never have to change the way you write. All changes should go into the documentclass style file or preamble.


Part F. Oh how we curse you.

F13.1 should be easy enough -- you can even skip sections and just use \title{F13.1. Justification} together with a \maketitle right after \begin{document}. Or you can use
\def\thesection{F13.\arabic{section.}


F14.2 offers potential for fun:
\setcounter{secnumdepth}{4}
\def\thesection{F14.2.\arabic{section}.}
\def\thesubsection{\alph{subsection})}
\title{F14.2 Recent significant publications (since 2007)}


This way if you put the following in the body:
\maketitle
\section{Research publications}
\subsection{Scholarly books}
\subsection{Scholarly book chapters}

you get
F14.2 Recent significant publications (since 2007) F14.2.1. Research publications a) Scholarly books b) Scholarly book chapters

For your reference list you may use 
25.* Blow, Joe; Doe, John; \textbf{Hill, Vera}. \emph{One page derivation of the GUT}, Phys. Rev., \textbf{2012}, \emph{108(3)}, 234-235 \\
For F14.3 use
\def\thesection{F\arabic{section}.} \def\thesubsection{14.\arabic{subsection}}
without \maketitle but with 
\subsection{Ten career-best publications}
in the body
G1 is difficult in latex if you want to do it properly. I gave up and used libreoffice for this one since I couldn't figure out how 
Put this in the preamble
\usepackage{rotating} %rotate text in narrow tables...\usepackage{array} % for vertical centering in tables...hacky...
and this in the body:
\section{Research support for Vera Hill}
\begin{table}[h]
 \begin{tabular}{b{4cm} p{0.5cm} p{0.5cm} l c  c c c c}
\textbf{ Description} & \begin{sideways}Same Research area \end{sideways}  &  \begin{sideways}Support type \end{sideways}& ARC Project ID & 2010 (k\$) & 2011 (k\$) & 2012 (k\$) & 2013 (k\$) & 2014 (k\$) \\
 \hline
 "Unifying general relativity with quantum mechanics" & N & C  & DP100202921 & 120 & 190 & 180 & 170 & 120 \\
 \hline
 \end{tabular}
\end{table}

It doesn't look quite right. You may also want to try e.g. m{0.5cm} for the rotated header captions The remaining sections should be fairly straightforward, formatting-wise. Ultimately, the ARC application process is one of the most ridiculous one I've had the misfortune to be subjected to.

13 February 2012

64. Two network cards on the same network, splitting traffic

Some thoughts on using two LAN network cards: While it sounds instinctively neat, the main issue here is to decide how it should actually work i.e. where is what traffic going.

One idea is send traffic to one subset (e.g. 192.168.1.1-100) of IP addresses via one card, and another subset (e.g. 192.168.1.101-255) to another.

This isn't a job for a firewall (other than to restrict/allow traffic) but a situation where you use routing.

Some background
To see your routing table, run
sudo route 
(or sudo route -n if you want to resolve names)

Here's the routing table of the gateway in this post where eth0 is connected to the Outside World, and eth1 is connected (and acting as the gateway of) a subnet of 192.168.0.-255:

Kernel IP routing table
Destination     Gateway            Genmask   Flags Metric Ref    Use Iface
default             xxx.xxx.xx7.254    0.0.0.0           UG     0        0        0    eth0
xxx.xxx.xx0.0     *                      255.255.248.0   U     0         0        0    eth0
link-local            *                      255.255.0.0       U     1000   0        0    eth1
192.168.1.0       *                      255.255.255.0   U     0         0        0    eth1

It says:
Route everything by default to the gw at xxx.xxx.xx7.254,
unless the target is in network xxx.xxx.xx0.0-255 or
unless the target is in 169.254.0.0 - 169.254.255.255 (link-local is 169.254.0.0) or
unless the target is in 192.168.1.0-255

Here's the routing table of a box with a single card attached to the LAN:

Kernel IP routing table
Destination     Gateway              Genmask   lags Metric Ref    Use Iface
default          192.168.1.1             0.0.0.0          UG    0      0        0 eth0
192.168.1.0     *                    255.255.255.0      U     0      0       0 eth0

Finally, here's the routing table of a box with two cards connected to different LANs:

Kernel IP routing table
Destination     Gateway             Genmask         Flags Metric Ref    Use Iface
default         192.168.2.1            0.0.0.0         UG     0      0        0 eth3
default         192.168.1.1            0.0.0.0         UG     0      0        0 eth2
192.168.1.0     *                     255.255.255.0   U     0      0        0 eth2
192.168.2.0     *                     255.255.255.0   U     0      0        0 eth3
Default and * both equal 0.0.0.0 using sudo route -n.


SOLUTIONS
1. Two cards on the same network using /etc/network/interfaces -- very simple:
Yup, I talked about route before, but this is a less granular method using /etc/network/interfaces:

auto eth2
iface eth2 inet static
address 192.168.1.105
netmask 255.255.255.0
gateway 192.168.1.1
auto eth3
iface eth3 inet static
address 192.168.1.130
netmask 255.255.255.128
gateway 192.168.1.1


This configuration gives the following sudo route -n:

Kernel IP routing table
Destination         Gateway         Genmask      Flags Metric    Ref    Use   Iface
0.0.0.0                192.168.1.1           0.0.0.0           UG       0         0        0      eth2
192.168.1.0           0.0.0.0        255.255.255.0     U        0         0        0      eth2
192.168.1.128        0.0.0.0       255.255.255.128     U        0         0        0      eth3

Which is exactly what we wanted.


Solution 1.b using network-manager
In gnome 3/gnome-shell, go to system settings/network/select your interface (e.g. eth1), click on Configure (bottom right corner), and select the IP v4 tab and change the address and netmask as shown in solution 2. Or hit 'Routes...' in the lower left corner and do your configuration there...




Solution 2. Two cards on the same network and another card connected to 'internet'

eth0 is connected to the outside world, eth1 acts as the gateway for 192.168.1.0-127, and eth2 acts as the gateway for 192.168.1.128-255

I configured this in network-manager by setting:
eth0 to dhcp
eth1 to 192.168.1.1, mask 255.255.255.0, gw 192.168.1.1
eth2 to 192.168.1.129, mask 255.255.255.128, gw 192.168.1.129
I didn't edit route settings.

The corresponding /etc/network/interfaces settings would probably be:
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.0
gateway 192.168.1.1
auto eth2
iface eth2 inet static
address 192.168.1.129
netmask 255.255.255.128
gateway 192.168.1.129



Anyway, here's the sudo route -n:
Kernel IP routing table
Destination        Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0            130.194.167.254 0.0.0.0          UG    0         0        0 eth0
130.194.160.0   0.0.0.0         255.255.248.0     U     0         0        0 eth0
169.254.0.0       0.0.0.0         255.255.0.0         U     1000   0        0 eth1
192.168.1.0       0.0.0.0         255.255.255.0     U     0         0        0 eth1
192.168.1.128   0.0.0.0         255.255.255.128 U     0         0        0 eth2


Using this configuration you should probably set the gateway for eth3 in solution 1 to 192.168.1.128 -- that way you split all the traffic and in effect create two subnets (so technically, the 'same LAN' isn't really true)

Don't forget to open up your firewall to allow broadcasting from both 192.168.1.127 and 192.168.1.255