Re: Bad C Source (Re: gzipping your websites WINRAR 40 days trial)

2003-09-04 Thread Phil Lanch
On Thu, Sep 04, 2003 at 06:57:41PM +0100, Shevek wrote:
> On Thu, 4 Sep 2003, Phil Lanch wrote:
> > you mistyped "C++".
> 
> I consider myself to be a programmer. Having read this code, my only
> possible response is, "You what?"
> 
> AICMFP.

sorry, i forgot to say:

#include 

> > HTH.  HAND.

though it's just "resource acquisition is initialization" - it's not
entirely devoid of logic ...

/me looks for a bridge to hide under

-- 
Phil Lanch0xD78D598DA6635CF32AB24593C98994B7D95B33E3
   (i even know the passphrase: http://www.subtle.clara.co.uk/rephrase )

"Daddy, why are we hiding?"  "We use vi, son.  They use emacs."



Re: Ob-buffy

2003-09-04 Thread David H. Adler
On Thu, Sep 04, 2003 at 06:44:02PM +0100, Phil Lanch wrote:
> On Wed, Sep 03, 2003 at 12:55:14PM -0400, David H. Adler wrote:
> > Frankly, I think comparing those shows to buffy is misguided.  It's sort
> > of like trying to compare 8 1/2 to the Philadelphia Story.  Ok, maybe
> > not quite *that* extreme.
> 
> well, i'd prefer to watch Hepburn & Grant in _Bringing Up Baby_; and i
> think Stewart is better when he's not *just* being nice (it's more
> interesting if there are complications) - especially in _The Man from
> Laramie_, also _Vertigo_.  whereas 8½ is clearly Fellini's best film.
> so 8½ is better.

Of course, by that reasoning, Night of the Ghouls is better, as it's Ed
Wood's best film. :-)

I'll admit to Bringing Up Baby being better than Philadelphia Story, but
I still think there's a disconnect there, as they're very different
films, albeit less so than my original comparison.

In any case, my point was that there are things that are sufficiently
different that to call one "better" than the other isn't necessarily a
reasonable thing.  I'm quite sure that a whole lot of people do *not*
think think 8 1/2 is good at all.  Although they would be *wrong* :-),
we're walking through the valley of personal preference more than
anything else at that point.

dha
-- 
David H. Adler - <[EMAIL PROTECTED]> - http://www.panix.com/~dha/
Its a whole new kind of boredom.
- Ash (The ICT Tech with a soul)



Re: Bad C Source (Re: gzipping your websites WINRAR 40 days trial)

2003-09-04 Thread Shevek
On Thu, 4 Sep 2003, Phil Lanch wrote:

> On Thu, Sep 04, 2003 at 03:40:18PM +0100, David Cantrell wrote:
> > It's just this sort of thing that makes me lurve perl.
> 
> you mistyped "C++".

I consider myself to be a programmer. Having read this code, my only
possible response is, "You what?"

AICMFP.

S.

> class fleeg {
> };
> 
> class quirka {
> public:
> quirka () { f = auto_ptr (new fleeg); }
> private:
> auto_ptr f;
> };
> 
> class miner {
> public:
> miner () { q = auto_ptr (new quirka); }
> private:
> auto_ptr q;
> };
> 
> auto_ptr smith (surbiton_context * context, int * error) {
> auto_ptr foo;
> 
> try {
> foo = auto_ptr (new miner);
> } catch (bad_alloc e) {
> *error = ENDORIAN;
> return foo;
> }
> 
> .
> 
> return foo;
> }
> 
> HTH.  HAND.
> 
> 

-- 
Shevekhttp://www.anarres.org/
I am the Borg. http://www.gothnicity.org/



Re: Ob-buffy

2003-09-04 Thread Phil Lanch
On Wed, Sep 03, 2003 at 12:55:14PM -0400, David H. Adler wrote:
> Frankly, I think comparing those shows to buffy is misguided.  It's sort
> of like trying to compare 8 1/2 to the Philadelphia Story.  Ok, maybe
> not quite *that* extreme.

well, i'd prefer to watch Hepburn & Grant in _Bringing Up Baby_; and i
think Stewart is better when he's not *just* being nice (it's more
interesting if there are complications) - especially in _The Man from
Laramie_, also _Vertigo_.  whereas 8½ is clearly Fellini's best film.
so 8½ is better.

