[PHP] PHP 5.2.9 + NCurses

2009-07-30 Thread Martin Scotta
Hi all I have start a shell script and I want to use ncurses. It was a quite difficulty to get it working, but now I'm done to start to develop. I have already search on sf.net and phpclasses and found a couple, but I'm looking more stable or with a better OO design. Do you know any set of class

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread b
On 07/30/2009 10:15 AM, Ashley Sheridan wrote: On Thu, 2009-07-30 at 07:12 -0700, Christoph Boget wrote: >> You could email it to me, which I presume is better if you replied back just to me and not the list? Just copying the list back on in this one now. I don't know of any places that you c

Re: [PHP] Formatting plain text file

2009-07-30 Thread kranthi
\n"; } wont this do ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Formatting plain text file

2009-07-30 Thread b
On 07/30/2009 06:29 PM, Skip Evans wrote: Jim Lucas wrote: Skip Evans wrote: Hey all, Am I brain fading or what? I'm so used to formatting text in tables for HTML display I can't think of how to do it for a plain text file. I just need to create a columned table of names and addresses type st

[PHP] Better Formatting Options?

2009-07-30 Thread sono-io
Is there a more efficient way to write the following? itemid='ABC1'",$db); printf("List: %s\n", money_format('$%i', mysql_result($result,0,"priceList"))); ?> I have many products per page and this code pulls the list price and formats it. It works fine, but I'd like to know if I c

[PHP] Re: This isn't infinitely recursive is it?

