Memory Problems :(

I recently purchased a 2GB Kingston Memory MMC card for my Nokia 6230i phone, but when I formatted it on the phone I could only copy 768MB of data to it. Believing that the phone only understood FAT, I tried formatting the card using a different cluster size (32k and 64k), but this made no difference.

The answer was to format the card using FAT32. Simple when you know how :)

Installing AWStats

AWStats is a Perl script and so you must have Perl installed on your server. These instructions assume that this is the case.

  • Login to your server via a SSH session using PuTTY
  • Download the source code from Sourceforge using the command wget
  • Extract the source code using the command gunzip -c awstats-6.6.tar.gz | tar x
  • Move the source directory to /usr/local mv awstats-6.6 /usr/local/awstats
  • Change to the tools directory (cd /usr/local/awstats/tools) and run the configuration script perl to create a configuration file for your domain.
    • Need to create a new config file ? y
    • Define config file name to create
    • Define config file path /etc/awstats
  • Edit /etc/awstats/ and change the following parameters
    • LogFile=”/var/log/httpd/access_log”
    • DNSLookup=1
    • AllowToUpdateStatsFromBrowser=1
    • AllowFullYearView=3
  • Add the following entry to your periodic task scheduler (cron). On Westhost the command is editcron -e instead of crontab -e. The time should be the same as for logrotate
  • 36 3 * * * /bin/perl /usr/local/awstats/wwwroot/cgi-bin/ -update 2>&1 >/dev/null
  • Create a symbolic link so that you can access the documentation. ln -s /usr/local/awstats/docs /var/www/html/awdocs You will then be able to access the documentation from
  • Create a symbolic link so that you can access the tools. ln -s /usr/local/awstats/tools /var/www/html/awtools You will then be able to access the documentation from
  • Check your Apache configuration by typing apachectl configtest
  • Restart Apache by typing apachectl graceful or restart

Installing SHA1SUM

Westhost do not include SHA1SUM as part of their standard installation, so we cannot check the applications that we download have not been tampered with.

We therefore need to build our own copy of SHA1SUM. The source code for a cut down version can be obtained from

From the command line of your server

  • Type ftp ftp.gnupg.ogr to start a FTP session
  • Use username “anonymous” and password “anon@
  • Change to the required directory by issuing the command cd gnupg/binary
  • Download the source files using the commands get sha1sum.c and get sha1sum.c.sig
  • Close the FTP session using the command quit
  • If you installed GnuPG, verify the source file gpg –verify sha1sum.c.sig
  • Install the GCC Compiler Collection from your Site Manager if you have not already done so
  • Build the SHA1SUM executable by issuing the command cc -Wall -g -o sha1sum sha1sum.c
  • The SHA1SUM executable will now exist in the current directory. Move it to /usr/local/bin so that you can use it in the future. mv sha1sum /usr/local/bin

NOTE This version of SHA1SUM only calculates the SHA1 sum for the file specified; you have to visually check the sum against the supplied value for your download.

Uebimiau – Unable to log in

I could not log in to my webmail. I kept getting the error

ERROR (2): Header may not contain more than a single header, new line detected. (/path/to/webmail/inc/inc.php:156)

I am running Uebimiau version 2.7.10 and there is a bug in the file inc/inc.php. You need to change

  1. Header("Expires: Wed, 11 Nov 1998 11:11:11 GMT\r\n".
  2. "Cache-Control: no-cache\r\n".
  3. "Cache-Control: must-revalidate");

to this

  1. Header("Cache-Control: no-cache");
  2. Header("Cache-Control: must-revalidate");

Trouble building PInfo

I am having trouble building Pinfo.

My configure line looks like this:
./configure –prefix=/usr/mylocal –with-curses=/usr/mylocal

The error message I get is
checking location of curses.h file… /usr/mylocal/include/ncurses/ncurses.h
checking if curses is usable… no
configure: error: Curses not found. You need curses to compile pinfo

However, it manages to locate ncurses.h as you can tell from this excerpt from config.log, but then claims the routines are missing. If I try building conftest.c myself with –save-temps and then look at conftest.i, each routine is defined as “extern WINDOW *”, for example “extern WINDOW * stdscr;”. There is also a “typedef struct _win_st WINDOW;” statement to define WINDOW.

configure:9858: checking location of curses.h file
configure:9901: result: /usr/mylocal/include/ncurses/ncurses.h
configure:10142: checking if curses is usable
configure:10171: gcc -o conftest -g -O2 -I/usr/mylocal/include -L/usr/mylocal/lib -lncurses conftest.c >&5
/tmp/ccAGkDPW.o: In function `main’:
/home/myuser/apps/wip/pinfo-0.6.9/conftest.c:37: undefined reference to `initscr’
/home/myuser/apps/wip/pinfo-0.6.9/conftest.c:38: undefined reference to `printw’
/home/myuser/apps/wip/pinfo-0.6.9/conftest.c:39: undefined reference to `stdscr’
/home/myuser/apps/wip/pinfo-0.6.9/conftest.c:39: undefined reference to `wrefresh’
/home/myuser/apps/wip/pinfo-0.6.9/conftest.c:40: undefined reference to `stdscr’
/home/myuser/apps/wip/pinfo-0.6.9/conftest.c:40: undefined reference to `wgetch’
/home/myuser/apps/wip/pinfo-0.6.9/conftest.c:40: undefined reference to `stdscr’
/home/myuser/apps/wip/pinfo-0.6.9/conftest.c:40: undefined reference to `wgetch’
/home/myuser/apps/wip/pinfo-0.6.9/conftest.c:41: undefined reference to `endwin’
collect2: ld returned 1 exit status
configure:10177: $? = 1
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME “pinfo”
| #define PACKAGE_TARNAME “pinfo”
| #define PACKAGE_VERSION “0.6.9″
| #define PACKAGE_STRING “pinfo 0.6.9″
| #define PACKAGE “pinfo”
| #define VERSION “0.6.9″
| #define HAVE_STRDUP 1
| #define HAVE_STRSTR 1
| #define HAVE_STRSEP 1
| #define HAVE_GETOPT_LONG 1
| #define HAVE_SNPRINTF 1
| #define HAVE_SIGBLOCK 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define HAS_READLINE 1
| /* end confdefs.h. */
| #include
| int
| main ()
| {
| initscr();
| printw(“Hello World !!!”);
| refresh();
| getch();
| endwin();
| return 0;
| ;
| return 0;
| }
configure:10202: result: no
configure:10546: error: Curses not found. You need curses to compile pinfo