OTOH, i've never seen more than a minute or 2 of Buffy, so i can't
really compare it to anything.

-- 
Phil Lanch0xD78D598DA6635CF32AB24593C98994B7D95B33E3
   (i even know the passphrase: http://www.subtle.clara.co.uk/rephrase )

"If I knew then what I know now, I would have said 'I don't recall'."



Re: Bad C Source (Re: gzipping your websites WINRAR 40 days trial)

2003-09-04 Thread Phil Lanch
On Thu, Sep 04, 2003 at 03:40:18PM +0100, David Cantrell wrote:
> It's just this sort of thing that makes me lurve perl.

you mistyped "C++".

class fleeg {
};

class quirka {
public:
quirka () { f = auto_ptr (new fleeg); }
private:
auto_ptr f;
};

class miner {
public:
miner () { q = auto_ptr (new quirka); }
private:
auto_ptr q;
};

auto_ptr smith (surbiton_context * context, int * error) {
auto_ptr foo;

try {
foo = auto_ptr (new miner);
} catch (bad_alloc e) {
*error = ENDORIAN;
return foo;
}

.

return foo;
}

HTH.  HAND.

-- 
Phil Lanch0xD78D598DA6635CF32AB24593C98994B7D95B33E3
   (i even know the passphrase: http://www.subtle.clara.co.uk/rephrase )

"If you tell a lie big enough and keep repeating it, people
will eventually come to believe it."  -- Joseph Göbbels



Re: perl windows apps

2003-09-04 Thread Dan Brook
Or there's the up and coming Prima

http://www.prima.eu.org/

Dan



Re: Bad C Source (Re: gzipping your websites WINRAR 40 days trial)

2003-09-04 Thread Ben
On Thu, Sep 04, 2003 at 03:07:08PM +0100, Lusercop wrote:
> On Thu, Sep 04, 2003 at 01:40:08PM +0100, Ben wrote:
> > return foo;
> > 
> >   FAIL3: 
> > free(foo->quirka->fleeg);
> > return NULL;
> >   FAIL2:
> > free(foo->quirka);
> > return NULL;
> >   FAIL1:
> > free(foo);
> > return NULL;
> > }
> >
> > With nested structures like these, this structured approach just seems
> > cleaner to me than all those temporaries kicking about.
> 
> what's wrong with:
> 
> | if(foo) {
> |   if(foo->quirka) {
> | free(foo->quirka->fleeg);
> |   }
> |   free(foo->quirka);
> | }
> | free(foo);
> 
> In the error condition?
> 
> or even just:
> | free_foo(foo);
> ( :-) )
> 
> If you make sure your structures don't have dangling pointers, then that has
> got to be a good thing in my opinion.
> 
> Still neater (IMO) than the FAIL1: FAIL2: FAIL3: approach.

Foxen for boxen. We've had variants of this conversation before. You know I
like to write my code on the assumption that the people reading it 
(assuming such beasts exist) may be more inexperienced or more junior
than I am. To my mind, FAIL1: 2: 3: helps to hammer the message home.

Given that this is a fairly structured style of writing a language which 
enforces so little, I don't consider this a Bad Thing. 

It doesn't really matter and beyond a certain level it's a matter of
personal preference, feeling and aesthetic anyway.

Ben 



Re: Bad C Source (Re: gzipping your websites WINRAR 40 days trial)

2003-09-04 Thread David Cantrell
On Thu, Sep 04, 2003 at 03:07:08PM +0100, Lusercop wrote:
> what's wrong with:
> 
> | if(foo) {
> |   if(foo->quirka) {
> | free(foo->quirka->fleeg);
> |   }
> |   free(foo->quirka);
> | }
> | free(foo);
> 
> In the error condition?

Gets a bit unweildy if you have foo->quirka->fleeg->miner->willy->...

It's just this sort of thing that makes me lurve perl.

-- 
Lord Protector David Cantrell  |  http://www.cantrell.org.uk/david

  Any technology distinguishable from magic is insufficiently advanced



Re: perl windows apps

2003-09-04 Thread muppet

