Peter's Blog

Redefining the Impossible

Posts made during November 2004


Trying to get an IoTech ADAC IO card to do something. Installing it on my pc, my network card stopped working as it had used up the last free IRQ. To get around this I pulled the sound card as I never use that anyway.

As a simple test to whether the card works I tried running the PlotterX and PlotterXPlus applications that come with it. Both die with access violations when I try to open the configuration files. I've messed around with this all morning, pulling cards, disabling drivers that use the same IRQ, reinstalling, all to no avail.

I've installed the diagnostics programs with variable results. The main diagnostics program generates lots of errors but it is not clear whether this is because it needs loopback connections.

Peeves:

  • The IOTech website takes the novel approach of having no FAQ or knowledgebase, just email tech support. If I want help next week I'll give it a try.
  • I have to register to download anything (documents, lastest software) which violates my privacy. Why should I register to read a sales brochure?
  • All the documents are in lovable pdf format, much loved by people who never have to use them.
  • The documents prattle on about DMA setup without actually saying how to set it up.
  • The software is all vintage 2002.
  • The vb sample programs appear to be in VB4 and won't load in VB6 as they need a message hook library that is not supplied.
  • They have an out-of-the-box (tm) slogan that erroneously and annoyingly implies it will take less that a day to get the thing going.

These cards are not cheap and I've wasted a whole morning with this and it still doesn't work. My big fear is that the hardware engineers will keep specifying them.

Monday morning sad

Update: Downloaded latest version of PlotterX software from IOTech and installed it. I also installed the latest drivers and ADLIB software development libraries. PlotterX installed itself in a different program group (or the XP equivalent) to the original one. It still crashes when opening the .con file. BUT PlotterXPlus now works! The diagnostics still fail the power up tests.

Update 2: Message hook ocx is in the C:\Adlib\AlWdm\Vbasic folder and needs registering on the command line with:

regsvr32 MSGHoo32.ocx

Then examples run in VB6.

Monday morning is over, now we are rolling.


Filed under: untagged

4 Comments

Decided to write a python extension module. Swig looks like the easiest way to do it. Given a simple definition file, e.g.:

%module mod552
extern int Wiffle( int a);
extern char *Poopie( char *strPoop);
extern int jetty( int a, char *strB);

%{
#include "Giblets.h"
%}

class Giblets
{
public:
  int Mandible( void);
};

Swig will generate a file full of c++ wrapper code for the python objects. The code for the library is written in straight C, e.g.:

   1  #include <string.h>
   2  #include <stdlib.h>
   3  #include "Giblets.h"
   4  
   5  int Wiffle( int a)
   6  {
   7      return a + 5;
   8  }
   9  
  10  char *Poopie( char *strPoop)
  11  {
  12      static char strBuff[1000];
  13  
  14      strcpy( strBuff, strPoop);
  15      strBuff[3] = 'p';
  16      strBuff[4] = 'c';
  17      strBuff[5] = 'w';
  18  
  19      return strBuff;
  20  }
  21  
  22  int jetty( int a, char *strB)
  23  {
  24      return a + atoi( strB);
  25  }
  26  
  27  int Giblets::Mandible( void)
  28  {
  29      return 97;
  30  }

