You are here: Re: Free internet components for developers « PHP Programming Language « IT news, forums, messages
Re: Free internet components for developers

Posted by Jerry Stuckle on 07/25/07 15:52

Webrickco wrote:
> On Jul 25, 4:13 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> Webrickco wrote:
>>> On Jul 25, 3:46 pm, Rik <luiheidsgoe...@hotmail.com> wrote:
>>>> On Wed, 25 Jul 2007 16:25:13 +0200, Webrickco <webric...@gmail.com> wrote:
>>>>> A race condition?
>>>> You write in a file that may be opened by another instance of the same
>>>> counter[*]. At least implement something like flock() so you make sure
>>>> your own scipt doesn't bug.
>>>> [*]
>>>> Chronological:
>>>> 1. First request
>>>> 2. Second request
>>>> 3. 1.Opening for writing.
>>>> 4. 2.Opening for writing.
>>>> 5. 1.Writing to file.
>>>> 6. 2.Writing to file.
>>>> What do you think will happen? It all depends on being written to & closed
>>>> before opening it again in another instance.
>>>> --
>>>> Rik Wasmus
>>> This is a simple technical solution, that certainly would work for
>>> most of the sites. What are the odds 2 different users open the page
>>> at the exact same time? and if so, what would be the result? Miss one
>>> count! In professional IT, you have to measure the odds against the
>>> cost. Not everything is implementable regarding the costs. Consider
>>> this a will-serve-in-most-case solution.
>>> But the solution is always discutable. I thank you for your
>>> contribution!
>> With any reasonably active website, eventually it's almost 100%.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================- Hide quoted text -
>>
>> - Show quoted text -
>
> Well, try do do it on my site. The same page (under the link
> "counter") accesses the same file twice. When i press refresh, it adds
> 2 to the counter.

As I said - ANY REASONABLY ACTIVE WEBSITE.


> Anyway, even if i'm not familiar with internal processing of servers,
> i'm sure most of them have queuying facility, like most serious
> servers, like mainframes, under monitors like CICS have, garantying
> units of work are processed sequencially and never at the same time.

Only if there are locks held. You have created no locks, so there is no
guarantee.

Even in CICS, many requests are not held across CICS calls unless you
create your own locks. ISAM locks are an exception to the rule, but
most others are not.

But this also isn't CICS. And it doesn't work the same way.

> But i let this to your consideration.
> Also considering that a request like this very simple function is
> processed within the same ms, the "reasonably active website" you are
> talking about, represents something like some million hits a day! I do
> not believe that kind of site, would show an ugly counter like mine!
>

Nope, not "millions of hits a day". Thousands will do it, eventually.
The laws of averages will catch up to you.

The bottom line is - if you're going to write something and make it
available to the public, you need to do it correctly. And be prepared
to take constructive criticism like Rik gave you.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация