Randy Pausch

Ξ July 28th, 2008 | → 0 Comments | ∇ Education, Friends, Science |

Professor Randy Pausch finally lost to the ‘Big C’ last Friday.  Very sad, and a reminder to us why we should all help fight this disease in anyway we’re able to.  If you’ve not seen it, find some time to watch his last lecture.

As well as many sources, The Times has an obituary today.

 

MSI Wind

Ξ July 25th, 2008 | → 0 Comments | ∇ Mumble |

The ‘Numpties‘ came through!!!

I have one; and it’s SOOOO cute!

So, now I’m ‘upgrading’ and generally ‘hacking about’ [feels like the 'good ol' times' -- and makes me feel young[er]!]

 

New toys can be hard to buy!

Ξ July 24th, 2008 | → 2 Comments | ∇ Geeky, Give me Strength, Technology, University |

I’m in the market for a few new toys: a solid-state digital recorder; a Netbook computer; and a Bluetooth car-stereo.

It’s so much easier said than done though!

Digital Recorder:

This will mainly be used to record lectures and tutorials [as in the Oxford Tutorial System].  Previously I’ve used my Sony minidisc recorder for this kind of thing, but I’ve recently decided that I *need* a machine-to-machine transfer, via USB.  Plus I’m fed up with discs!

So which one to buy?

A quick web search got me wanting a Edirol R09 HR [which might be overkill]; or a Zoom H4, or H2.  So, where to find sample recordings and reviews of these: websites that purport to carry reviews are often just ‘fronts’ for ad-farms, and even when you find a review, it’s often some non-professional’s ‘first reaction’ etc.  I gave up quite quickly.

So, can I find a local store that has any of these – any of them?  The answer’s either ‘nope’, or ‘nope’.  So, it’s basically ‘take a punt’ time [the American meaning, and not the Oxford one!]; or wait until I go to London [which I hate doing!] or Birmingham [which I hate doing even more!]

Temporary Failure on this then.

Netbook:

For making notes and doing research; without lugging a heavy notebook about the place.

PC World has the normal ASUS machines, but they’ve also just started stocking a re-badged MSI Wind machine – and it’s nice!  So nice in fact that I quickly said ‘I’ll take one of these’ to a passing, typical tech-store, spotty ‘numpty’.

 Numpty: ‘No you won’t’, ‘we don’t have them in stock’.

 peetm:  ‘Ok I’ll order one’

 Numpty: ‘No you won’t’, ‘you’ll have to check the website

          and reserve one when they come in’

 peetm:  ‘You’re joking?’

 Numpty: ‘No I’m not’ [and stop calling me ‘Numpty’]

So, now I have to routinely remind myself to check PC World’s website: which means putting one of these in a virtual shopping-basket, proceeding to the checkout, selecting ‘Collect in Store’, entering the postcode of the store, and then hoping that after all of that, a green checkmark will appear against its address!  Which it isn’t doing!  bah!

Temporary Failure on this too then.

Bluetooth Stereo:

I’m fed up with my TomTom 920’s so very weak FM-transmitter’s strength [or lack of it!]  We have the TomTom setup so that we can listen to books-on-tape [sic] and directions using the car stereo [the TomTom's internal speaker’s pretty crap of course].

The trouble with this is that, as you drive about, sooner or later [most often ‘sooner’] you’ll enter an area in which there’s a commercial station transmitting on the same frequency as the TomTom.  And, as the TomTom’s RMS power output is diddly squat, the commercial station first bleeds through, and then, after a few minutes, totally breaks through – which means stopping to retune things.  Hopeless.

We’ve tried other tricks to rectify this – like removing the car’s aerial, but the TomTom’s so low on power output that that doesn’t work too well – and, of course, you can say goodbye to any traffic reports!

We’re off to France in about a month for a holiday, so we really *need* to be able to listen to our books without getting wound-up – we’re meant to be resting!

Anyway, the TomTom can also use Bluetooth, so I thought we’d treat ourselves to a new car stereo.

‘Once again into the breech dear friends’, and off I go to the local Halfords‘ store.

And they have Bluetooth stereos!

They have three, but I’m offered a choice of two; as they don’t have the price for the third one!

Can I play with them?  They have them rack-mounted, and powered up – so you think the answer’s ‘yes’ don’t you?

Well, the answer’s actually ‘no’; they’re behind plexiglass!

However, the ‘numpty’ in this store *did* seem to know a thing or two, and as they also offer a fitting service for £10 it looks ‘ok’ – I could just go for one of these.  Yes, I’d like more choice, but …

So, I write down the model numbers and head off home to see if I can find manuals for either of them on-line.  Which I can.  However, I also discover that Halford’s isn’t at all competitive [fair even] when it comes to price.

Hmmm.  Choices: pay around £60 more than I could mail-order one for, plus the £10 fitting charge, and get one fitted from Halford’s, or take that punt again and get one from elsewhere – which will mean my wrecking the car trying to get the old one out, and fitting the new one of course!  Plus I’ll have skinned knuckles, and not have the right adapter cable so that Megan’s steering column controls will work with the damn thing!

Temporary Failure here as well!

So, here I am, checking PC World’s website every few hours [Numpty: ‘they could come in any time’]; umming and arring over digital recorders that I can’t test; and considering going to a specialist car-stereo place in the hope that the numpties there will have more choice, and be reasonable/fair on price!  Fat chance!

 

Whereis.py

Ξ July 23rd, 2008 | → 0 Comments | ∇ Coding, Geeky, Programming, Technical |

I had a donated version of this which used os.walk(), but I couldn’t figure out a way to prevent that recursing [I believe os.walk() always decends].

Hunting around – and not knowing anything about Python really – I found os.listdir()

So, I modified what I had been given.

I wish I knew how to retrieve the match from the files ‘collection’ !

    if sys.argv[1] in files:
import os, sys
for dir in os.getenv('path').split(';'):
  for files in os.listdir(dir):
    if sys.argv[1] in files:
       print dir + "\\" + sys.argv[1]

 

Whereis.c c/w Paranoia

Ξ July 23rd, 2008 | → 0 Comments | ∇ Coding, Geeky, Programming, Technical |

Ok, so I got paranoid after posting the earlier .c version!

Also, the functionality has altered a little, in that this one does just return the first match – it checks each path specified in PATH. It also does a ‘Not Found’ thingmy if, um, the program wsn’t found.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>

void whereis(char const * const prg)
{
    char * path = NULL;
    char * buff = NULL;
    char * part = NULL;

    int n       = 0;
    int i       = 0;
    int found   = 0;

    // PATH exists? AND if it does, it's not zero length?
    //
    if((path = getenv("PATH")) != NULL && strlen(path))
    {
        // Split PATH on each ;
        //
        while((part = strtok(path, ";")) != NULL)
        {
            n = strlen(part);

            // strlen() will return zero if we just found a ; or a ;; etc.
            //
            if(n != 0)
            {
                // Is this bit of the PATH slash terminated?
                //
                i = part[n - 1] == '\\' ? 0 : 1;

                // Alloc space, + 1 for the '\0'
                //
                if((buff = calloc(n + 1 +  i + strlen(prg) + 1, 1)) != NULL)
                {
                    // Copy in the various bits.
                    //
                    strcpy(buff, part);

                    if(i == 1)
                    {
                        strcat(buff, "\\");
                    }

                    strcat(buff, prg);

                    // MS specific 'does it exist' stuff.
                    //
                    if(_access(buff, 0) == 0)
                    {
                        // Yes, it was found!
                        //
                        puts(buff);

                        // Flag we found at least one match.
                        //
                        found = 1;
                    }

                    free(buff);
                }

                else

                {
                    puts("Couldn't allocate enough memory!");
                }

            }

            // Continue strtok()
            //
            path = NULL;
        }

        if(found == 0)
        {
            printf("%s not found\n", prg);
        }
    }

    else

    {
        puts("PATH is empty");
    }
}

int main(int argc, char * argv[])
{
    if(argc < 2)
    {
        puts("Arg required");
    }

    else

    {
        whereis(argv[1]);
    }

    return 0;
}

 

Whereis.pl

Ξ July 22nd, 2008 | → 0 Comments | ∇ Coding, Geeky, Programming, Technical |

 A Perl version [Donated - I've no real idea how it works!]

#!/usr/bin/perl
use File::Which;
print which($_) . "\n" foreach (@ARGV);

Which you could run like Whereis.pl ruby.exe perl.exe

 

Whereis.c

Ξ July 22nd, 2008 | → 1 Comments | ∇ Coding, Geeky, Programming, Technical |

Ok, so I had to add a C version!

Some disclaimers before the code though.  After all, it is C!

I was trying to keep this smallish, readable, and avoid paranoia.

I felt obliged to test for a valid arg.

I also assumed** that:

  • the machine’s PATH environment-variable exists, and is not empty;
  • parts of the path could be / terminated [or not];
  • FILENAME_MAX is sufficient to hold the ‘PATH part’ and the arg;
  • access() is ok to use [it's not ISO C];

**Assuming anything is generally a bad thing to do of course!

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>

char const * whereis(char const * const prg)
{
    static char filepath[FILENAME_MAX];

    char * path = getenv("PATH");

    char * part = NULL;

    while((part = strtok(path, ";")) != NULL)
    {
        strcpy(filepath, part);

        if(part[strlen(part) - 1] != '\\')
        {
            strcat(filepath, "\\");
        }

        strcat(filepath, prg);

        if(access(filepath, X_OK) == 0)
        {
            return filepath;
        }

        path = NULL;
    }

    return NULL;
}

int main(int argc, char * argv[])
{
    char const * filepath;

    if(argc != 2)
    {
        puts("Arg required");
    }

    else

    {
        if((filepath = whereis(argv[1])) != NULL)
        {
            puts(filepath);
        } 

        else

        {
            puts("Not found");
        }
    }

    return 0;
}

 

Whereis.php

Ξ July 17th, 2008 | → 0 Comments | ∇ Coding, Geeky, Programming, Technical |

Continuing on my whereis mission, here’s a PHP version [the shortest so far!]

<?

foreach(split(";", getenv("Path")) as $folder)
{
    $file = $folder . "\\" . $argv[1];

    if(file_exists($file))
    {
        echo $file;
    }
}

?>

It’s run from the command-line like:

C:\php -n whereis.php ruby.exe

Again, like most of the rest of these efforts, this one doesn’t support wildcards.

I’m rather pleased with the concise result, and amazed at how it shrank** whilst I was exploring/learning how to do this simple thing in PHP.

**And, with some judicious editing, I actually got it down to  93 bytes.  However, you wouldn’t want to see that version!

 

Whereis.rb

Ξ July 10th, 2008 | → 0 Comments | ∇ Coding, Geeky, Programming, Technical |

I’ve no idea how to have this version expand wildcards; but I know* that if I really bothered to learn Ruby’s cryptic syntax, and library [if that's what it's called], I probably could.

def where_is (prog)
    paths = ENV["PATH"].split(';')
    paths.each{ | dir |
        d = Dir.new(dir)
        d.each {|f|
             if f.rindex(prog) then
                return dir
             end
        }
    }
    "#{prog} not found"
end
print "#{where_is(ARGV[0])}\n"

*Actually, I’m not so sure!

 

Magnetic Movie

Ξ July 10th, 2008 | → 0 Comments | ∇ Geeky, Philosophical, Science |

Back in my teens, when I got into radio – as in, Amateur Radio – I thought how wonderful it would be to watch an RF field emanate from the various antenna systems I built.  As well as being very beautiful [surely] it would have been very useful too – to see if the field ‘looked good’, i.e., ‘as designed’.  Anyway, we’ve all had similar thoughts probably – of being able to visualise these same fields, at various frequencies, being propogated all around us every day – by TV, mobile-phones, and, commercial radio of course?

This video brought back all those memories. If only this were truly possible!

 

Next Page »
  • Groupings

  • Old Stuff

  • Blog Roll


    Top BBC Tech News Items
    One in four gives fake net names

    European police in pirate raids

    TalkTalk rapped for malware trial

    PS3 update blocks hardware hack

    HP sues Hurd over new Oracle job