php-general Digest 1 Jan 2007 20:15:42 -0000 Issue 4545

Topics (messages 246310 through 246320):

Happy new year!
        246310 by: JMCS Niagara (Jeff)

Temporary Emails - Your Recommendations - An Appeal to the PHP Community
        246311 by: Jason Paschal
        246313 by: Roman Neuhauser
        246316 by: tedd

Re: Request of php5
        246312 by: Roman Neuhauser
        246315 by: edwardspl.ita.org.mo

[PHP-DEV] Semaphores - feature request
        246314 by: Wojciech Malota

Re: Best way to manage open slots for download
        246317 by: tedd

Snow on the logo
        246318 by: tedd
        246319 by: Paul Waring

Writing Binary
        246320 by: Philip W.

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Happy new year everyone :)

--- End Message ---
--- Begin Message ---
i realize this isn't the appropriate mailing list and i risk being
black-listed (flame, defamed, ignored, etc.).

i occasionally use temporary emails when registering for forums or to get
some shareware (we've all done it, don't give me that look, i have given
what i could, when i could) and while i like the way mytrashmail.com works,
i don't like having mytrashmail.com as part of the temp addy.

does anyone know of a similar service that uses a more enticing domain?

thank you,
jason

--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2007-01-01 05:26:43 -0500:
> i realize this isn't the appropriate mailing list and i risk being
> black-listed (flame, defamed, ignored, etc.).
> 
> i occasionally use temporary emails when registering for forums or to get
> some shareware (we've all done it, don't give me that look, i have given
> what i could, when i could) and while i like the way mytrashmail.com works,
> i don't like having mytrashmail.com as part of the temp addy.
> 
> does anyone know of a similar service that uses a more enticing domain?

you-can.diy

a domain costs pennies and all the required software is free.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--- End Message ---
--- Begin Message ---
At 5:26 AM -0500 1/1/07, Jason Paschal wrote:
i realize this isn't the appropriate mailing list and i risk being
black-listed (flame, defamed, ignored, etc.).

i occasionally use temporary emails when registering for forums or to get
some shareware (we've all done it, don't give me that look, i have given
what i could, when i could) and while i like the way mytrashmail.com works,
i don't like having mytrashmail.com as part of the temp addy.

does anyone know of a similar service that uses a more enticing domain?

thank you,
jason

jason:

A couple ideas:

1. I've used the same email address (my name) for almost 12 years. It's on more spam list than I care to count, but that doesn't brother me because I filter all my email through spamcop.net. My spam count is below 5% of total email received BY ME. You might consider their services for $35US pr year.

2. You can always buy domains (<$10 per year), set them up via cheap hosting (<$10 per year), and have as many addresses as you want.

tedd

PS: I've never used temporary emails for anything other than testing.
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2007-01-01 14:40:14 +0800:
> Dear All,
> 
> Happy New Year,
> 
> How much mem ( Ram ) does the php5 need ?

As much as you make it use.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--- End Message ---
--- Begin Message ---
Roman Neuhauser wrote:

># [EMAIL PROTECTED] / 2007-01-01 14:40:14 +0800:
>  
>
>>Dear All,
>>
>>Happy New Year,
>>
>>How much mem ( Ram ) does the php5 need ?
>>    
>>
>
>As much as you make it use.
>
>  
>
Sorry, pardon me !

--- End Message ---
--- Begin Message ---
It's impossible to correct remove semaphores with sem_remove function
when I use them to provide execution of concurrent processes.
When the last process releases the semaphore I should be able to remove
it. But I don't know if another process haven't acquired the semaphore.
For safety reasons I don't remove released semaphores from system.
Now, If I get 128 semaphores and I execute sem_get one more time I will
get warning.
So, I can't remove semaphores (because I don't know if another process
is using it) and I can't get next semaphore.
I will try to tell about my sugestion.

I assume that I have a function my_sem_remove($sem_id):

