php-general Digest 5 May 2010 16:55:13 -0000 Issue 6728

Topics (messages 304896 through 304907):

Re: Inserting rows with missing IDs
        304896 by: Nathan Rixham
        304904 by: tedd

how to check for bandwidth limitations when uploading files?
        304897 by: Robert P. J. Day
        304898 by: Jochen Schultz
        304899 by: Tommy Pham
        304900 by: Robert P. J. Day
        304905 by: tedd

strtotime woes
        304901 by: Philip Thompson
        304902 by: Peter Lind
        304906 by: Philip Thompson

Re: In need of CVS/SVN checkout script for Production servers [solved]
        304903 by: tedd

Can't find my error
        304907 by: David McGlone

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Richard Quadling wrote:
On 3 May 2010 14:34, Andre Polykanine <an...@oire.org> wrote:
Hello everyone,
It's not a strictly PHP question, however since I use that with PHP,
I'm asking it there.
How can I accomplish the task of inserting rows into MySql database
with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
195. How do I make the check that allows to insert firstly the missing
IDs and only then apply the auto-increment?
Thanks!

You can also reseed the autoinc column back to 0 and that will start
filling in the gaps.

ALTER TABLE tablename AUTO_INCREMENT = 0

may work for you
(http://arstechnica.com/civis/viewtopic.php?f=20&t=123689 via
http://tinyurl.com/3amlo2u)


quite sure that once mysql hit's the max int limit it starts filling in the gaps too - like ~96.4% sure

have to agree though, one shouldn't have any dependency on sequential numbers (unless it's a number table!)

best,

nathan

--- End Message ---
--- Begin Message ---
Richard Quadling wrote:
On 3 May 2010 14:34, Andre Polykanine <an...@oire.org> wrote:
Hello everyone,
It's not a strictly PHP question, however since I use that with PHP,
I'm asking it there.
How can I accomplish the task of inserting rows into MySql database
with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
195. How do I make the check that allows to insert firstly the missing
IDs and only then apply the auto-increment?
Thanks!

You can also reseed the autoinc column back to 0 and that will start
filling in the gaps.

ALTER TABLE tablename AUTO_INCREMENT = 0

may work for you
(http://arstechnica.com/civis/viewtopic.php?f=20&t=123689 via
http://tinyurl.com/3amlo2u)


quite sure that once mysql hit's the max int limit it starts filling in the gaps too - like ~96.4% sure

have to agree though, one shouldn't have any dependency on sequential numbers (unless it's a number table!)

best,

nathan

And if they really want just a sequential number ID that they DO NOT depend upon, they can always drop the id from the table and then recreated it -- that way it will be automatically renumbered.

Cheers,

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

--- End Message ---
--- Begin Message --- probably not really a PHP question but i'll take a chance, anyway. i want to examine the network throughput i can get when continually uploading files from a PHP script via a POST request using the HTTP_Request2 class.

i have a client-side script that simply takes files, creates a short POST request, and submits it to a server-side PHP script that takes the uploaded file and saves it. no big deal.

as a test, i created a random 5M file, then looped 100 times submitting the same file, and timed it. while the system and user time was only a few seconds total, real (clock on the wall) time was 2.5 minutes. this suggests that the bottleneck is simply network transfer speed.

while i'm doing these uploads, is there a way to monitor network throughput? if this is truly the bottleneck, the only real solution will be to pay a premium for faster network access, i suppose. but i'd just like to be able to produce some numbers or evidence that that's the actual problem. thoughts?

rday


--- End Message ---
--- Begin Message ---
OS?

Robert P. J. Day schrieb:
probably not really a PHP question but i'll take a chance, anyway. i want to examine the network throughput i can get when continually uploading files from a PHP script via a POST request using the HTTP_Request2 class.

i have a client-side script that simply takes files, creates a short POST request, and submits it to a server-side PHP script that takes the uploaded file and saves it. no big deal.

as a test, i created a random 5M file, then looped 100 times submitting the same file, and timed it. while the system and user time was only a few seconds total, real (clock on the wall) time was 2.5 minutes. this suggests that the bottleneck is simply network transfer speed.

while i'm doing these uploads, is there a way to monitor network throughput? if this is truly the bottleneck, the only real solution will be to pay a premium for faster network access, i suppose. but i'd just like to be able to produce some numbers or evidence that that's the actual problem. thoughts?

rday



--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900            -
 26188 Edewecht      - GF: Michael Müllmann

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Robert P. J. Day [mailto:rpj...@crashcourse.ca]
> Sent: Wednesday, May 05, 2010 3:52 AM
> To: php-gene...@lists.php.net
> Subject: [PHP] how to check for bandwidth limitations when uploading
files?
> 
>    probably not really a PHP question but i'll take a chance, anyway.
> i want to examine the network throughput i can get when continually
> uploading files from a PHP script via a POST request using the
> HTTP_Request2 class.
> 
>    i have a client-side script that simply takes files, creates a short
POST
> request, and submits it to a server-side PHP script that takes the
uploaded
> file and saves it.  no big deal.
> 
>    as a test, i created a random 5M file, then looped 100 times submitting
the
> same file, and timed it.  while the system and user time was only a few
> seconds total, real (clock on the wall) time was
> 2.5 minutes.  this suggests that the bottleneck is simply network transfer
> speed.
> 
>    while i'm doing these uploads, is there a way to monitor network
> throughput?  if this is truly the bottleneck, the only real solution will
be to pay
> a premium for faster network access, i suppose.  but i'd just like to be
able to
> produce some numbers or evidence that that's the actual problem.
> thoughts?
> 
> rday
> 

IIRC, if you're on *BSD and have PF running, you can get the bandwidth of
each individual connection via pftop (?).  On Windows, there are several
tools that will give similar results.  Don't know about Linux.  OTOH, maybe
your script isn't timed correctly?  Is the tested loop done on the localhost
or from another remote host establishing the connection via the internet?
FYI, if you're hosting it yourself and have async connection like DSL or
cable, the upload to your server is the download connection speed which
should be faster than your upload (from the server) to the clients.  And a
5MB file shouldn't take long provided that your server hasn't reached its
resources limits and the internet pipe isn't consumed by other services or
systems on the LAN.

Regards,
Tommy


--- End Message ---
--- Begin Message ---
Quoting Jochen Schultz <jschu...@sportimport.de>:

OS?

Robert P. J. Day schrieb:
probably not really a PHP question but i'll take a chance, anyway. i want to examine the network throughput i can get when continually uploading files from a PHP script via a POST request using the HTTP_Request2 class.

i have a client-side script that simply takes files, creates a short POST request, and submits it to a server-side PHP script that takes the uploaded file and saves it. no big deal.

as a test, i created a random 5M file, then looped 100 times submitting the same file, and timed it. while the system and user time was only a few seconds total, real (clock on the wall) time was 2.5 minutes. this suggests that the bottleneck is simply network transfer speed.

while i'm doing these uploads, is there a way to monitor network throughput? if this is truly the bottleneck, the only real solution will be to pay a premium for faster network access, i suppose. but i'd just like to be able to produce some numbers or evidence that that's the actual problem. thoughts?

  whoops, sorry, CentOS 5.4.

rday


--- End Message ---
--- Begin Message ---
At 6:52 AM -0400 5/5/10, Robert P. J. Day wrote:
probably not really a PHP question but i'll take a chance, anyway. i want to examine the network throughput i can get when continually uploading files from a PHP script via a POST request using the HTTP_Request2 class.

i have a client-side script that simply takes files, creates a short POST request, and submits it to a server-side PHP script that takes the uploaded file and saves it. no big deal.

as a test, i created a random 5M file, then looped 100 times submitting the same file, and timed it. while the system and user time was only a few seconds total, real (clock on the wall) time was 2.5 minutes. this suggests that the bottleneck is simply network transfer speed.

while i'm doing these uploads, is there a way to monitor network throughput? if this is truly the bottleneck, the only real solution will be to pay a premium for faster network access, i suppose. but i'd just like to be able to produce some numbers or evidence that that's the actual problem. thoughts?

rday

You might want to test your connection, such as:

http://www.speakeasy.net/speedtest/

Cheers,

tedd


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

--- End Message ---
--- Begin Message ---
Hello all.

Long time no see! Anyway, I'm having an issue with strtotime(). Why do the 
following return valid timestamps?

<?php
echo strtotime ('a').': '.date ("m/d/Y", strtotime ('a'))."<br/>";
echo strtotime ('a,a').': '.date ("m/d/Y", strtotime ('a,a'))."<br/>";
echo strtotime ('a,a,a').': '.date ("m/d/Y", strtotime ('a,a,a'))."<br/>";
?>

These result in today's date:

1273049449: 05/05/2010
1273049449: 05/05/2010
1273049449: 05/05/2010

Each time the page is reloaded, the seconds jump up... but still today's date. 
Why is this? I can repeat the same results by changing the 'a' to any other 
single letter: "g" or "h,k" or "r,s,t" or whatever - all the same result.

Thanks,
~Philip

--- End Message ---
--- Begin Message ---
On 5 May 2010 16:58, Philip Thompson <philthath...@gmail.com> wrote:
> Hello all.
>
> Long time no see! Anyway, I'm having an issue with strtotime(). Why do the 
> following return valid timestamps?
>
> <?php
> echo strtotime ('a').': '.date ("m/d/Y", strtotime ('a'))."<br/>";
> echo strtotime ('a,a').': '.date ("m/d/Y", strtotime ('a,a'))."<br/>";
> echo strtotime ('a,a,a').': '.date ("m/d/Y", strtotime ('a,a,a'))."<br/>";
> ?>
>
> These result in today's date:
>
> 1273049449: 05/05/2010
> 1273049449: 05/05/2010
> 1273049449: 05/05/2010
>
> Each time the page is reloaded, the seconds jump up... but still today's 
> date. Why is this? I can repeat the same results by changing the 'a' to any 
> other single letter: "g" or "h,k" or "r,s,t" or whatever - all the same 
> result.
>

This was discusses a little while ago, have a look at
news.php.net/php.general/303839/Logical-reason-for-strtotime-east-and-strtotime-west-returningvalid-results.html
and the responses.

Regards
Peter

-- 
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>

--- End Message ---
--- Begin Message ---
On May 5, 2010, at 10:12 AM, Peter Lind wrote:

> On 5 May 2010 16:58, Philip Thompson <philthath...@gmail.com> wrote:
>> Hello all.
>> 
>> Long time no see! Anyway, I'm having an issue with strtotime(). Why do the 
>> following return valid timestamps?
>> 
>> <?php
>> echo strtotime ('a').': '.date ("m/d/Y", strtotime ('a'))."<br/>";
>> echo strtotime ('a,a').': '.date ("m/d/Y", strtotime ('a,a'))."<br/>";
>> echo strtotime ('a,a,a').': '.date ("m/d/Y", strtotime ('a,a,a'))."<br/>";
>> ?>
>> 
>> These result in today's date:
>> 
>> 1273049449: 05/05/2010
>> 1273049449: 05/05/2010
>> 1273049449: 05/05/2010
>> 
>> Each time the page is reloaded, the seconds jump up... but still today's 
>> date. Why is this? I can repeat the same results by changing the 'a' to any 
>> other single letter: "g" or "h,k" or "r,s,t" or whatever - all the same 
>> result.
>> 
> 
> This was discusses a little while ago, have a look at
> news.php.net/php.general/303839/Logical-reason-for-strtotime-east-and-strtotime-west-returningvalid-results.html
> and the responses.
> 
> Regards
> Peter

Thanks for the link. I did a little bit more research and found a site that may 
help explain what is happening.

http://wwp.greenwichmeantime.com/info/timezone.htm