Nicholas Clark said:
> On Thu, Sep 04, 2003 at 01:23:09PM +0100, Joel Bernstein wrote:
>> On Thu, Sep 04, 2003 at 01:21:00PM +0100, Alex McLintock wrote:
>> > Is there a standard route for writing windows apps in perl? Do I have to
>> go
>> > down the TCL route? ActivePerl by itself?
>> >
>> ActivePerl. There's always Gtk2-Perl-Win32 as well.
>
> and wxPerl, which seemed to produce "native" looking MS Windows apps on MS
> Windows, and will also work on X if your requirements change in future
> (and maybe other places too, I don't know)

there are gtk themes to make gtk on windows look native; not quite perfect,
but closer than lotus notes gets.

although i think wxwindows on win32 actually uses win32api directly.  don't
quote me, but i think that's true.

-- 
muppet 



Re: Bad C Source (Re: gzipping your websites WINRAR 40 days trial)

2003-09-04 Thread Lusercop
On Thu, Sep 04, 2003 at 01:40:08PM +0100, Ben wrote:
> return foo;
> 
>   FAIL3: 
> free(foo->quirka->fleeg);
> return NULL;
>   FAIL2:
> free(foo->quirka);
> return NULL;
>   FAIL1:
> free(foo);
> return NULL;
> }
>
> With nested structures like these, this structured approach just seems
> cleaner to me than all those temporaries kicking about.

what's wrong with:

| if(foo) {
|   if(foo->quirka) {
| free(foo->quirka->fleeg);
|   }
|   free(foo->quirka);
| }
| free(foo);

In the error condition?

or even just:
| free_foo(foo);
( :-) )

If you make sure your structures don't have dangling pointers, then that has
got to be a good thing in my opinion.

Still neater (IMO) than the FAIL1: FAIL2: FAIL3: approach.

-- 
Lusercop.net - LARTing Lusers everywhere since 2002



[for sale] .com fall-out

2003-09-04 Thread Paul Makepeace
Good friend of mine is shifting his .com liquidation left-overs via a
auction site he's written. Some of the stuff is listed on ebay.
Monitors, networking, ... and even some UXD video kit.

http://www.bollingers.co.uk/assets/

Paul

-- 
Paul Makepeace ... http://paulm.com/

"If cats ate grass, then it matches your knees."
   -- http://paulm.com/toys/surrealism/



Re: Ob-buffy

2003-09-04 Thread Nigel Rantor
Rafael Garcia-Suarez wrote:
I've seen it. I some point I was looking at the original comic books
(never found them). It's true that the first episodes have some lynchean
colour, (not mentioning the presence of Robert Loggia), but Lynch didn't
participate in them, did he ?
Before I saw it I just got this weird vibe through the jungle that it 
was meant to be 'lynchean', and that ollie stone was directing it.

To be honest, I think maybe they we're trying to imbue some of Twin 
Peaks' surreality but then again I only saw the series, I didn't read WP 
before hand so I'm not sure what the original they were working with was 
like.

I don't beleive lynch participated, at least (as you point out on imdb) 
he isn't actually credited. Who knows what goes on though, these guys 
must get together and hack code (figurativley) with one another.

Anyway, I remember being really excited when I heard about it, perhaps 
if I had my anti-hype muffs back then I wouldn't have been so disappointed.

I think part of the problem was also that I missed a couple (because I 
didn't care about the story/characters anymore) and that just made it 
awful to follow.

Actually, maybe I'll see if anyone has it and just watch it 
back-to-back...hmm...

  N

p.s. Wow, I can ramble, can't I?




Re: perl windows apps

2003-09-04 Thread Paul Makepeace
Je 2003-09-04 13:21:00 +0100, Alex McLintock skribis:
> Is there a standard route for writing windows apps in perl? Do I have to go 
> down the TCL route? ActivePerl by itself?

wxWindows + Perl

http://wxperl.sourceforge.net/about.html
http://www.perl.com/pub/a/2001/09/12/wxtutorial1.html
http://www.cpan.org/modules/by-category/08_User_Interfaces/Wx/Wx-0.16.readme
http://sourceforge.net/projects/wxwindows/

Paul

-- 
Paul Makepeace ... http://paulm.com/

"What is my problem? Any possible variation of the basic theme."
   -- http://paulm.com/toys/surrealism/



Re: perl windows apps

2003-09-04 Thread Nicholas Clark
On Thu, Sep 04, 2003 at 01:23:09PM +0100, Joel Bernstein wrote:
> On Thu, Sep 04, 2003 at 01:21:00PM +0100, Alex McLintock wrote:
> > Is there a standard route for writing windows apps in perl? Do I have to go 
> > down the TCL route? ActivePerl by itself?
> > 
> ActivePerl. There's always Gtk2-Perl-Win32 as well.

and wxPerl, which seemed to produce "native" looking MS Windows apps on MS
Windows, and will also work on X if your requirements change in future
(and maybe other places too, I don't know)

Nicholas Clark



Re: Bad C Source (Re: gzipping your websites WINRAR 40 days trial)

2003-09-04 Thread Ben
On Thu, Sep 04, 2003 at 01:03:16PM +0100, Lusercop wrote:
> On Wed, Sep 03, 2003 at 11:48:19AM +0100, Simon Wistow wrote:
> > I have to admit, I like gotos in C. This is not a winning testimonial 
> > though. I've been told that my C is like Object Orientated assembler 
> > which is fair enough because I learnt C after I'd learnt 68k.
> 
> Hmmm, I like gotos too, but mainly for freeing.
> 
> [deliberately not snipped for context]
> > My code typically looks something like ...
> > 
> > quirka_t *
> > foo (foo_context * context, int * error)
> > {
> > /* malloc bar and if that fails set error and goto FAIL */
> > /* malloc quirka and if that fails set error and goto FAIL1 */
> > /* do something with quirka and if that fails, set error, goto FAIL2 */
> > 
> > SUCESS:
> > return quirka;
> > 
> > FAIL2: 
> > /* free quirka */
> > FAIL1:
> > /* free bar */
> > FAIL0:
> > return NULL;
> > }
> > apparently people ahve been known to be sick.
> 
> That is pretty ugly. The thing to remember is that in ANSI, "free(NULL);" is
> a) valid, and b) a NOOP. So I'd write that as:
> 
> | quirka_t *foo (foo_context *context, int *error) {
> |   bar_t *bar=NULL;
> |   quirka_t *quirka=NULL;
> |   
> |   bar=(bar_t *)malloc(sizeof(bar_t));
> |   if(!bar) goto error;
> |
> |   quirka=(quirka_t *)malloc(sizeof(quirka_t));
> |   if(!quirka) goto error;
> |
> |   /* do stuff */
> |
> |   end:
> | free(bar);
> | return(quirka);
> |   error:
> | free(bar);
> | free(quirka);
> | return(NULL);
> | }

This has the problem that if you're calloc'ing and initialising a complex
structure then the free's aren't necessarily that simple. Eg:

miner_t *smith (surbiton_context * context, int * error) {
miner_t * foo = NULL;

if ((foo = (miner_t *) calloc(1, sizeof(miner_t))) == NULL) {
*error = ENDORIAN;
goto FAIL1;
} 
if ((foo->quirka = (quirka_t *) calloc(1, sizeof(quirka_t))) == NULL) {
*error = ENDORIAN;
goto FAIL2;
}
if ((foo->quirka->fleeg = (fleeg_t *) calloc(1, sizeof(fleeg_t))) == NULL) {
*error = ENDORIAN;
goto FAIL3;
}

.


return foo;

  FAIL3: 
free(foo->quirka->fleeg);
return NULL;
  FAIL2:
free(foo->quirka);
return NULL;
  FAIL1:
free(foo);
return NULL;
}
   
With nested structures like these, this structured approach just seems
cleaner to me than all those temporaries kicking about.

Ben



Re: perl windows apps

2003-09-04 Thread Joel Bernstein
On Thu, Sep 04, 2003 at 01:21:00PM +0100, Alex McLintock wrote:
> Is there a standard route for writing windows apps in perl? Do I have to go 
> down the TCL route? ActivePerl by itself?
> 
ActivePerl. There's always Gtk2-Perl-Win32 as well.

/joel



perl windows apps