function my_sem_remove($id) {
  if(Semaphore $id isn't acquired and its FIFO is empty)
    sem_remove($id);
}
None of instructions in this function can be interrupted.
So, now the problem is simple to resolve:

$id = sem_get(ID);
sem_acquire($id);

CRITICAL REGION

sem_release($id);
my_sem_remove($id);

But now, two instructions: sem_release and my_sem_remove are not needed.
It's simple to replace them by one function my_sem_release:

function my_sem_release($id) {
  sem_release($id);
  my_sem_remove($id);
}

For reasons which about I will write later those instructions can't be
interrupted.

So, my example look like this:

$id = sem_get(ID);
sem_acquire($id);

CRITICAL REGION

my_sem_release($id);

But let's imagine two concurrent processes executing code above:

PROC1: $id = sem_get(ID);
<---  interrupt
PROC2: $id = sem_get(ID);
       sem_acquire($id);
       CRITICAL REGION
       my_sem_release($id);
<--- interrupt
PROC1: sem_acquire($id); <--- Uuups!! Error: semaphore doesn't exists,
PROC2 has removed it.

My solution:
Instructions sem_get and sem_acquire can't be interrupted.
So, I assume that there is a function my_sem_acquire:

function my_sem_acquire($key, $max_acquire = 1, $perm = 0666,
$auto_release = true) {

  $id = sem_get($key, $max_acquire, $perm, $auto_release);
  sem_acquire();
  return $id;
}

None of instructions in function above can be interrupted.

And finally correct example:

$id = my_sem_acquire(SEMKEY);

CRITICAL REGION

my_sem_release($id);

It's the best solution, without danger of operating on not existing
semaphores. Also, unused semaphores are automaticcally removed. The
problem is, that functions my_sem_acquire and my_sem_release can't be
witten in PHP so it must be done in C inside source of PHP.Wojciech Malota 

--- End Message ---
--- Begin Message ---
At 10:15 AM -0500 12/31/06, Rasmus Lerdorf wrote:

 > What other ways can you recommend to me for the situtation?

Read through this:

http://www.php.net/manual/en/features.connection-handling.php

-Rasmus

-Rasmus:

Just want to express my gratitude for your attendance to this list.

Thanks.

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
Hi gang:

I've just noticed that the php.net logo changes with the seasons -- I think that's neat, in fact, I do a similar season change with my site.

However, does the php logo change for those in the southern hemisphere? In other words, for oz programmers, do they see a different logo? If so, how does one (or can) detect the user's hemisphere?

Thanks.

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Mon, 1 Jan 2007 10:50:04 -0500, tedd <[EMAIL PROTECTED]> wrote:
> However, does the php logo change for those in the southern
> hemisphere? In other words, for oz programmers, do they see a
> different logo? If so, how does one (or can) detect the user's
> hemisphere?

Detecting a user's geographical location is a bit hit and miss, but there are 
some databases (both free and paid for) that you can use to map an IP address 
to a country and at that level it's usually fairly accurate (the further you 
try to narrow it down, the less accurate your results will be). Have a look at 
these databases, and a search for 'geoip' or 'libgeoip' on Google should get 
you some more results:

http://www.hostip.info/
http://www.maxmind.com/app/geoip_country

Hope this helps.

Paul

--- End Message ---
--- Begin Message ---
Hello Everyone,
I'm trying to write a PHP script that opens a binary file, reads the binary in chunks, checks those chunks for a certain binary string, and then if the string is found, it replaces the string with another binary string. The script should then a copy of the file, including the changed bits. But for some reason, the script is not replacing the binary string.

Here's the source code:

<?php

$in = fopen("C:\NeighborhoodManager.package", "rb");
$out = fopen("C:\NeighborhoodManager2.package", "w");
$count = 0;

while (!feof($in)) {
 $count++;
 $buffer = fread($in,50000);
if (eregi("0101001101110100011100100110000101101110011001110110010101110100011011110111011101101110",$buffer))
 {
$buffer2=eregi_replace("0101001101110100011100100110000101101110011001110110010101110100011011110111011101101110","0101011001101001011000110111010001101111011100100110100101100001",$buffer);
 }
 else
 {
   $buffer2 = $buffer;
 }
 fwrite($out,$buffer2);
}
fclose($out);
fclose($in);
print("About ".($count*50000)." bytes read.\n");

?>

The resulting file is not changed at all, the size, md5 sums, and contents are the same as the original file. The original file is only 40,960 bytes on the disk, so the script reads the file in one pass. I am sure the binary string is in the original file, and I have tried reading the file into chunks as small as 64 bytes. I am at a loss as to what is happening, so I would appreciate any help.

Sincerely,
Philip W.

--- End Message ---

Reply via email to