Thursday, 3 June 2010

blurred fonts in Adobe Reader

If the font in adobe reader are blurred or hard to read, try the following:
Edit --> Preferences --> Page Display

and change the value of the Smooth Text field to reflect the type of monitor you are using

Saturday, 14 February 2009

lyx brackets

When working with lyx it is sometimes annoying to get all the brackets right. The following setup makes it a breeze. If you would like square brackets simply type ctrl-[ and that's all. Moreover, you can mark a sequence and place ctrl-[ and get brackets around it. To get standard brackets, any of ctrl-( ctrl-) ctrl-9 ctrol-0 ctrl-shift-9 and ctrl-shift-0 will work. The same applies to other types of brackets and similar objects. To get it done, add the following section to your binding file (on windows it will be in \Documents and settings\\Application Data\lyx<#>\bind

\bind "C-9" "math-delim ( )"
\bind "S-C-parenleft" "math-delim ( )"
\bind "S-C-9" "math-delim ( )"
\bind "C-0" "math-delim ( )"
\bind "S-C-parenright" "math-delim ( )"
\bind "S-C-0" "math-delim ( )"

\bind "C-bracketleft" "math-delim [ ]"
\bind "C-bracketright" "math-delim { }"
\bind "C-S-less" "math-delim langle rangle"
\bind "C-S-greater" "math-delim langle rangle"

\bind "C-S-bar" "math-delim | |"
\bind "C-S-brokenbar" "math-delim | |"
\bind "C-M-bar" "math-delim | |"
\bind "C-S-backslash" "math-delim | |"

\bind "S-C-braceleft" "math-delim { }"
\bind "S-C-braceright" "math-delim { }"
\bind "C-S-bracketleft" "math-delim { }"
\bind "C-S-bracketright" "math-delim { }"

\bind "C-slash" "math-delim Vert Vert"

emacs startup

If you wish to avoid the opening page upon startup which emacs shows, add the following line to the .emacs file in your home directory:

(setq inhibit-splash-screen t)

Sunday, 28 December 2008


This is one of these annoying things that I keep forgetting and end up spending so much time trying to figure out what the problem is.

The Problem:

I am trying to compile a small piece of code I just wrote and get error messages like

error: `cerr' was not declared in this scope
error: `cout' was not declared in this scope
error: `endl' was not declared in this scope

I get these messages even though iostream is included!!!

The Solution:

The problem is due to the fact the cerr, cout, cin, endl and their freinds are defined in the std name space. Simply add the line:

using namespace std;

Sunday, 21 December 2008

STL with virtual classes and inheritance

The problem:
A fundamental concept in object oriented programming is inheritance. Inheritance allows you to declare a basic object and its derivatives as being a natural extensions one of the other. Virtual classes are the extreme manifestations of this concept, where the base class declares an interface and partial implementation and the true implementation is in the derived classes.
However, it turns out that when you try to combine STL with virtual and inherited classes you encounter a problem. For example, if class A is a pure virtual class, then the declaration list<A>will cause a compile time error.
The situation might be even worst in the following situation:

#include <vector>
#include <iostream>

using namespace std;

class A {


virtual void exe() {cout << "in class A" << endl;}


class B: public A {


void exe() {cout << "in class B" << endl;}


int main()


A a;

B b;

vector<A> v







Produces the following output:
in class A
in class B

in class A

It turns out that there is no easy way out of this problem.