However, all the routines are there when I check /usr/mylocal/include/ncurses/ncurses.h

$ grep -w initscr /usr/mylocal/include/ncurses/ncurses.h
extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */
$ grep -w printw /usr/mylocal/include/ncurses/ncurses.h
extern NCURSES_EXPORT(int) printw (const char *,…) /* implemented */
$ grep -w refresh /usr/mylocal/include/ncurses/ncurses.h
#define _HASMOVED 0×20 /* has cursor moved since last refresh? */
extern NCURSES_EXPORT(int) refresh (void); /* generated */
#define refresh() wrefresh(stdscr)
#define KEY_REFRESH 0565 /* refresh key */
#undef refresh
$ grep -w getch /usr/mylocal/include/ncurses/ncurses.h
extern NCURSES_EXPORT(int) getch (void); /* generated */
#define getch() wgetch(stdscr)
$ grep endwin /usr/mylocal/include/ncurses/ncurses.h
extern NCURSES_EXPORT(int) endwin (void); /* implemented */
extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */

I managed to get it to build using
gcc -o conftest.o conftest.c -I/usr/mylocal/include -g -L/usr/mylocal/lib -lncurses
instead of
gcc -o conftest -g -O2 -I/usr/mylocal/include -L/usr/mylocal/lib -lncurses conftest.c
so lets try
gcc -o conftest conftest.c -g -O2 -I/usr/mylocal/include -L/usr/mylocal/lib -lncurses

Hmm. Looks like it has something to do with the position of the source file in the command which is very strange as the manual says

You can mix options and other arguments. For the most part, the order you use doesn’t matter. Order does matter when you use several options of the same kind; for example, if you specify -L more than once, the directories are searched in the order specified.

So for the time being, I have modified configure so that the definition for ac_link (in 9 places) is now
ac_link=’$CC -o conftest$ac_exeext conftest.$ac_ext $CFLAGS $CPPFLAGS $LDFLAGS $LIBS >&5′

An excellent guide to gcc and other utilities by BRUCE PERENS can be found at

Details of hunt for initscr from ncurses.h

  1. //usr/mylocal/include/ncurses/ncurses.h
  2. extern NCURSES_EXPORT(WINDOW *) initscr (void);                         /* implemented */
  3. NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);
  4. #define vsscanf(a,b,c) _nc_vsscanf(a,b,c)
  5. typedef struct _win_st WINDOW;
  7. struct _win_st
  8. {
  9.         NCURSES_SIZE_T _cury, _curx; /* current cursor position */
  11.         /* window location and size */
  12.         NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */
  13.         NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */
  15.         short   _flags;         /* window state flags */
  18.         /* attribute tracking */
  19.         attr_t  _attrs;         /* current attribute for non-space character */
  20.         chtype  _bkgd;          /* current background char/attribute pair */
  22.         /* option values set by user */
  23.         bool    _notimeout;     /* no time out on function-key entry? */
  24.         bool    _clear;         /* consider all data in the window invalid? */
  25.         bool    _leaveok;       /* OK to not reset cursor on exit? */
  26.         bool    _scroll;        /* OK to scroll this window? */
  27.         bool    _idlok;         /* OK to use insert/delete line? */
  28.         bool    _idcok;         /* OK to use insert/delete char? */
  29.         bool    _immed;         /* window in immed mode? (not yet used) */
  30.         bool    _sync;          /* window in sync mode? */
  31.         bool    _use_keypad;    /* process function keys into KEY_ symbols? */
  32.         int     _delay;         /* 0 = nodelay, <0 = blocking, >0 = delay */
  34.         struct ldat *_line;     /* the actual line data */
  36.         /* global screen state */
  37.         NCURSES_SIZE_T _regtop; /* top line of scrolling region */
  38.         NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */
  40.         /* these are used only if this is a sub-window */
  41.         int     _parx;          /* x coordinate of this window in parent */
  42.         int     _pary;          /* y coordinate of this window in parent */
  43.         WINDOW  *_parent;       /* pointer to parent if a sub-window */
  45.         /* these are used only if this is a pad */
  46.         struct pdat
  47.         {
  48.             NCURSES_SIZE_T _pad_y,      _pa
  49.             NCURSES_SIZE_T _pad_top,    _pad_left;
  50.             NCURSES_SIZE_T _pad_bottom, _pad_right;
  51.         } _pad;
  53.         NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */
  56.         cchar_t  _bkgrnd;       /* current background char/attribute pair */
  57. #if 0
  58.         int     _color;         /* current color-pair for non-space character */
  59. #endif
  60. #endif
  61. }