In the column labeled "Zone" are all the letters of the alphabet (except J). 
So, then I thought to print the times with the date() functions above - they 
were various time(zones). Basically, I think strotime() is just ignoring the 
characters after the first comma in the values above, so then it was finding 
valid timezones. Odd.

Hope this helps someone in the future....

Thanks,
~Philip

--- End Message ---
--- Begin Message ---
At 1:10 PM -0700 5/4/10, Daevid Vincent wrote:
Well, here is the one I'm using. I ended up just writing one (again!)

http://www.daevid.com/content/examples/snippets.php :: "Production
Deployment Script"

What?!?

Advanced features??

I know you don't mean it, but you certainly know how to piss people off. You are not going to like what I have to say, but please accept the following as constructive criticism with no personal intent meant.

The site fails W3C CSS validation with 96 errors.

The site fails W3C HTML validation with 92 errors and 9 warnings.

I have not run into a site like this since before the turn of this century where we had browser wars. The problem isn't just with my browser, but many more as you can see here:

http://www.browsercam.com/public.aspx?proj_id=516739

The page (not addressing the entire site) is riddled with embedded javascript and embedded styling both of which are considered bad from.

I haven't even addressed accessibility, graceful degradation, or separation of content from presentation from behavior all of which are the goals of "best practices" sites -- and all of which this site fails miserably.

My advice, which I realize that you didn't ask for, is if you want to provide something of substance, then do so for all and not just the privileged elite who think they are the leading edge with this type of "gimmick" nonsense. This site is a step backward into the old browser wars.

Of course, I could tell you what I really think, but I don't want to be too abrasive. :-)

Cheers,

tedd

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

--- End Message ---
--- Begin Message ---
I've checked and checked and re-checked and I can't figure out what I've done 
wrong. I'm getting a parse error:

Parse error: syntax error, unexpected T_VARIABLE in 
/home/david/www/Joe/current/presentation/smarty_plugins/function.load_products_list.php
 
on line 27.

Can anyone spot my error? I'd appreciate the help.

Here is the function.load_products_list.php file:

1. <?php
2. function smarty_function_load_products_list($params, $smarty)
3. {
4.      $products_list = new $ProductsList();
5.      $products_list->init();
6.      
7.      //assign the template variable
8.      $smarty->assign($params['assign'], $products_list);
9. }
10.
11. //Manage the products list
12. class ProductsList
13. {
14.     public $mProducts;
15.     public $mSelectedProduct;
16.     
17.     private $mBoCatalog;
18.     
19.     //constructor initializes business tier object
20.     //and reads query string parameter
21.     function __construct()
22.     {
23.             //creating the middle tier object
24.             $this->mBoCatalog = new BoCatalog();
25.             //if ProductID exists in the query string, we're viewing a 
product.
26.             if(isset($_GET['ProductID']))
27.             $this->mSelectedProduct = (init)$_GET['ProductID'];
28.             else
29.                     $this->mSelectedProduct = -1;
30      }
31.
32.     //calls business tier to read products list and create the links
33.     function init()
34.     {
35.             //get list of products from business tier
36.             $this->mProducts = $this->mBoCatalog->GetProducts();
37.             //create the product links
38.             for($i = 0; $i < count($this->mProducts); $i++)
39.             $this->mProducts[$i]['onclick'] = "index.php?ProductID=" .
40.   $this->mProducts[$i]['product_id'];
41.     }
42. }
43. ?>

Just in case Im going to include the template file:

{*products_list.tpl*}

{load_products_list assign="products_list"}

{*start products_list*}
<p>Products</p>
{*loop through the list of products*}
{section name=i loop=$products_list->mProducts}
{if ($products_list->mSelectedProduct ==
$products_list->mProducts[i].product_id)}
{assign var=class_d value="ProductSelected"}
{else}
{assign var=class_d value="ProductUnselected"}
{/if}
{*generate a link for a new product in the list*}
<a href="{$products_list->mProducts[i].onclick}">
$raquo; {$products_list->mProducts[i].make}</a>
{/section}


-- 
Blessings,
David M.

--- End Message ---

Reply via email to