2003-09-04 Thread Alex McLintock
Is there a standard route for writing windows apps in perl? Do I have to go 
down the TCL route? ActivePerl by itself?

Cheers

Alex Mc






Re: Bad C Source (Re: gzipping your websites WINRAR 40 days trial)

2003-09-04 Thread Lusercop
On Wed, Sep 03, 2003 at 11:48:19AM +0100, Simon Wistow wrote:
> I have to admit, I like gotos in C. This is not a winning testimonial 
> though. I've been told that my C is like Object Orientated assembler 
> which is fair enough because I learnt C after I'd learnt 68k.

Hmmm, I like gotos too, but mainly for freeing.

[deliberately not snipped for context]
> My code typically looks something like ...
> 
>   quirka_t *
>   foo (foo_context * context, int * error)
>   {
>   /* malloc bar and if that fails set error and goto FAIL */
>   /* malloc quirka and if that fails set error and goto FAIL1 */
>   /* do something with quirka and if that fails, set error, goto FAIL2 */
> 
>   SUCESS:
>   return quirka;
> 
>   FAIL2: 
>   /* free quirka */
>   FAIL1:
>   /* free bar */
>   FAIL0:
>   return NULL;
>   }
> apparently people ahve been known to be sick.

That is pretty ugly. The thing to remember is that in ANSI, "free(NULL);" is
a) valid, and b) a NOOP. So I'd write that as:

| quirka_t *foo (foo_context *context, int *error) {
|   bar_t *bar=NULL;
|   quirka_t *quirka=NULL;
|   
|   bar=(bar_t *)malloc(sizeof(bar_t));
|   if(!bar) goto error;
|
|   quirka=(quirka_t *)malloc(sizeof(quirka_t));
|   if(!quirka) goto error;
|
|   /* do stuff */
|
|   end:
| free(bar);
| return(quirka);
|   error:
| free(bar);
| free(quirka);
| return(NULL);
| }

This has several advantages, IMO:
1) it's easy to check that you've free()d or dealt with everything that
   you've set up.
2) "goto error" is a very nice way of saying "this is an error condition",
   and you don't (yet) have to go and look at what the error condition
   handling is. Conversely, the error: label means that you can see what
   this function should return on error and normal return very quickly
   and easily.
3) You don't have to be able to work out what you've allocated and free()d,
   as long as you free or return all the stuff you *might* have allocated
   at the end.
4) it's always "goto error;" so you don't have to try and work out what
   state you might be in for some complicated state machine.

Of course, it goes without saying that if you want to free something in the
middle of the function, you have to do "free(foo); foo=NULL;", but that's
a minor disadvantage. The real disadvantage comes with the C99 concept of
scope, because you can't easily deal with the variables that only exist
within a scope, only within the scope of all of the function. You also need
to remember that you need #include  for NULL to be defined, but
since you're using the standard library functions, I'm going to assume that
you probably have stdio.h.

-- 
Lusercop.net - LARTing Lusers everywhere since 2002



Re: Ob-buffy

2003-09-04 Thread Rafael Garcia-Suarez
Nigel Rantor wrote:
> > Hopefully Lynch hasn't completely given away the
> > idea of coming back to TV...
> 
> And Wild Palms was forgettable. Well, I saw it and now it is forgotten. 

I've seen it. I some point I was looking at the original comic books
(never found them). It's true that the first episodes have some lynchean
colour, (not mentioning the presence of Robert Loggia), but Lynch didn't
participate in them, did he ?

http://www.imdb.com/title/tt0106175/



Re: Ob-buffy

2003-09-04 Thread Philip Newton
On 3 Sep 2003 at 17:28, Jonathan Peterson wrote:

> Twin Peaks winds me up. I remember being in school when it was on, and the 
> kind of people who were into it suffered from two other co-morbidities:
> 
> 1. They liked Marillion
> 2. They tried to understand R.E.M. lyrics

I never watched it but I remember that when I was in school (that would 
be around 1990, I think), the history teacher would occasionally 
threaten to give away what happened in a future Twin Peaks episode if 
people weren't attentive (when Germany was in the middle of the series 
but he had seen it all in Scotland, or something).

Cheers,
Philip
-- 
Philip Newton <[EMAIL PROTECTED]>