Re: [PHP] Help needed with calculation

2009-11-15 Thread Adam Shannon
If the download speed is constant (linear) then you can just use.

(10245458756 / 6t)/1000 = kb/second
or
(10245458756 / 6t)/6 = kb/minute

The general form would be.
(size_of_file / download_speed * time) / convert_to_units

Where t (or time) is the amount of seconds that the download has been active.


On Sun, Nov 15, 2009 at 15:39, Chris Payne chris_pa...@danmangames.com wrote:
 Hi everyone,

 I'm not sure of the correct formula for this, if I have a file - just
 for example, that is 10245458756 bytes long and the download speed is
 60KB a second, what formula would I use to calculate how many
 seconds/minutes/hours it would take to download the file?

 Maths really isn't my strong point and formulas go over my head
 otherwise I wouldn't ask :-(

 Thanks everyone

 Chris

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
- Adam Shannon ( http://ashannon.us )

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] link to a css file requires .css ???

2009-08-16 Thread Adam Shannon
On Sun, Aug 16, 2009 at 4:37 PM, Daniel Kolbo kolb0...@umn.edu wrote:

 Hello,

 I realize this is more of an html question than a php, but I was hoping
 someone here would know what's going on.

 I am linking to a stylesheet and it is requiring me to use *.css
 extension. I want to use a .php extension (and have the php engine
 generate css). However, whenever i use a .php extension the link tag
 does not seem to work.

 This works!
 link rel=stylesheet type=text/css
 href=http://localhost:8080/some.css; /

 This doesn't work but I don't understand why not???
 link rel=stylesheet type=text/css
 href=http://localhost:8080/some.php; /

 The page http://localhost:8080/some.php displays the css exactly the
 same as http://localhost:8080/some.css

 Why can't I link to a css file by using a different extension?

 Thanks in advance,
 dK
 `

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


Oh, I think it's part of the spec. You could always use .htaccess rules to
parse .css files as .php, this will keep search engines happy and browsers
happy as well.

-- 
- Adam Shannon ( http://ashannon.us )


Re: [PHP] Include Paths

2009-08-12 Thread Adam Shannon
On Wed, Aug 12, 2009 at 10:02 AM, Julian Muscat Doublesin 
opensourc...@gmail.com wrote:

 I had a problem with the include and require paths when using AJAX. This I
 have solved by using the document root. However since doing so I am
 experiencing performance issues. Loading 20 records has suddenly turned
 into
 something of a matter of a minute rather then seconds.

 Has anyone ever experienced such an issue?

 Can anyone please advise?

 Thanks


I wonder if loading the script/page with an absolute path would fix the
problem.



-- 
- Adam Shannon ( http://ashannon.us )


Re: [PHP] Image Headers break when image is out of bounds

2009-08-11 Thread Adam Shannon
On Tue, Aug 11, 2009 at 1:08 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Tue, 2009-08-11 at 19:02 +0100, Ashley Sheridan wrote:
  I've got a bit of a weird one here. I'm using PHP to output an image.
  This works fine when I output as a file, but when I try to feed it
  directly to the browser it fills the screen with random characters.
 
  I know I've got the headers right, as it works some of the time. The
  only thing I can spot when it does fail is that some of the image
  drawing commands are essentially drawing off the edge of the image area.
  I've checked the error logs, and the only errors/notices I can find
  today are a bug in phpMyAdmin and a missing favicon file, nothing to do
  with this script.
 
  Has anybody ever noticed a similar problem?
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 Oh. I should note that there has been no headers sent already, as I put
 the image output part inside of a if(!headers_sent()) block. The headers
 I'm using for the PNG image are:

 header(Content-Type: image/png);
 header(Pragma: no-cache);
 header(Expires: 0);

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


Take the if (!headers_sent()) out and always send the headers.

-- 
- Adam Shannon ( http://ashannon.us )


Re: [PHP] need to get .html files parsed by PHP. -- WAS: why does PHP parse *.html files in one subdir/ but not in another?

2009-07-19 Thread Adam Shannon
On Sun, Jul 19, 2009 at 10:00 AM, Govinda govinda.webdnat...@gmail.comwrote:

  Most security issues have nothing to do with the programming language
 and everything to do with the code. Just because facebook uses the
 .php extension certainly does not mean their code has no security
 holes and even if it's clean it certainly doesn't mean your code will
 be secure.


 Stuart I hear you.  Writing rock solid code is my aim..  I was just trying
 to cover my butt a little (for whatever very little it is worth) in the
 meanwhile by way of obfuscation.


 If you really want to hide the fact that you're using PHP you need to
 make sure that...

 * You're not using the .php extension


 thus my OP.

  * You turn expose_php off in your php.ini


 what does this one ^^^ do exactly ?


It turns off the Powered By: PHP v5.30 on Apache/IIS Error messages.




  * You turn display_errors off in your php.ini



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
- Adam Shannon ( http://ashannon.us )


Re: [PHP] why does PHP parse *.html files in one subdir/ but not in another?

2009-07-18 Thread Adam Shannon
On Sat, Jul 18, 2009 at 7:54 PM, Govinda govinda.webdnat...@gmail.comwrote:


 On Jul 18, 2009, at 6:36 PM, Adam Shannon wrote:



 On Sat, Jul 18, 2009 at 7:01 PM, Govinda govinda.webdnat...@gmail.comwrote:

 Hi all,

 ..sitting here thinking this is so easy, and I must have been over this
 already in the past..  but it is eluding me just now..

 I can't figure out why files with the .html extension ARE being parsed by
 PHP when they are in the main doc root dir/, or in one subdirectory down
 from there..  BUT NOT when in *another* new subdirectory that I just
 created.  Both subdirectories have the exact same perms (same owner  group
 too), both have the same php.ini file in them,...  neither have an .htaccess
 file in them..  (if that would matter?).

 Anyway I just need to get PHP tp process all .html files in this and in
 any new subdirectory(ies) that I will make.
 Can someone point me to what I need to pay attention to?


 It sounds like your .htaccess file may be telling .html files in a
 /sub/directory/ to treat .html files as .php

 Just add this to your root .htaccess
 AddType x-mapp-php5 .html


 Thanks Adam.  But still no luck.  I did add that line to the .htaccess file
 in my doc root, but my file.html in subdir/ is still not being parsed by
 PHP.
 ??


Try to put that same line of .htaccess into the sub directory.  Your host
may not allow .htaccess rules to be many directories deep.



 -G




-- 
- Adam Shannon ( http://ashannon.us )


Re: [PHP] why does PHP parse *.html files in one subdir/ but not in another?

2009-07-18 Thread Adam Shannon
On Sat, Jul 18, 2009 at 7:01 PM, Govinda govinda.webdnat...@gmail.comwrote:

 Hi all,

 ..sitting here thinking this is so easy, and I must have been over this
 already in the past..  but it is eluding me just now..

 I can't figure out why files with the .html extension ARE being parsed by
 PHP when they are in the main doc root dir/, or in one subdirectory down
 from there..  BUT NOT when in *another* new subdirectory that I just
 created.  Both subdirectories have the exact same perms (same owner  group
 too), both have the same php.ini file in them,...  neither have an .htaccess
 file in them..  (if that would matter?).

 Anyway I just need to get PHP tp process all .html files in this and in any
 new subdirectory(ies) that I will make.
 Can someone point me to what I need to pay attention to?


It sounds like your .htaccess file may be telling .html files in a
/sub/directory/ to treat .html files as .php

Just add this to your root .htaccess
AddType x-mapp-php5 .html



 Thank you
 -Govinda



 
 Govinda
 govinda.webdnat...@gmail.com




-- 
- Adam Shannon ( http://ashannon.us )


Re: [PHP] Re: RFC/Survey for Our Newer Folks (Including Lurkers)

2009-07-11 Thread Adam Shannon
Hello,

I've been a developer for a little over a year now (I started when I just
turned 16), frankly I love coding and helping out others.  I joined the list
as my second mailing list (WHATWG is first), mailing lists just provide a
different atmosphere than forums, blogs or message boards.
I found the list by the link on php.net (lists.php.net),  I mainly joined to
grow in my experience with PHP.
-- 
- Adam Shannon ( http://ashannon.us )


Re: [PHP] Split up Date Range

2009-07-01 Thread Adam Shannon
It would be easier to standardize the input so you only have to run one
regular expression check to validate and then split the data up.

On Wed, Jul 1, 2009 at 10:33 AM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Wednesday 01 July 2009 16:25:29 Matt Neimeyer wrote:
  I haven't been able to find anything by googling... Does anyone know
  of any libraries that will split up date ranges? We've got a project
  where Date Of Attendance is moving from a single type in character
  field to an automatically built field based on a DateBegin date field
  and a DateEnd date field. Some examples of what I'd like ideally...
 
  Given: July 19-22, 2009
  Return: 7/19/2009 and 7/22/2009
 
  Given: July 19th and 20th
  Return: 7/19/2009 and 7/20/2009 (we can safely assume current year for
  this project)
 
  Given: Sept 19, 2009 - Sept 22, 2009
  Return: 9/19/2009 and 9/22/2009
 
  Given: July 19th, 2009
  Return: 7/19/2009 and 7/19/2009
 
  Given: 7/19/2009
  Return: 7/19/2009 and 7/19/2009
 
  I could probably hack something together that would work most of the
  time... but why reinvent the wheel if some poor shlub has already done
  it.
 
  If such a thing doesn't exist... then I'm considering an algorithm
  like such... (and advice... yays and nays are appreciated)
 
  Replace the names (and variations thereof) of the months with their
  numeric equivilants followed by a comma. So the above would become...
 
  7, 19-22, 2009
  7, 19th and 20th
  9, 19, 2009 - 9, 22, 2009
  7, 19th, 2009
  7/19/2009
 
  Then replace all the th and nd and st with nothing... replace all the
  ands with a dash... and eliminate spaces... and change / to ,
  Giving...
 
  7,19-22,2009
  7,19-20
  9,19,2009-9,22,2009
  7,19,2009
  7,19,2009
 
  Then explode on commas. If you have two elements populate the third
  with the current year. (This fixes 7,19-20 to 7,19-20,2009). Not a
  given example, but it would also fix 7/19 to 7,19,2009.
 
  When you have three elements then you have a valid date. Loop over
  each element and populate begin and end, if you find a dash in the
  current element then split on the dash and populate as needed. Yes
  this would allow 7-8,19-20,2009 to create 7/19/2009 and 8/20/2009 but
  I think its as safe as any assumption that regular people wouldn't
  enter that as a date range.
 
  If you have more than three elements then split on the dash and as
  long as you have have only two elements then consider each item by
  itself.
 
  If it's not handled by the above rules then don't split it up.
 
  Thanks in advance.
 
  Matt

 Wow, first question is, why accept such a variety of inputs? Can't you
 force a
 particular standard for people that allows them to enter a range?

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
- Adam Shannon ( http://ashannon.us )


Re: [PHP] Apache module PHP 5.3 on Windows

2009-07-01 Thread Adam Shannon
Yes, you need to use the V6 installer, I did the same thing with the V9 and
it won't work.  Only after uninstalling PHP did I see that line of text
saying which one to use...

On Wed, Jul 1, 2009 at 5:54 PM, Jonathan Tapicer tapi...@gmail.com wrote:

 What version, VC6 or VC9, TS or NTS? I use VC6 TS and the dll is there...

 On Wed, Jul 1, 2009 at 7:31 PM, Pablo Viquezpviq...@pabloviquez.com
 wrote:
  Hi,
 
  I just downloaded the new stable version of PHP 5.3 and I couldnt find
 the
  php5apache2_2.dll file.
 
  Is the apache module on windows no longer supported?
 
  Thanks!
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
- Adam Shannon ( http://ashannon.us )