Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

nisc wwwxxx, wwwxxx0cm, should producers of software-based services, such as atms, be held liable for economic injuries suffered when their systems fail?, wwwxxx0cm, www.webdp.net, Event 9 IIS log failed to write entry, wwwxxx jeffs, Catastrophic failure Unexpected method call sequence. 0x8000ffff (-2147418113)., ksh lock a file, [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_DBC failed

Links

XODOX
Impressum

#1: Create Unique Message-ID

Posted on 2007-06-22 12:45:45 by yig

Hi,
I've scoured google for this, and have found lots of possible solutions,
but none seems to work.

I'm trying to create a unique Message-ID that will go in the top of a
Usenet post. So obviously, each ID has to be unique, and I did this once
before, but can't remember how. I think I did my $id = `date`; or
something and then when it came to creating the header, it was
$message_id=$id, "@yahoo.fr" or something.

The problem is that `date`generates the date in .. well, in the wrong
format. I need it in like say just seconds. So I can have unique IDs like
"9283736663616@yahoo.fr" or something.

Help!

Report this message

#2: Re: Create Unique Message-ID

Posted on 2007-06-22 13:37:40 by paduille.4061.mumia.w+nospam

On 06/22/2007 05:45 AM, yig wrote:
> Hi,
> I've scoured google for this, and have found lots of possible solutions,
> but none seems to work.
>
> I'm trying to create a unique Message-ID that will go in the top of a
> Usenet post. So obviously, each ID has to be unique, and I did this once
> before, but can't remember how. I think I did my $id = `date`; or
> something and then when it came to creating the header, it was
> $message_id=$id, "@yahoo.fr" or something.
>
> The problem is that `date`generates the date in .. well, in the wrong
> format. I need it in like say just seconds. So I can have unique IDs like
> "9283736663616@yahoo.fr" or something.
>
> Help!
>
>

I don't think you should use @yahoo.fr unless you're the company Yahoo
in France.

Anyway, Perl's time() function returns the time in seconds since an epoch.

#!/usr/bin/perl
print time() . '@mydomian.example.com';


__HTH__

Report this message

#3: Re: Create Unique Message-ID

Posted on 2007-06-22 16:35:29 by yig

Mumia W. <paduille.4061.mumia.w+nospam@earthlink.net> wrote:
> On 06/22/2007 05:45 AM, yig wrote:
>> Hi,
>> I've scoured google for this, and have found lots of possible solutions,
>> but none seems to work.
>>
>> I'm trying to create a unique Message-ID that will go in the top of a
>> Usenet post. So obviously, each ID has to be unique, and I did this once
>> before, but can't remember how. I think I did my $id = `date`; or
>> something and then when it came to creating the header, it was
>> $message_id=$id, "@yahoo.fr" or something.
>>
>> The problem is that `date`generates the date in .. well, in the wrong
>> format. I need it in like say just seconds. So I can have unique IDs like
>> "9283736663616@yahoo.fr" or something.
>>
>> Help!

> I don't think you should use @yahoo.fr unless you're the company Yahoo
> in France.

You're quite right, of course. My bad.

> Anyway, Perl's time() function returns the time in seconds since an epoch.
>
> #!/usr/bin/perl
> print time() . '@mydomian.example.com';
> > __HTH__

It does: many thanks.

Report this message

#4: Re: Create Unique Message-ID

Posted on 2007-06-22 21:23:34 by Joe Smith

yig wrote:

> I'm trying to create a unique Message-ID that will go in the top of a
> Usenet post. So obviously, each ID has to be unique,

I would use an ID that includes the time, includes a counter (in case more
than one message per second), includes the process-ID (in case multiple
instances running at the same time), and includes the host name (required).

my $hostname = 'yahoo-fr.example.com';
for (my $count = 0;; ++$count) {
my $message_id = time() . ".$count.$$.$domain";
send_message($message_id);
}

-Joe

Report this message

#5: Re: Create Unique Message-ID

Posted on 2007-06-23 22:36:09 by rvtol+news

Joe Smith schreef:
> yig:

>> I'm trying to create a unique Message-ID that will go in the top of a
>> Usenet post. So obviously, each ID has to be unique,
>
> I would use an ID that includes the time, includes a counter (in case
> more than one message per second), includes the process-ID (in case
> multiple instances running at the same time), and includes the host
> name (required).
>
> my $hostname = 'yahoo-fr.example.com';
> for (my $count = 0;; ++$count) {
> my $message_id = time() . ".$count.$$.$domain";
> send_message($message_id);
> }

ITYM: my $message_id = time() . ".$count.$$\@$hostname";

You could reset $count when time() has changed.

my $hostname = 'yahoo-fr.example.com';

my $time = time;

my $count = 0;

for my $msg (@messages) {
++$count;
$msg->message_id( qq{$time.$count.$$\@$hostname} );
if ( (my $t = time) != $time ) {
$time = $t;
$count = 0;
}
}

--
Affijn, Ruud

"Gewoon is een tijger."

Report this message