The module is used in python as you would expect:

   1  C:\552\Src\Mod552\Mod552>python
   2  Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32
   3  Type "help", "copyright", "credits" or "license" for more information.
   4  >>> import mod552
   5  >>> dir(mod552)
   6  ['Giblets', 'GibletsPtr', 'Poopie', 'Wiffle', '__builtins__', '__doc__', '__file
   7  __', '__name__', '_mod552', '_newclass', '_object', '_swig_getattr', '_swig_seta
   8  ttr', 'jetty']
   9  >>> o = mod552.Giblets()
  10  >>> o.Mandible()
  11  97
  12  >>>

This article is a useful introduction to the process although you have to be savvy with Visual C++ to follow it.


Filed under: python swig

Add a comment

What with clocks going back last weekend my linux box was an hour and 20 minutes fast. I don't set the clock often enough to remember how to do it so I found this site which has the following summary:

  • Run ``date MMDDhhmmYY'' to set the current system date/time.
  • Type
    /sbin/hwclock --systohc [--utc]
    
    to set the hardware clock.

I have ntpd running but it does not seem to be doing anything for me. Firewall may well be blocked.

Update: don't believe everything you read on the internet. The site above gives the command as:

  • Run
    date MMDDhhmm
    
    to set the current system date/time.

Which for me on Gentoo sets the year to 2000.


Filed under: gentoo linux

Add a comment

Consider the following regular expression which is searching for a word followed by a parenthesis:

(.*)(\w+)\(

If this expression is fed a string like:

int fred()

it will match but the contents of group 1 will be 'int fre' and the contents of group 2 will be 'd'. This is because the expression '.*' is greedy and will grab as much of the string as it can, even stuff that matches '\w+'. To stop the greediness the quantifier should be followed by a question mark, e.g.

(.*?)(\w+)\(

With this group 1 will become 'int ' and group 2 will become 'fred'.

This works with the python 're' module.


Filed under: python

Add a comment

My Site5 hosting provider gives me access to Awstats and it's interesting to see what people having been looking at on this site. So far we are half way through 4th November and I've already had 74 hits from google searches. The most interesting search phrase has to be 'raw nose' which turned up this old post from earlier blogging days when I wasn't so tech focused and more chit-chatty. I hope the posting answered their question.

This post has proved the most popular.

I am going to install Awstats locally so I can enable the reverse DNS functions and start watching the watchers.


Filed under: awstats google hosting site5

Add a comment

I updated my Wilki Drupal module to support more languages. There are drupal 4.4 and drupal 4.5 versions.

In addition to python and php it now supports:

  • vb
    dim i as integer
    
    let i = 1000
    print "vb sucks " & str(i) & " times"
    
  • perl
    $i = 1000;
    print "what are the dollars for $i times?";
    
  • c
    int i = 1000;
    
    printf( "c is old hat %d times", i);
    
  • cpp
    class i{
    public:
       int m_nComplex;
       char *m_strPretentious;
    };
    
  • bash
    $bash = $more + $dollars
    
  • java
    oThing.print( "all I know about java is that it's slow");
    
  • javascript
    DoSomethingAnnoying();
    
  • html
    <a href="www.yyy.zzz"><b>A site</b></a>
    

Instructions here.


Filed under: drupal php python wilki

Add a comment

This is how I installed a nice font for VIM. I have always wanted a monospaced sans-serif font and now I have found it here. The one I particularly like is "Proggy Square (Slashed Zero)" as it is clean and squeezes a bit more text on screen while still being readable to my fading eyesight. I set this up in VIM on win2k as follows:

  • Download TrueType font file and copy to Font folder to install it.
  • Add the following lines to my _vimrc file:
    set guifont=ProggyCleanTTSZBP:h11
    
    Where ProggyCleanTTSZBP is the name of the font and h11 is the font size (height 11: the aspect ratio is maintained).

The name of the font is the same as that listed in Edit/Select Font menu item in the GUI.


Filed under: vim

Add a comment

To edit the _vimrc file easily I added this to my (ironically) _vimrc file:

:cab vimrc c:\bin\vim\_vimrc

Then I can edit the file by typing:

:e vimrc

and I don't have to remember which directory it is in.


Filed under: vim

Add a comment

For the first time in nearly a year my ntl broadband connection is down and I am having to blog via my mobile. I waited on the phone for 25 minutes to be told there is an outage in my area. When the 'ready' light on the cable modem stops flashing I am back in business, no idea when that might be.

Let's see:

strFred = "hello world"

Syntax highlighting from a mobile, cool.

Update: up again, about 6 hours later.


Filed under: blog ntl phone python

2 Comments

I had a brief flirtation with Skype. I installed it because I was interested in the rather competitive call rates. It also works out cheaper for national calls than my current bog-standard NTL service.

However, I uninstalled it again for two reasons:

  • Cannot imagine my wife getting to grips with using a computer, headphone and microphone to make a call.
  • While Skype was installed it took my laptop about a minute to come out of hibernate instead of 15 seconds or so. That is not tolerable.

I never actually made a call with it. How can there be no delays in calls?

We use Alpha Telecom phone cards. In Peckham, London there are dodgy street sellers who sell three £5 cards for £10. Skype is not that competitive. The cards have the advantage that once the credit is used up that's it, you cannot talk any more without going to London. Saves plenty on the phone bill.


Filed under: ntl phone skype

Add a comment