2009-07-30 Thread Ben Dunlap
> while (isset($FieldMap[$Field]) { Oops, left out the final close-parenthesis. I always do that with isset() for some reason. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Asterisk anyone?

2009-07-30 Thread Nathan Nobbe
On Wed, Jul 29, 2009 at 1:18 PM, Skip Evans wrote: > Hey, > > I've been asked to write a simple couple of public pages that would let an > Asterisk customer modify their account configuration, but the client has no > idea how Asterisk stores its data, apparently not in MySQL. > > Anyone know of a

[PHP] Re: This isn't infinitely recursive is it?

2009-07-30 Thread Ben Dunlap
> I don't THINK I need to worry about circular mappings... but I'm not > sure how to check for it if I did... > > Any suggestions? Thanks! Would the following work? It avoids recursion entirely and also checks for circular mappings. You can plug in your own code where the comments are to do whate

Re: [PHP] This isn't infinitely recursive is it?

2009-07-30 Thread Jonathan Tapicer
Hi, Well, you will have an infinite recursion there if the mapping has cycles, something like A->B, B->C, C->A would generate an invite recursion. Checking if the mapping has cycles is pretty simple: you have to create a directed graph and then go through the graph in DFS marking each visited nod

[PHP] This isn't infinitely recursive is it?

2009-07-30 Thread Matt Neimeyer
I'm cleaning up some inherited code in our data import module. For a variety of reasons we have to support old standards of the import format. Since some of those old versions were created we have since renamed some fields in our data structure. So right now I've a hard map for some field names...

Re: [PHP] Formatting plain text file

2009-07-30 Thread Robert Cummings
Skip Evans wrote: Jim Lucas wrote: Skip Evans wrote: Hey all, Am I brain fading or what? I'm so used to formatting text in tables for HTML display I can't think of how to do it for a plain text file. I just need to create a columned table of names and addresses type stuff... sprintf? or a li

Re: [PHP] Formatting plain text file

2009-07-30 Thread Skip Evans
Jim Lucas wrote: Skip Evans wrote: Hey all, Am I brain fading or what? I'm so used to formatting text in tables for HTML display I can't think of how to do it for a plain text file. I just need to create a columned table of names and addresses type stuff... sprintf? or a little str_pad on ea

Re: [PHP] Formatting plain text file

2009-07-30 Thread Jim Lucas
Skip Evans wrote: > Hey all, > > Am I brain fading or what? I'm so used to formatting text in tables for > HTML display I can't think of how to do it for a plain text file. > > I just need to create a columned table of names and addresses type > stuff... sprintf? or a little str_pad on each vari

[PHP] Formatting plain text file

2009-07-30 Thread Skip Evans
Hey all, Am I brain fading or what? I'm so used to formatting text in tables for HTML display I can't think of how to do it for a plain text file. I just need to create a columned table of names and addresses type stuff... sprintf? -- Skip Evans Big Sky

Re: [PHP] Asterisk anyone?

2009-07-30 Thread Skip Evans
I'm looking at this page now that shows working with the database through socket type stuff, but now the ball is in the client's court what they want to do. Not sure, so I'm just reading up. http://www.voip-info.org/tiki-index.php?page=Web+based+Asterisk+Database+maintenance But thanks all fo

Re: [PHP] regex - filtering out chinese utf8 characters

2009-07-30 Thread Jim Lucas
Merlin Morgenstern wrote: > Hi there, > > I am trying to filter out content that is not ascii. Can I do this with > regex? For example: > > $regex = '[AZ][09]'; > if (preg_match($regex, $text)) { > return TRUE; > } > else { > return FALSE; > } > > The reason I

Re: [PHP] regex - filtering out chinese utf8 characters

2009-07-30 Thread Daniel Kolbo
Merlin Morgenstern wrote: > Hi there, > > I am trying to filter out content that is not ascii. Can I do this with > regex? For example: > > $regex = '[AZ][09]'; > if (preg_match($regex, $text)) { > return TRUE; > } > else { > return FALSE; > } > > The reason I

Re: [PHP] Re: Page or URL function? (RESOLVED)

2009-07-30 Thread Ben Dunlap
Jim Lucas wrote: > Miller, Terion wrote: >> I Figured it out using this: >> >> if ($_SERVER['SCRIPT_FILENAME'] = "browse.php" ) { >> $default = "A"; >> } else { >> $default = ""; >> } >> >> $letter = isset($_GET['letter'])? $_GET['letter'] :"$default" ; > > unless you are doing more then w

Re: [PHP] Re: Page or URL function? (RESOLVED)

2009-07-30 Thread Jim Lucas
Miller, Terion wrote: > I Figured it out using this: > > if ($_SERVER['SCRIPT_FILENAME'] = "browse.php" ) { > $default = "A"; > }

Re: [PHP] Re: Page or URL function? (RESOLVED)

2009-07-30 Thread Miller, Terion
I Figured it out using this: if ($_SERVER['SCRIPT_FILENAME'] = "browse.php" ) { $default = "A"; }

Re: [PHP] regex - filtering out chinese utf8 characters

2009-07-30 Thread Stuart Connolly
Hi Merlin, I think the pattern you're looking for is '/[a-zA-Z0-9]/' which will match all alphanumeric characters. Cheers Stuart On 30 Jul 2009, at 19:13, Merlin Morgenstern wrote: Hi there, I am trying to filter out content that is not ascii. Can I do this with regex? For example:

[PHP] PHP 5.3 IIS 5.1 not working...help!

2009-07-30 Thread Fred Silsbee
http://72.47.28.125:8080/phpinfo.php not working ERROR: The website cannot display the page HTTP 500 IIS 5.1, PHP 5.3 XP Prof SP3 + all updates PHP 5.2.8 worked great and took a few minutes to install phpinfo.php is in C:\inetpub\wwwroot php.ini has: doc_root = "C:\inetpub\wwwroot" // fo

[PHP] regex - filtering out chinese utf8 characters

2009-07-30 Thread Merlin Morgenstern
Hi there, I am trying to filter out content that is not ascii. Can I do this with regex? For example: $regex = '[AZ][09]'; if (preg_match($regex, $text)) { return TRUE; } else { return FALSE; } The reason I need to do thi

Re: [PHP] preg_match too greedy

2009-07-30 Thread Ben Dunlap
Ben Dunlap wrote: > have -- "($x != false)" -- will be true whether $x is 0, NULL, an empty > string, [8<] > But "$x !== false" will only be true in the last case. Sorry, replace "be true" with "be false" above. -Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http

Re: [PHP] preg_match too greedy

2009-07-30 Thread Ben Dunlap
echo (preg_match($pattern, $test) != false) >> >> The " != false " here is redundant. > > Understood. But what you think is redundancy is, to me, clarity in > programming. I happen to think that boolean tests shouldn't ride on > whether or not an array returned from a function is empty or not

Re: [PHP] stdClass - A newbie question

2009-07-30 Thread Shawn McKenzie
MEM wrote: >> By the way, there are many reasons for creating objects inside of other >> objects. This should not be considered an exception. I don't know where >> this code belongs to, so I can't clear out if it is good or bad OOP >> style. > > I do not intend to public judge the author, but the

Re: [PHP] Freeing Memory

2009-07-30 Thread Dan Shirah
> > How would you go about ensuring the memory is not exhausted when running a > script ? > > I have a script, which to make it basic ... reads values from files, I > create an array of values per file then with a foreach insert values into a > table, I have added a line to echo the memory use aft

Re: [PHP] Asterisk anyone?

2009-07-30 Thread Per Jessen
Skip Evans wrote: > Per Jessen wrote: >> Depends on which data we're talking about. Asterisk is very >> flexible. >> > > For example, the first screen they want people to be able to > change data on is: > > call waiting,do not disturb > and then it looks like numbers (forwarding?) > unconditio

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Ashley Sheridan
On Thu, 2009-07-30 at 07:12 -0700, Christoph Boget wrote: > Well, I didn't want to upload a file to the list. Putting it in a > central location where those interested parties could access it would > be a much better option. > > > thnx, > Chris > > > ___

RE: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Bob McConnell
From: Christoph Boget >> Have you tried using 'file -i' from the command line: after all you are looking >> for a MIME type with your fileinfo... >> Having said that, with file -i on my system, Word documents are >> 'application/msword' and Excel files are 'application/octet-stream' > > $ file -i

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Christoph Boget
> The xls file I am using was generated with Excel (of Office 2007) for > the Mac.  So either you have a different magic file (assuming that's > what the file command uses) than I do or different versions of excel > contain different information. I just tried using an excel spreadsheet saved using

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Ashley Sheridan
On Thu, 2009-07-30 at 09:51 -0400, Christoph Boget wrote: > >> Having said that, with file -i on my system, Word documents are > >> 'application/msword' and Excel files are 'application/octet-stream' > > Fedora11 (2.6.29.6-213.fc11.i586) > > $ file excel.xls > > excel.xls: CDF V2 Document, Little E

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Christoph Boget
>> Having said that, with file -i on my system, Word documents are >> 'application/msword' and Excel files are 'application/octet-stream' > Fedora11 (2.6.29.6-213.fc11.i586) > $ file excel.xls > excel.xls: CDF V2 Document, Little Endian, Os: Windows, Version 5.1, Code > page: 1252, Author:

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Christoph Boget
> Have you tried using 'file -i' from the command line: after all you are > looking > for a MIME type with your fileinfo... > Having said that, with file -i on my system, Word documents are > 'application/msword' and Excel files are 'application/octet-stream' $ file -i excel.xls excel.xls: applic

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread b
On 07/30/2009 08:53 AM, Peter Ford wrote: Have you tried using 'file -i' from the command line: after all you are looking for a MIME type with your fileinfo... Having said that, with file -i on my system, Word documents are 'application/msword' and Excel files are 'application/octet-stream'

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Peter Ford
Christoph Boget wrote: >>> /usr/share/file/magic >> /usr/share/file/magic has lots of rules to know its type and its just >> matching it. > > I know it has a lot of rules. Grepping it for excel shows that there > are rules in it for those types of files as well. > >> Maybe your file is quite str

[PHP] Freeing Memory

2009-07-30 Thread Anton Heuschen
How would you go about ensuring the memory is not exhausted when running a script ? I have a script, which to make it basic ... reads values from files, I create an array of values per file then with a foreach insert values into a table, I have added a line to echo the memory use after each array

Re: [PHP] fileinfo returning wrong mime type for Excel files

2009-07-30 Thread Christoph Boget
> > /usr/share/file/magic > /usr/share/file/magic has lots of rules to know its type and its just > matching it. I know it has a lot of rules. Grepping it for excel shows that there are rules in it for those types of files as well. > Maybe your file is quite strange . have you tried with other x

RE: [PHP] stdClass - A newbie question

2009-07-30 Thread MEM
> By the way, there are many reasons for creating objects inside of other > objects. This should not be considered an exception. I don't know where > this code belongs to, so I can't clear out if it is good or bad OOP > style. I do not intend to public judge the author, but the original article is

[PHP] Word and UTF-8 (cyrillic, chinese, ...)

2009-07-30 Thread Sascha Meyer
Hi there, I am currently struggling in forcing Word to show a UTF-8 encoded document. The generated document is a normal web page with generated content from a mysql database. When I remove the header commands, the document with proper russian characters is displayed fine in the browser, but wh

AW: [PHP] stdClass - A newbie question

2009-07-30 Thread Bouz Alexander
Hello Márcio, stdClass is simply an empty class, without any properties or methods. The object in the code sample is used to return multiple values at once. He could also have used an associative array to achieve that, but by choosing an object, he shows his affinity to the object oriented prog

[PHP] stdClass - A newbie question

2009-07-30 Thread MEM
Hello everybody, In this class sketch: total_pages = $total_pages; $pagi_obj->offset = $offset; $pagi_obj->limit = $limit; $pagi_obj->page; return $pagi_obj; } } Why do the author used a stdClass ? What are the advantages of using

Re: [PHP] Asterisk anyone?

2009-07-30 Thread Sancar Saran
On Wednesday 29 July 2009 10:18:08 pm Skip Evans wrote: > Hey, > > I've been asked to write a simple couple of public pages that > would let an Asterisk customer modify their account > configuration, but the client has no idea how Asterisk stores > its data, apparently not in MySQL. > > Anyone know